[PR #5134] [MERGED] fix(mari): reference the preset variables Mari creates so they take effect #6644

Closed
opened 2026-10-23 04:12:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5134
Author: @kolacheee
Created: 8/16/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @kolacheee

Base: staging ← Head: fix/5080-mari-preset-variable-guidance


📝 Commits (1)

  • 0e8d825 fix(mari): reference the preset variables Mari creates so they take effect (#5080)

📊 Changes

4 files changed (+63 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 package.json (+1 -1)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+3 -3)
➕ scripts/regressions/professor-mari-preset-variables.regression.ts (+58 -0)

📄 Description

Linked issue

Closes #5080

Why this change

Professor Mari can create preset variables (choice blocks), but the prompt she builds never uses them, so they have no effect. A preset variable only reaches the model where a prompt section's content references it with the {{variableName}} macro (resolved in packages/server/src/services/prompt/assembler.ts). Mari's workspace guidance told her to create data.choiceBlocks but never that the variable is inert until a section references it — and her own worked example demonstrated the anti-pattern: a tone choice block next to a section whose content was a bare "You are {{char}}.", so {{tone}} never appeared. Users then saw a picker in the preset UI that changed nothing, which reads as broken.

What changed

Guidance-only (prompt + worked example) in packages/server/src/services/professor-mari/workspace-agent.service.ts:

  • The preset.create guidance now states that a choice block does nothing on its own — its picked value only reaches the model where a section's content references it with {{variableName}} — and that Mari must add that reference when she defines a variable. When she adds a variable to an existing preset with addChoiceBlock, she must also updateSection to weave {{variableName}} into a section.
  • The worked example's section now uses the variable: "You are {{char}}. Speak in a {{tone}} tone.".

No engine or schema change (the alternative of auto-inserting the macro engine-side was rejected in the issue — where a variable belongs is a semantic authoring decision).

Added a regression (professor-mari-preset-variables, wired into regression:issues) that parses each preset.create worked example and asserts every choiceBlock variable is referenced as {{variableName}} in a section, plus that the guidance names the macro and the inert-until-referenced rule. It fails on the old anti-pattern and passes on the fix (verified by temporarily reverting the example). workspaceCommandProtocolPrompt is exported solely so the regression can read the prompt — test affordance only, no behavior change.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Automated (run locally against this branch, all green):

  • pnpm check
  • pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/professor-mari-preset-variables.regression.ts (new; also in regression:issues)
  • Teeth-checked: reverting the worked example to the bare "You are {{char}}." makes the regression fail with preset.create example defines choice block 'tone' but no section references {{tone}}; restoring the fix passes.
  • Neighbor Mari lanes unaffected: professor-mari-prompt-context, professor-mari-documentation, mari-preset-granular, mari-workspace-context.

Still worth a manual check (a human should verify): ask Professor Mari to "create a preset with a tone variable" and confirm the section she writes actually contains {{tone}}, then pick a value in the preset UI and confirm the assembled prompt changes.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md gets a Fixed entry. No user-facing docs under docs/ changed — docs/prompts/preset-variables.md already teaches the correct {{tone}}-in-a-section pattern, so there is nothing to mirror on docs-i18n. No version bump.

Summary by CodeRabbit

  • New Features

    • Professor Mari now supports using created variables directly in preset sections with {{variableName}} macros.
    • Choice blocks can now influence assembled prompts when their variables are referenced in section content.
  • Bug Fixes

    • Improved preset guidance so variable-based choices are correctly connected to generated prompt content.
  • Documentation

    • Added an unreleased changelog entry describing the new variable behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5134 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/16/2026 **Status:** ✅ Merged **Merged:** 8/16/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/5080-mari-preset-variable-guidance` --- ### 📝 Commits (1) - [`0e8d825`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0e8d82577b7b375cb4782a36f08c7102e8847239) fix(mari): reference the preset variables Mari creates so they take effect (#5080) ### 📊 Changes **4 files changed** (+63 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `package.json` (+1 -1) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+3 -3) ➕ `scripts/regressions/professor-mari-preset-variables.regression.ts` (+58 -0) </details> ### 📄 Description ## Linked issue Closes #5080 ## Why this change Professor Mari can create preset variables (choice blocks), but the prompt she builds never uses them, so they have no effect. A preset variable only reaches the model where a prompt **section's content** references it with the `{{variableName}}` macro (resolved in `packages/server/src/services/prompt/assembler.ts`). Mari's workspace guidance told her to create `data.choiceBlocks` but never that the variable is inert until a section references it — and her own worked example demonstrated the anti-pattern: a `tone` choice block next to a section whose content was a bare `"You are {{char}}."`, so `{{tone}}` never appeared. Users then saw a picker in the preset UI that changed nothing, which reads as broken. ## What changed Guidance-only (prompt + worked example) in `packages/server/src/services/professor-mari/workspace-agent.service.ts`: - The `preset.create` guidance now states that a choice block does nothing on its own — its picked value only reaches the model where a section's `content` references it with `{{variableName}}` — and that Mari must add that reference when she defines a variable. When she adds a variable to an **existing** preset with `addChoiceBlock`, she must also `updateSection` to weave `{{variableName}}` into a section. - The worked example's section now uses the variable: `"You are {{char}}. Speak in a {{tone}} tone."`. No engine or schema change (the alternative of auto-inserting the macro engine-side was rejected in the issue — where a variable belongs is a semantic authoring decision). Added a regression (`professor-mari-preset-variables`, wired into `regression:issues`) that parses each `preset.create` worked example and asserts every `choiceBlock` variable is referenced as `{{variableName}}` in a section, plus that the guidance names the macro and the inert-until-referenced rule. It fails on the old anti-pattern and passes on the fix (verified by temporarily reverting the example). `workspaceCommandProtocolPrompt` is exported solely so the regression can read the prompt — test affordance only, no behavior change. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Automated (run locally against this branch, all green): - `pnpm check` - `pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/professor-mari-preset-variables.regression.ts` (new; also in `regression:issues`) - Teeth-checked: reverting the worked example to the bare `"You are {{char}}."` makes the regression fail with `preset.create example defines choice block 'tone' but no section references {{tone}}`; restoring the fix passes. - Neighbor Mari lanes unaffected: `professor-mari-prompt-context`, `professor-mari-documentation`, `mari-preset-granular`, `mari-workspace-context`. Still worth a manual check (a human should verify): ask Professor Mari to "create a preset with a tone variable" and confirm the section she writes actually contains `{{tone}}`, then pick a value in the preset UI and confirm the assembled prompt changes. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `CHANGELOG.md` gets a `Fixed` entry. No user-facing docs under `docs/` changed — `docs/prompts/preset-variables.md` already teaches the correct `{{tone}}`-in-a-section pattern, so there is nothing to mirror on `docs-i18n`. No version bump. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Professor Mari now supports using created variables directly in preset sections with `{{variableName}}` macros. - Choice blocks can now influence assembled prompts when their variables are referenced in section content. - **Bug Fixes** - Improved preset guidance so variable-based choices are correctly connected to generated prompt content. - **Documentation** - Added an unreleased changelog entry describing the new variable behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:12:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6644
No description provided.