mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5775] [MERGED] fix(mari): staged sensitive changes no longer satisfy the verification guard #6927
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6927
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5775
Author: @kolacheee
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5756-staged-mutation-guard📝 Commits (6)
aededb0fix(server): distinguish staged workspace changes8dd31b9fix(mari): harden the staged-change gate against marker forgery (#5756)3531d0ffix(mari): close the staged-round gaps the adversarial review confirmed (#5756)a562c38fix(mari): harden approval dedupe against case and mid-approve races (CodeRabbit)bd473fdfix(regression): update the #5740 outcome pin for the staged "held" mapping3852418fix(mari): staged results leave completed verification standing (CodeRabbit)📊 Changes
6 files changed (+145 additions, -12 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+42 -6)📝
packages/server/src/services/professor-mari/workspace-change-review.service.ts(+24 -2)📝
packages/shared/src/types/professor-mari-workspace.ts(+5 -3)📝
scripts/regressions/mari-understood-request.regression.ts(+4 -1)📝
scripts/regressions/prompt.regression.ts(+69 -0)📄 Description
Linked issue
Closes #5756
Why this change
write/editcommands can succeed while only staging the change behind a user approval, but the workspace verification guard counted every successful non-app_datamutation as applied. A follow-up read of the (unchanged) file then satisfied the guard, so Mari could claim a change was done while the approval was still pending — exactly the silent-persistent-failure class the guard exists to prevent.What changed
isAppliedWorkspaceMutationno longer counts a sensitivewrite/editresult whose output is the engine's staging response as an applied mutation, so staged changes create no verification state and a read of the unchanged file can't "verify" them. Regression cases cover staged write, staged edit, and an ordinary applied write.write/editechoes the model-chosen path (which on Linux may legally contain newlines), so an applied mutation could pose as staged and skip verification debt — weakening the guard. The staging marker is engine-authored at position zero of the output andcompactOutput()only truncates tails, so the gate now usesstartsWithagainst a sharedSTAGED_SENSITIVE_CHANGE_PREFIXconstant that both staging emitters reference (emitters and detector can no longer drift). New regression cases pin the forgery scenario (marker on a later line still counts as applied) and staged/applied mixed rounds in both orders.[applied → read → staged]rounds lost interception: the staged result became inert in the resolver, so the round read "verified" and a completion claim covering the staged file shipped unchallenged — while its approval card silently expires after 10 minutes. Staged results now reset the verifying-read flag without counting as a mutation, and the resolver gains a dedicated"staged"state, so the claim is still intercepted with accurate coaching.stageSensitiveFileChangeis idempotent for an identical path/before/after change.Pre-existing sibling gaps the review also confirmed (same bug class, not introduced by this PR — filed as follow-up issues rather than ballooning an adopted fix): bash
mariCLI dry-runs counting as applied mutations, sandbox-denied sensitive writes in error-tolerant compound bash commands counting as applied, and write/edit through a workspace symlink bypassing sensitive-file staging.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
node ./scripts/run-regressions.mjs --filter prompt(5/5, includes the new staged/forgery/mixed cases),pnpm --filter @marinara-engine/server lint,pnpm build.package.json), and confirm she reports the change as pending your approval rather than applied.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable — server-side guard behavior only.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.