[PR #6630] [MERGED] feat: teach Mari Decision-aware authoring and preferences #7261

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6630
Author: @kolacheee
Created: 9/24/2026
Status: ✅ Merged
Merged: 9/24/2026
Merged by: @kolacheee

Base: staging ← Head: codex/mari-decision-authoring


📝 Commits (4)

  • 641386a feat: begin Mari Decision authoring guidance
  • 0a82ecb feat: add Decision-aware Mari authoring and remembered preferences
  • 301cdc6 test: preserve Decision previews before write consent
  • fa08d5d fix: preserve legacy agent settings during Mari edits

📊 Changes

10 files changed (+1219 additions, -61 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/home/professor-mari.md (+16 -0)
➕ e2e/mari-decision-authoring.e2e.ts (+145 -0)
📝 packages/server/src/routes/decision.routes.ts (+4 -29)
➕ packages/server/src/services/decision/decision-status.ts (+71 -0)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+73 -8)
➕ packages/server/src/services/professor-mari/decision-authoring.ts (+289 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+29 -4)
📝 scripts/regressions/mari/db-validation-scope.regression.ts (+100 -20)
➕ scripts/regressions/mari/decision-authoring.regression.ts (+490 -0)

📄 Description

Linked issue

Closes #6629

Why this change

Mari could store Decision fields without knowing whether a Decision model was selected or whether the user wanted those dependencies. She also had no durable record of a setup warning, so a long or new chat could repeat the same conversation. Invalid agent activation settings could be saved and then ignored by the runtime.

What changed

  • Add live, read-only Decision selection and known-availability context, shared with the existing selection logic. Checking status never starts a model or sends a provider request; selected, unavailable, none and unknown remain distinct.
  • Teach the reviewed Decision syntax, agent/lorebook activation fields, fallbacks, phase/context limits, model-specific thresholds, suitable timing controls, and cache-aware placement. Correct the older agent example to put keyword settings inside settings.
  • Persist separate Decision-use, setup-reminder and placement interactions in each Mari chat. Pending questions cannot be self-answered in the same user turn; task-only permission expires. Relevant enabled Memory/Skill sources are rechecked, including after disabling or deleting them.
  • Honor “stop reminding me” in the current chat and through the existing Memory/Keep & Enable flow in future chats. Suppressed reminders do not authorize unsolicited Decisions. Without a usable selected model, adding Decision content still needs a current explicit request.
  • Check newly introduced dependencies at the normalized write boundary, including whole-entity child inserts and raw Mari CLI edits. Unrelated edits and removal remain possible; timing/threshold tuning does not introduce a new dependency. History/depth insertion has a separate placement check. The existing Permissions Modes, edit reviews and read-back verification remain in place.
  • Validate newly changed agent activation settings using the shared runtime schema and support clearing the question/threshold/cadence fields without restoring deleted keys or losing other settings. Legacy invalid settings do not block unrelated edits or undo; an explicit database audit still reports them.

Natural-language interpretation, sparse authoring and identifying early placement in the final expanded prompt remain model responsibilities. Recorded quotes establish provenance; they are not a semantic consent classifier. No English-only permission or scope keyword rules were added.

Validation

Completed locally:

  • pnpm install, pnpm check, pnpm version:check, and git diff --check passed. The existing GameNarration hook-dependency warning remains.
  • All 27 Mari regressions passed, including the new file-store fixture for status, creation/update paths, pending/allowed/declined answers, long and new chats, enabled/disabled/deleted Memories and Skills, field clearing, invalid settings, and raw-write checks.
  • pnpm regression:prompt passed all three lanes; the Decision regression filter passed 9/9.
  • Focused pnpm smoke:ui runs passed on desktop Chromium, mobile Chromium and mobile WebKit: 12 checks for the workspace conversation/edit/review flows, and 12 for the final conversation flow plus Decision selection and agent activation. The conversation provider is scripted; these prove the real command loop and persistence, not model quality. The complete UI suite was not run locally.
  • The production container built and passed API/frontend, native-binding and persistent-data checks with networking disabled. It was built from implementation commit 0a82ecb1f; the subsequent changes add regression coverage and scope validation to changed agent settings; this container result predates the compatibility fix.
  • All 10 local link targets in the updated Mari guide exist.

An intermediate regression run overlapped the shared-package rebuild and failed to load its temporarily absent output; the serial rerun passed 27/27. The first container smoke lacked build metadata; rebuilding with the standard build arguments passed.

Local CodeRabbit completed two reviews (2 findings initially, 1 in the final review). The timing/threshold restriction was fixed. The suggested minimum quote length, word boundaries and scope phrases were rejected because legitimate short/multilingual replies and indirect preferences cannot be classified that way; the source and pending-turn checks remain, with regression coverage. The suggestion to require authoring consent for dry-run previews was also rejected: Plan mode and review preparation must remain available before permission to persist. A regression proves the preview saves nothing and the same applied write is refused without permission.

Follow-up review and CI investigation

Addressed review https://github.com/Pasta-Devs/Marinara-Engine/pull/6630#pullrequestreview-5308820927: reproduced an unrelated rename failing on legacy activation values, then scoped both pre-write and post-apply validation to changed settings. Undo preserves the original legacy values, and explicit mari db validate still checks every field. The regression also covers direct CLI edits, unrelated settings, partial repair/clearing, and rejection of newly invalid activation values without persistence.

  • The follow-up pnpm check passed (the same existing GameNarration warning); the Mari service regression filter passed 16/16, and local CodeRabbit completed with zero findings on the compatibility fix.
  • The failed mobile WebKit 9/10 case is the visual-novel Whisper test's access-control console errors tracked in #6628. Its behavior assertions passed before the final error-list assertion failed.
  • The failed mobile WebKit 3/10 avatar-editor trace explicitly reports Network process crashed, then fails loading CharacterEditor.tsx with a WebKit internal error and reloads to Home. This points to a browser-process failure, rather than the Mari validation change.
  • The targeted local mobile WebKit run passed the avatar-editor test and Mari Decision authoring flow (2/3), while Whisper reproduced the known #6628 access-control failure after its behavior assertions. No browser assertions were weakened or skipped.
  • Fresh GitHub CI and review are required on the updated head; the previous run's failures are not treated as passing.

Manual verification still needed

  • With a real Mari model, verify ordinary versus explicit Decision requests with no model, a selected local model and a selected hosted model.
  • Verify approval/refusal, task-only preferences, long/reopened chats, and “stop reminding me” followed by Keep & Enable and a new chat.
  • Verify enabled Memories/Skills influence the intended task, while mere syntax guidance and disabled preferences do not.
  • Inspect the generated content in Peek Prompt, including positive/negative scenes, timing, early placement and history insertion.
  • Verify Keep/Restore and each Permissions Mode through the browser.
  • Read and follow CONTRIBUTING.md.

Docs and release impact

Updated docs/home/professor-mari.md and the Unreleased changelog. The guide is included in the existing batched translation follow-up #6532; translate after this English revision is reviewed and merged. No version bump or UI layout changes.

GitHub CI and GitHub CodeRabbit remain merge gates. This task does not authorize a merge.

Summary by CodeRabbit

  • New Features
    • Professor Mari can create Decision-driven content with awareness of the selected Decision model. She asks permission before adding Decision content or changing prompt placement, and can remember setup-reminder preferences per chat, with optional persistence through enabled Memory.
    • Added guidance for using Decisions with Professor Mari, including activation questions, lorebook entries, conditional prompts, sparse-use defaults, and preference settings.
  • Bug Fixes
    • Newly introduced invalid agent activation settings are rejected, while legacy settings remain editable and undoable. Decision interaction state can’t be changed through unsupported write paths.

🔄 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/6630 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/24/2026 **Status:** ✅ Merged **Merged:** 9/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `codex/mari-decision-authoring` --- ### 📝 Commits (4) - [`641386a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/641386a5cd2a0b5fe9f373524c9b8ceb70430e09) feat: begin Mari Decision authoring guidance - [`0a82ecb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0a82ecb1f9082a75746985c188321e2b9f35adf2) feat: add Decision-aware Mari authoring and remembered preferences - [`301cdc6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/301cdc610a78c594978611b428973a15cd348356) test: preserve Decision previews before write consent - [`fa08d5d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fa08d5dcccff2374c39a77fcc50387a31855f9c5) fix: preserve legacy agent settings during Mari edits ### 📊 Changes **10 files changed** (+1219 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/home/professor-mari.md` (+16 -0) ➕ `e2e/mari-decision-authoring.e2e.ts` (+145 -0) 📝 `packages/server/src/routes/decision.routes.ts` (+4 -29) ➕ `packages/server/src/services/decision/decision-status.ts` (+71 -0) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+73 -8) ➕ `packages/server/src/services/professor-mari/decision-authoring.ts` (+289 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+29 -4) 📝 `scripts/regressions/mari/db-validation-scope.regression.ts` (+100 -20) ➕ `scripts/regressions/mari/decision-authoring.regression.ts` (+490 -0) </details> ### 📄 Description ## Linked issue Closes #6629 ## Why this change Mari could store Decision fields without knowing whether a Decision model was selected or whether the user wanted those dependencies. She also had no durable record of a setup warning, so a long or new chat could repeat the same conversation. Invalid agent activation settings could be saved and then ignored by the runtime. ## What changed - Add live, read-only Decision selection and known-availability context, shared with the existing selection logic. Checking status never starts a model or sends a provider request; selected, unavailable, none and unknown remain distinct. - Teach the reviewed Decision syntax, agent/lorebook activation fields, fallbacks, phase/context limits, model-specific thresholds, suitable timing controls, and cache-aware placement. Correct the older agent example to put keyword settings inside `settings`. - Persist separate Decision-use, setup-reminder and placement interactions in each Mari chat. Pending questions cannot be self-answered in the same user turn; task-only permission expires. Relevant enabled Memory/Skill sources are rechecked, including after disabling or deleting them. - Honor “stop reminding me” in the current chat and through the existing Memory/Keep & Enable flow in future chats. Suppressed reminders do not authorize unsolicited Decisions. Without a usable selected model, adding Decision content still needs a current explicit request. - Check newly introduced dependencies at the normalized write boundary, including whole-entity child inserts and raw Mari CLI edits. Unrelated edits and removal remain possible; timing/threshold tuning does not introduce a new dependency. History/depth insertion has a separate placement check. The existing Permissions Modes, edit reviews and read-back verification remain in place. - Validate newly changed agent activation settings using the shared runtime schema and support clearing the question/threshold/cadence fields without restoring deleted keys or losing other settings. Legacy invalid settings do not block unrelated edits or undo; an explicit database audit still reports them. Natural-language interpretation, sparse authoring and identifying early placement in the final expanded prompt remain model responsibilities. Recorded quotes establish provenance; they are not a semantic consent classifier. No English-only permission or scope keyword rules were added. ## Validation Completed locally: - `pnpm install`, `pnpm check`, `pnpm version:check`, and `git diff --check` passed. The existing GameNarration hook-dependency warning remains. - All 27 Mari regressions passed, including the new file-store fixture for status, creation/update paths, pending/allowed/declined answers, long and new chats, enabled/disabled/deleted Memories and Skills, field clearing, invalid settings, and raw-write checks. - `pnpm regression:prompt` passed all three lanes; the Decision regression filter passed 9/9. - Focused `pnpm smoke:ui` runs passed on desktop Chromium, mobile Chromium and mobile WebKit: 12 checks for the workspace conversation/edit/review flows, and 12 for the final conversation flow plus Decision selection and agent activation. The conversation provider is scripted; these prove the real command loop and persistence, not model quality. The complete UI suite was not run locally. - The production container built and passed API/frontend, native-binding and persistent-data checks with networking disabled. It was built from implementation commit `0a82ecb1f`; the subsequent changes add regression coverage and scope validation to changed agent settings; this container result predates the compatibility fix. - All 10 local link targets in the updated Mari guide exist. An intermediate regression run overlapped the shared-package rebuild and failed to load its temporarily absent output; the serial rerun passed 27/27. The first container smoke lacked build metadata; rebuilding with the standard build arguments passed. Local CodeRabbit completed two reviews (2 findings initially, 1 in the final review). The timing/threshold restriction was fixed. The suggested minimum quote length, word boundaries and scope phrases were rejected because legitimate short/multilingual replies and indirect preferences cannot be classified that way; the source and pending-turn checks remain, with regression coverage. The suggestion to require authoring consent for dry-run previews was also rejected: Plan mode and review preparation must remain available before permission to persist. A regression proves the preview saves nothing and the same applied write is refused without permission. ### Follow-up review and CI investigation Addressed review https://github.com/Pasta-Devs/Marinara-Engine/pull/6630#pullrequestreview-5308820927: reproduced an unrelated rename failing on legacy activation values, then scoped both pre-write and post-apply validation to changed settings. Undo preserves the original legacy values, and explicit `mari db validate` still checks every field. The regression also covers direct CLI edits, unrelated settings, partial repair/clearing, and rejection of newly invalid activation values without persistence. - The follow-up `pnpm check` passed (the same existing GameNarration warning); the Mari service regression filter passed 16/16, and local CodeRabbit completed with zero findings on the compatibility fix. - The failed mobile WebKit 9/10 case is the visual-novel Whisper test's access-control console errors tracked in #6628. Its behavior assertions passed before the final error-list assertion failed. - The failed mobile WebKit 3/10 avatar-editor trace explicitly reports `Network process crashed`, then fails loading `CharacterEditor.tsx` with a WebKit internal error and reloads to Home. This points to a browser-process failure, rather than the Mari validation change. - The targeted local mobile WebKit run passed the avatar-editor test and Mari Decision authoring flow (2/3), while Whisper reproduced the known #6628 access-control failure after its behavior assertions. No browser assertions were weakened or skipped. - Fresh GitHub CI and review are required on the updated head; the previous run's failures are not treated as passing. ### Manual verification still needed - [ ] With a real Mari model, verify ordinary versus explicit Decision requests with no model, a selected local model and a selected hosted model. - [ ] Verify approval/refusal, task-only preferences, long/reopened chats, and “stop reminding me” followed by Keep & Enable and a new chat. - [ ] Verify enabled Memories/Skills influence the intended task, while mere syntax guidance and disabled preferences do not. - [ ] Inspect the generated content in Peek Prompt, including positive/negative scenes, timing, early placement and history insertion. - [ ] Verify Keep/Restore and each Permissions Mode through the browser. - [ ] Read and follow CONTRIBUTING.md. ## Docs and release impact Updated `docs/home/professor-mari.md` and the Unreleased changelog. The guide is included in the existing batched translation follow-up #6532; translate after this English revision is reviewed and merged. No version bump or UI layout changes. GitHub CI and GitHub CodeRabbit remain merge gates. This task does not authorize a merge. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Professor Mari can create Decision-driven content with awareness of the selected Decision model. She asks permission before adding Decision content or changing prompt placement, and can remember setup-reminder preferences per chat, with optional persistence through enabled Memory. * Added guidance for using Decisions with Professor Mari, including activation questions, lorebook entries, conditional prompts, sparse-use defaults, and preference settings. * **Bug Fixes** * Newly introduced invalid agent activation settings are rejected, while legacy settings remain editable and undoable. Decision interaction state can’t be changed through unsupported write paths. <!-- 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:18:02 +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#7261
No description provided.