[PR #5973] [MERGED] fix(mari): preserve edits and repair malformed command frames #7007

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5973
Author: @SpicyMarinara
Created: 9/8/2026
Status: ✅ Merged
Merged: 9/8/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/mari-command-claims-5966-5967


📝 Commits (4)

  • 7f90a64 chore: start Mari command repair (#5966, #5967)
  • 5dd346e fix(mari): preserve command frames before auditing completion
  • 2f0d3ef fix(mari): validate each command and narrow completion reports
  • 4d60b38 Merge remote-tracking branch 'origin/staging' into fix/mari-command-claims-5966-5967

📊 Changes

4 files changed (+333 additions, -93 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+151 -93)
➕ scripts/regressions/mari-completion-frames.regression.ts (+108 -0)
📝 scripts/regressions/prompt.regression.ts (+72 -0)

📄 Description

Linked issue

Closes #5966
Closes #5967

Why this change

Mari could claim a requested edit was saved without producing a review card. The unreleased claim audit also discarded real commands when their frame said the edit was complete before those commands had executed.

What changed

  • Execute a complete frame's commands before auditing its claim, and include the executed results in any repair conversation. Truncated frames still cannot execute. Existing permission floors and review handling remain in force.
  • Reuse the provider's tolerant command parser for function wrappers and tool aliases; accept singleton command objects and parameters. An unrecognized command invalidates the whole frame for bounded protocol repair, preventing partial execution and silent drops.
  • Correct the requested lorebook-edit example to apply:true and explain the flag in its schema. Explicit previews still save nothing.
  • Recognize common completion wording, curly apostrophes, and bare completion phrases. Debug mode captures raw workspace replies; malformed frames produce a warning without logging their contents at the normal level.
  • Add an Unreleased changelog entry and regression coverage.

Validation

Automated evidence:

  • pnpm check passed, including localization, formatting, lint/type checks, E2E types, and production builds.
  • pnpm regression:prompt passed.
  • The storage-backed mixed-frame regression fails against unchanged staging (the description remains Original) and passes with the fix. Auto mode persists the edit and returns store-verified evidence; Manual and Plan prevent it.
  • Parser regressions fail before the fix and pass afterward, covering wrapper/alias/argument shapes, singleton commands, invalid mixed frames, and completion wording with negative controls.
  • The wider Mari lane passed 24/25. mari-guard-sibling-paths fails its canonical store-link snapshot assertion on this macOS checkout; the exact failure also reproduces against unchanged staging. Hosted CI remains a merge gate.

Human verification tasks:

  • Manually verify a requested lorebook edit produces its Keep/Restore card.
  • Manually verify explicit previews and permission holds remain read-only.
  • Manually verify a captured Kimi K3 or GLM 5.3 reply through its real provider. No live-provider result is claimed.
  • Build and run the container.

Risk and scope

The completion detector remains an English-language heuristic, and a state read cannot semantically prove every sentence in a claim. This fixes the demonstrated parser/ordering defects without changing mutation defaults or introducing another authorization gate. No user-facing docs, release metadata, dependencies, or mainline changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when Professor Mari edits frames and recovers from incomplete or malformed commands.
    • Ensured changes made alongside completion messages are correctly executed and verified.
    • Improved handling of preview versus saved changes and expanded recognition of mutation completion claims.
    • Added safer recovery when command formats cannot be interpreted, including clearer protocol repair behavior.
  • Tests

    • Added regression coverage for mixed completion frames, permission modes, supported mutation command formats, and invalid command handling.

🔄 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/5973 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/8/2026 **Status:** ✅ Merged **Merged:** 9/8/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/mari-command-claims-5966-5967` --- ### 📝 Commits (4) - [`7f90a64`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f90a647e1020ae5b01292586b63d184ab1f7dd4) chore: start Mari command repair (#5966, #5967) - [`5dd346e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5dd346edb252180f1b11822cb7db9ec923924c9d) fix(mari): preserve command frames before auditing completion - [`2f0d3ef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2f0d3ef636632404ce051a352395602bf2419b2c) fix(mari): validate each command and narrow completion reports - [`4d60b38`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4d60b38c3e49cdc014a4d2f142213733553f755e) Merge remote-tracking branch 'origin/staging' into fix/mari-command-claims-5966-5967 ### 📊 Changes **4 files changed** (+333 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+151 -93) ➕ `scripts/regressions/mari-completion-frames.regression.ts` (+108 -0) 📝 `scripts/regressions/prompt.regression.ts` (+72 -0) </details> ### 📄 Description ## Linked issue Closes #5966 Closes #5967 ## Why this change Mari could claim a requested edit was saved without producing a review card. The unreleased claim audit also discarded real commands when their frame said the edit was complete before those commands had executed. ## What changed - Execute a complete frame's commands before auditing its claim, and include the executed results in any repair conversation. Truncated frames still cannot execute. Existing permission floors and review handling remain in force. - Reuse the provider's tolerant command parser for function wrappers and tool aliases; accept singleton command objects and `parameters`. An unrecognized command invalidates the whole frame for bounded protocol repair, preventing partial execution and silent drops. - Correct the requested lorebook-edit example to `apply:true` and explain the flag in its schema. Explicit previews still save nothing. - Recognize common completion wording, curly apostrophes, and bare completion phrases. Debug mode captures raw workspace replies; malformed frames produce a warning without logging their contents at the normal level. - Add an Unreleased changelog entry and regression coverage. ## Validation Automated evidence: - `pnpm check` passed, including localization, formatting, lint/type checks, E2E types, and production builds. - `pnpm regression:prompt` passed. - The storage-backed mixed-frame regression fails against unchanged staging (the description remains `Original`) and passes with the fix. Auto mode persists the edit and returns store-verified evidence; Manual and Plan prevent it. - Parser regressions fail before the fix and pass afterward, covering wrapper/alias/argument shapes, singleton commands, invalid mixed frames, and completion wording with negative controls. - The wider Mari lane passed 24/25. `mari-guard-sibling-paths` fails its canonical store-link snapshot assertion on this macOS checkout; the exact failure also reproduces against unchanged staging. Hosted CI remains a merge gate. Human verification tasks: - [ ] Manually verify a requested lorebook edit produces its Keep/Restore card. - [ ] Manually verify explicit previews and permission holds remain read-only. - [ ] Manually verify a captured Kimi K3 or GLM 5.3 reply through its real provider. No live-provider result is claimed. - [ ] Build and run the container. ## Risk and scope The completion detector remains an English-language heuristic, and a state read cannot semantically prove every sentence in a claim. This fixes the demonstrated parser/ordering defects without changing mutation defaults or introducing another authorization gate. No user-facing docs, release metadata, dependencies, or mainline changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved reliability when Professor Mari edits frames and recovers from incomplete or malformed commands. - Ensured changes made alongside completion messages are correctly executed and verified. - Improved handling of preview versus saved changes and expanded recognition of mutation completion claims. - Added safer recovery when command formats cannot be interpreted, including clearer protocol repair behavior. - **Tests** - Added regression coverage for mixed completion frames, permission modes, supported mutation command formats, and invalid command handling. <!-- 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:15: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#7007
No description provided.