[PR #8366] [MERGED] fix(mari): make write results say what actually happened #8320

Closed
opened 2026-10-27 06:07:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8366
Author: @ylli-selmani
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ylli-selmani

Base: staging ← Head: fix/mari-result-honesty


📝 Commits (1)

  • 406eec8 fix(mari): make write results say what actually happened

📊 Changes

6 files changed (+34 additions, -5 deletions)

View changed files

📝 packages/server/src/services/mari-db/mari-db.service.ts (+2 -1)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+9 -2)
📝 packages/server/src/services/professor-mari/workspace-round-review.ts (+1 -1)
📝 scripts/regressions/mari-write-readback.regression.ts (+13 -0)
📝 scripts/regressions/mari/lorebook-selective-notice.regression.ts (+5 -0)
📝 scripts/regressions/professor-mari/round-review.regression.ts (+4 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8365

Why this change

Professor Mari reads her own tool results literally, and four of them said something other than what happened. Strong models (GLM 5.3, Claude) already acted on them wrongly in live runs; smaller models will do worse:

  • Every applied write showed approval: { status: "pending" }. That is the change card's undo window, but next to "Applied and saved" she read it as "waiting for Accept" and told users a saved change was still pending (seen three times, once on a memory).
  • validation sat after the before/after preview, so on a long result the truncation cut the notices first, even though the message tells her to read them.
  • The "selective is on but secondaryKeys is empty" notice only explained how to need two words. On imported books the usual fix is selective: false.
  • The completion-claim repair said "no mutating command succeeded in this run" when the audit only looks since her last checked reply, inviting her to redo a write that had already saved.

What changed

Mari's view of a write result (compactMutationResult, workspace-agent.service.ts)

  • An applied write now shows changeCard: { undoUntil } instead of approval. Non-applied results keep approval as before.
  • The raw result is unchanged. The receipts, the reviewId lookup, and the keep/undo routes all read the raw result, never this view. "Staged" detection uses the sensitive-file text, not approval.
  • validation moves up to sit right after readBack, so it survives truncation.

Lorebook selective notice (selectiveKeysNotice, mari-db.service.ts)

  • One sentence added: "If one keyword is enough (common on imported books), set selective: false."

Completion-claim repair (workspace-round-review.ts)

  • Now reads "no mutating command succeeded since your last checked reply (anything applied before it still stands)".

Regressions

  • mari-write-readback now pins: the raw result keeps approval.status: "pending", her view has no approval key, changeCard.undoUntil equals the review's expiresAt, no "pending" appears anywhere in the applied view, and validation comes before summary.
  • mari/lorebook-selective-notice and professor-mari/round-review pin the new wording.

No handbook (mari-skills/*.md) teaches the approval field, so no skill text changes.

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

Agent-run: pnpm check exits 0 (one pre-existing client lint warning this branch doesn't touch). node scripts/run-regressions.mjs --filter passes for mari-write-readback, round-review, lorebook-selective-notice, dry-run-enforcement, pi-runtime, character-onboarding.

  • Manually verify in the browser that after Mari updates a lorebook entry or character, she says the change is saved (with an undo window), not that it is waiting for your Accept.
  • Manually verify that the change card still shows, and that Undo and Keep both still work on that write.
  • Manually verify that on an imported lorebook entry with selective on and no secondary keys, Mari's notice offers selective: false.
  • Manually verify that after a completion claim gets repaired, Mari does not redo a write she already saved earlier in the run.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

UI evidence (if applicable)

No UI changes; the change is in the engine's tool results.

🤖 Generated with Claude Code


🔄 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/8366 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `fix/mari-result-honesty` --- ### 📝 Commits (1) - [`406eec8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/406eec80ec44a13179fdbee9f3abb6cff9f476fd) fix(mari): make write results say what actually happened ### 📊 Changes **6 files changed** (+34 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+2 -1) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+9 -2) 📝 `packages/server/src/services/professor-mari/workspace-round-review.ts` (+1 -1) 📝 `scripts/regressions/mari-write-readback.regression.ts` (+13 -0) 📝 `scripts/regressions/mari/lorebook-selective-notice.regression.ts` (+5 -0) 📝 `scripts/regressions/professor-mari/round-review.regression.ts` (+4 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #8365 ## Why this change Professor Mari reads her own tool results literally, and four of them said something other than what happened. Strong models (GLM 5.3, Claude) already acted on them wrongly in live runs; smaller models will do worse: - Every applied write showed `approval: { status: "pending" }`. That is the change card's undo window, but next to "Applied and saved" she read it as "waiting for Accept" and told users a saved change was still pending (seen three times, once on a memory). - `validation` sat after the before/after preview, so on a long result the truncation cut the notices first, even though the message tells her to read them. - The "selective is on but secondaryKeys is empty" notice only explained how to need two words. On imported books the usual fix is `selective: false`. - The completion-claim repair said "no mutating command succeeded **in this run**" when the audit only looks since her last checked reply, inviting her to redo a write that had already saved. ## What changed **Mari's view of a write result** (`compactMutationResult`, `workspace-agent.service.ts`) - An applied write now shows `changeCard: { undoUntil }` instead of `approval`. Non-applied results keep `approval` as before. - The raw result is unchanged. The receipts, the `reviewId` lookup, and the keep/undo routes all read the raw result, never this view. "Staged" detection uses the sensitive-file text, not `approval`. - `validation` moves up to sit right after `readBack`, so it survives truncation. **Lorebook selective notice** (`selectiveKeysNotice`, `mari-db.service.ts`) - One sentence added: "If one keyword is enough (common on imported books), set selective: false." **Completion-claim repair** (`workspace-round-review.ts`) - Now reads "no mutating command succeeded since your last checked reply (anything applied before it still stands)". **Regressions** - `mari-write-readback` now pins: the raw result keeps `approval.status: "pending"`, her view has no `approval` key, `changeCard.undoUntil` equals the review's `expiresAt`, no `"pending"` appears anywhere in the applied view, and `validation` comes before `summary`. - `mari/lorebook-selective-notice` and `professor-mari/round-review` pin the new wording. No handbook (`mari-skills/*.md`) teaches the `approval` field, so no skill text changes. ## 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 Agent-run: `pnpm check` exits 0 (one pre-existing client lint warning this branch doesn't touch). `node scripts/run-regressions.mjs --filter` passes for `mari-write-readback`, `round-review`, `lorebook-selective-notice`, `dry-run-enforcement`, `pi-runtime`, `character-onboarding`. - Manually verify in the browser that after Mari updates a lorebook entry or character, she says the change is saved (with an undo window), not that it is waiting for your Accept. - Manually verify that the change card still shows, and that Undo and Keep both still work on that write. - Manually verify that on an imported lorebook entry with `selective` on and no secondary keys, Mari's notice offers `selective: false`. - Manually verify that after a completion claim gets repaired, Mari does not redo a write she already saved earlier in the run. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) ## UI evidence (if applicable) No UI changes; the change is in the engine's tool results. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 06:07:41 +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#8320
No description provided.