[GH-ISSUE #4390] Professor Mari workspace loop accepts unverified 'done' (empty commands + stop=true) with no code enforcement #2383

Closed
opened 2026-10-21 05:47:47 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @xDanteMD on GitHub (Aug 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4390

Originally assigned to: @SpicyMarinara on GitHub.

What happens

The workspace agent JSON protocol teaches Mari that finishing with {"say":"Done — I created it and verified it saved.","commands":[],"stop":true} is correct behavior (prompt line 537), and the loop accepts this with zero verification that any work was actually done. The "verify before claiming" rule exists only as prompt text (lines 441, 519 in workspace-agent.service.ts) — never enforced in code.

The complete no-op path (all file:line in workspace-agent.service.ts):

  1. Model returns {"say":"Done, created the card!","commands":[],"stop":true}
  2. say text streams to user before the loop evaluates it → user sees the lie (:1713)
  3. protocolValid=true (JSON is valid, :1167)
  4. stop defaults to true (:1170 — empty commands + valid JSON = auto-stop)
  5. isEmptyCompletedAction → false (has visible text) → repair path A skipped (:1750)
  6. commands.length===0 && !stop → false (stop is true) → repair path B skipped (:1770)
  7. Visible text appended as final answer (:1798)
  8. commands.length===0 → break (:1808)
  9. Post-loop guard → false (has visible text, :1880)
  10. User sees Mari claiming success — nothing was created

Why it matters

Observed with DeepSeek V4 Pro, but the pattern is model-agnostic. The two repair loops (:1750 empty-response retry; :1770 prose-not-JSON retry) explicitly exclude this case. commandResultsForContinuity is stored but never checked post-loop.

The prompt literally trains this behavior — the completion example at line 537 shows empty commands + stop=true + claim-of-verification as the correct finishing pattern.

Proposed improvements

  • Remove / replace the empty-commands completion example at prompt line 537
  • Verification round: when stop=true with zero commands but the user request implied work and no mutating command succeeded, push one feedback turn requiring a confirmatory read
  • Lenient action parsing: mirror parseLenientJsonValue (fence/preamble stripping, trailing-comma repair) in parseAssistantWorkspaceAction

Prior art checked (no duplicates)

  • #2805 (native tools removed — fix stays in the textual protocol)
  • #2792 (DeepSeek native-tool-call format issues — reason native tools were removed)
  • #2815, #3674, #2651, #1235 — none cover unverified completion
  • Staging branch (743 commits ahead, 07-30 latest) — no change to this loop

Why this over BashKit (#1669)

No new execution surface (triage-flagged scope-risk). Targets #1669 core complaint. Fits the triage guidance: "better existing codebase tools" is the least-risky path.

Originally created by @xDanteMD on GitHub (Aug 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4390 Originally assigned to: @SpicyMarinara on GitHub. ## What happens The workspace agent JSON protocol teaches Mari that finishing with `{"say":"Done — I created it and verified it saved.","commands":[],"stop":true}` is correct behavior (prompt line 537), and the loop accepts this with **zero verification** that any work was actually done. The "verify before claiming" rule exists only as prompt text (lines 441, 519 in `workspace-agent.service.ts`) — never enforced in code. **The complete no-op path (all file:line in `workspace-agent.service.ts`):** 1. Model returns `{"say":"Done, created the card!","commands":[],"stop":true}` 2. `say` text streams to user **before** the loop evaluates it → user sees the lie (`:1713`) 3. `protocolValid=true` (JSON is valid, `:1167`) 4. `stop` defaults to `true` (`:1170` — empty commands + valid JSON = auto-stop) 5. `isEmptyCompletedAction` → false (has visible text) → repair path A skipped (`:1750`) 6. `commands.length===0 && !stop` → false (stop is true) → repair path B skipped (`:1770`) 7. Visible text appended as final answer (`:1798`) 8. `commands.length===0` → `break` (`:1808`) 9. Post-loop guard → false (has visible text, `:1880`) 10. **User sees Mari claiming success — nothing was created** ## Why it matters Observed with DeepSeek V4 Pro, but the pattern is model-agnostic. The two repair loops (`:1750` empty-response retry; `:1770` prose-not-JSON retry) explicitly exclude this case. `commandResultsForContinuity` is stored but never checked post-loop. The prompt literally trains this behavior — the completion example at line 537 shows empty commands + stop=true + claim-of-verification as the correct finishing pattern. ## Proposed improvements - Remove / replace the empty-commands completion example at prompt line 537 - Verification round: when `stop=true` with zero commands but the user request implied work and no mutating command succeeded, push one feedback turn requiring a confirmatory read - Lenient action parsing: mirror `parseLenientJsonValue` (fence/preamble stripping, trailing-comma repair) in `parseAssistantWorkspaceAction` ## Prior art checked (no duplicates) - #2805 (native tools removed — fix stays in the textual protocol) - #2792 (DeepSeek native-tool-call format issues — reason native tools were removed) - #2815, #3674, #2651, #1235 — none cover unverified completion - Staging branch (743 commits ahead, 07-30 latest) — no change to this loop ## Why this over BashKit (#1669) No new execution surface (triage-flagged scope-risk). Targets #1669 core complaint. Fits the triage guidance: "better existing codebase tools" is the least-risky path.
bsakaguchi 2026-10-21 05:47:47 +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#2383
No description provided.