[PR #5893] [MERGED] fix(mari): watermark-scoped completion-claim auditing #6983

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

📋 Pull Request Information

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

Base: staging ← Head: fix/5819-5830-claim-watermark


📝 Commits (1)

📊 Changes

4 files changed (+386 additions, -33 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+180 -23)
📝 scripts/regressions/mari-write-readback.regression.ts (+4 -2)
📝 scripts/regressions/prompt.regression.ts (+199 -8)

📄 Description

Linked issues

Closes #5819. Closes #5830 (parts 1–2; the English-only detector question stays open there as a design discussion, per maintainer scoping).

Why this change

Two halves of the same complaint from opposite directions. #5819: Mari's self-check only audited the run's final frame, so in a batch — "I created the first character, now doing the second" — a claim about a skipped step was never checked; users watched her move on from characters she never created. #5830: the check that did exist could not be satisfied by a truthful recap — a run that only reported on earlier work resolved "none" forever (reads couldn't clear it), so "did you finish?" → "Yes, I created all five" was challenged twice and then replaced with an error.

This is the second attempt at #5819. The first died in adversarial review for three reasons, and the design is built around them: run-aggregate verification let one early success vouch for every later claim; the coaching ordered mutations without read-first wording (duplicate-create risk); and continuation runs recapping real prior work were told to redo it.

The design

  • Watermark-scoped auditing. Every completion claim is judged against the results since the last audited claim. A passing claim consumes its evidence (the watermark advances), so the same success can never vouch twice; a skipped step's empty scope is caught immediately — the reported symptom is now a lane fixture.
  • Debt cannot be sliced away. Advancing requires a verified scope, which requires unverified debt paid — so the terminal audit always sees unpaid debt. Mismatch tracking stays global (#5754: an out-of-scope store-mismatch shadows every later claim until its same-key verified retry), with fixtures proving both directions.
  • Recaps converge. A claim about work outside the scope is backable by a successful state read — the exact action the coaching demands — so honest recaps pass in one repair round. A terminal summary directly after a passed audit needs nothing new. Every "none" coaching path ends with "never redo work a read shows already exists."
  • Escapes never paper over failures (review-hardened): a scope containing a failed, preview, or dry-run mutating attempt — invisible to the resolver, but active evidence of non-completion — denies both escapes outright, and a verified scope with an outstanding unapplied attempt is downgraded until a later state read clears it. The review demonstrated an unrelated ls could otherwise launder a failed create.
  • Detector adjustments (#5830): "verified" removed from the claim-verb list (it describes a read — the coaching's own word), plural copulas added (were/have been) so "the changes were saved" stays caught after the removal.

Honest residuals (documented at the audit itself)

This is a tripwire, not proof: a state read cannot be semantically matched to the claim it backs, so a read of one thing can pass an unrelated recap-shaped claim; and the claim detector only sees subject-ful English (a bare participle "Created X." was never detected, before or after this change) — both feed #5830's open detector-design question.

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

  • The prompt lane's guard block now covers: the batch-skip at claim granularity, evidence consumption, read-backed recaps (and their consumption), both terminal-summary polarities, global-mismatch-across-watermark with same-key clearing, tolerated-unverified never advancing, failed/preview attempts denying both escapes, docs-reads never qualifying, the verified-scope downgrade with read-clearing, and the plural-copula detector cases. Loop wiring is pinned — reverting the loop to auditFrom: 0 fails the lane, which the review demonstrated would otherwise reintroduce #5819 silently.
  • All Mari lanes pass (prompt 5/5, mari-write-readback, mari-guard-sibling-paths, mari-ask-latch, mari-understood-request, mari-polish); server lint clean; zero-error build.
  • An adversarial multi-agent review ran (8 confirmed findings, 3 refuted); all actionable findings are folded in, and the review's frame-by-frame simulations confirmed the three v1 kill-reasons are closed (no coaching path can order a redo; continuation recaps converge; per-claim scoping holds).
  • Live-model behavior not exercised — the guard's inputs are deterministic frames, fully covered by fixtures, but the end-to-end feel (how often real models hit the mid-run budget) is worth watching in the field.

Docs and release impact

  • No docs changes needed (two CHANGELOG entries included)
  • 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)

UI evidence (if applicable)

Not applicable — server-side guard behavior; the user-visible change is Mari answering "did you finish?" truthfully and being challenged mid-batch when she skips a step.

Summary by CodeRabbit

  • Bug Fixes

    • Professor Mari now validates each completion claim in a multi-step workspace job against changes made since the previous claim.
    • Completion recaps can now pass when supported by fresh state verification, including honest verification-only statements.
    • Improved handling of failed, preview, and documentation-only actions during workspace verification.
  • Tests

    • Expanded regression coverage for step-scoped auditing, state readbacks, completion recaps, and mixed-result workflows.

🔄 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/5893 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/6/2026 **Status:** ✅ Merged **Merged:** 9/6/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/5819-5830-claim-watermark` --- ### 📝 Commits (1) - [`6192051`](https://github.com/Pasta-Devs/Marinara-Engine/commit/61920517e056ea1b18b050bf8a2d2e1c6fb9787d) fix(mari): watermark-scoped completion-claim auditing (#5819, #5830) ### 📊 Changes **4 files changed** (+386 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+180 -23) 📝 `scripts/regressions/mari-write-readback.regression.ts` (+4 -2) 📝 `scripts/regressions/prompt.regression.ts` (+199 -8) </details> ### 📄 Description ## Linked issues Closes #5819. Closes #5830 (parts 1–2; the English-only detector question stays open there as a design discussion, per maintainer scoping). ## Why this change Two halves of the same complaint from opposite directions. **#5819**: Mari's self-check only audited the run's *final* frame, so in a batch — "I created the first character, now doing the second" — a claim about a skipped step was never checked; users watched her move on from characters she never created. **#5830**: the check that did exist could not be *satisfied* by a truthful recap — a run that only reported on earlier work resolved "none" forever (reads couldn't clear it), so "did you finish?" → "Yes, I created all five" was challenged twice and then replaced with an error. This is the **second attempt** at #5819. The first died in adversarial review for three reasons, and the design is built around them: run-aggregate verification let one early success vouch for every later claim; the coaching ordered mutations without read-first wording (duplicate-create risk); and continuation runs recapping real prior work were told to redo it. ## The design - **Watermark-scoped auditing.** Every completion claim is judged against the results *since the last audited claim*. A passing claim **consumes its evidence** (the watermark advances), so the same success can never vouch twice; a skipped step's empty scope is caught immediately — the reported symptom is now a lane fixture. - **Debt cannot be sliced away.** Advancing requires a *verified* scope, which requires unverified debt paid — so the terminal audit always sees unpaid debt. Mismatch tracking stays **global** (#5754: an out-of-scope store-mismatch shadows every later claim until its same-key verified retry), with fixtures proving both directions. - **Recaps converge.** A claim about work outside the scope is backable by a successful **state read** — the exact action the coaching demands — so honest recaps pass in one repair round. A terminal summary directly after a passed audit needs nothing new. Every "none" coaching path ends with *"never redo work a read shows already exists."* - **Escapes never paper over failures** (review-hardened): a scope containing a *failed*, *preview*, or *dry-run* mutating attempt — invisible to the resolver, but active evidence of non-completion — denies both escapes outright, and a verified scope with an outstanding unapplied attempt is downgraded until a later state read clears it. The review demonstrated an unrelated `ls` could otherwise launder a failed create. - **Detector adjustments** (#5830): `"verified"` removed from the claim-verb list (it describes a read — the coaching's own word), plural copulas added (`were`/`have been`) so "the changes were saved" stays caught after the removal. ## Honest residuals (documented at the audit itself) This is a tripwire, not proof: a state read cannot be semantically matched to the claim it backs, so a read of one thing can pass an unrelated recap-shaped claim; and the claim detector only sees subject-ful English (a bare participle "Created X." was never detected, before or after this change) — both feed #5830's open detector-design question. ## 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 - The `prompt` lane's guard block now covers: the batch-skip at claim granularity, evidence consumption, read-backed recaps (and their consumption), both terminal-summary polarities, global-mismatch-across-watermark with same-key clearing, tolerated-unverified never advancing, failed/preview attempts denying both escapes, docs-reads never qualifying, the verified-scope downgrade with read-clearing, and the plural-copula detector cases. **Loop wiring is pinned** — reverting the loop to `auditFrom: 0` fails the lane, which the review demonstrated would otherwise reintroduce #5819 silently. - All Mari lanes pass (`prompt` 5/5, `mari-write-readback`, `mari-guard-sibling-paths`, `mari-ask-latch`, `mari-understood-request`, `mari-polish`); server lint clean; zero-error build. - An adversarial multi-agent review ran (8 confirmed findings, 3 refuted); all actionable findings are folded in, and the review's frame-by-frame simulations confirmed the three v1 kill-reasons are closed (no coaching path can order a redo; continuation recaps converge; per-claim scoping holds). - **Live-model behavior not exercised** — the guard's inputs are deterministic frames, fully covered by fixtures, but the end-to-end feel (how often real models hit the mid-run budget) is worth watching in the field. ## Docs and release impact - [x] No docs changes needed (two CHANGELOG entries included) - [ ] 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) ## UI evidence (if applicable) Not applicable — server-side guard behavior; the user-visible change is Mari answering "did you finish?" truthfully and being challenged mid-batch when she skips a step. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Professor Mari now validates each completion claim in a multi-step workspace job against changes made since the previous claim. - Completion recaps can now pass when supported by fresh state verification, including honest verification-only statements. - Improved handling of failed, preview, and documentation-only actions during workspace verification. - **Tests** - Expanded regression coverage for step-scoped auditing, state readbacks, completion recaps, and mixed-result workflows. <!-- 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:28 +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#6983
No description provided.