Repository navigation
fix(code-mode): stop bookkeeping changes hiding repeated tool loops - #159864
Conversation
Co-authored-by: VACInc <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Co-authored-by: VACInc <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 5:38 PM ET / 21:38 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch gives Code Mode stable identities for repeated execution and wait outcomes, updates loop-detection documentation and regression tests, and narrows Codex test setup to the durable-receipt case. Merge readiness✅ Ready for maintainer review Keep open: current main still permits the reported Code Mode loop evasion, and this active PR remains a coherent fix candidate with no confirmed introduced defect. Priority: P2 Review scores
Verification
How this fits togetherCode Mode runs agent-supplied JavaScript through OpenClaw tools and returns results to the agent. The loop detector compares successive calls and results to decide whether to warn or block repeated work. flowchart LR
A[Agent exec or wait call] --> B[Code Mode runtime]
B --> C[Displayed result]
B --> D[Private outcome identity]
A --> E[Loop detector]
D --> E
E --> F[Continue, warn, or block]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +64, Tests +174, Docs +10. Total +248 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one Code Mode comparison path that ignores changing bookkeeping while preserving displayed receipts and distinguishing real changes in output, errors, values, and pending work. Do we have a high-confidence way to reproduce the issue? Yes. Current-main hashing includes changing exec titles and displayed receipt data, and the new owner-boundary tests provide a focused exec/wait reproduction path; this read-only review did not run them. Is this the best way to solve the issue? Yes. The patch records comparison identity at the Code Mode result producer and lets the existing loop detector consume it without changing the agent-visible receipt. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against da2bcd699bc1. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Integrates upstream 687ab1d to repair the observed changed-extension CI failure. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review Please review current head a0ec5f3. The Code Mode diff is unchanged; this head incorporates the canonical upstream Codex cleanup fixture repair (687ab1d) for the observed CI failure. Review only; no repair or merge requested. |
|
🦞👀 Re-review progress:
|
Resolves check-dependencies failure from the prior-CI verifier CLI missing its real entrypoint declaration. Co-authored-by: VACInc <[email protected]>
Scope real run-attempt setup and its database worker teardown to the durable-receipt test. Keep all retry delivery, pin-release, and zero-timer assertions unchanged. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review Current head: 3848924. The Code Mode patch is unchanged. The only new delta scopes real-database test setup to the durable-receipt case, leaving the pure fake-clock cases and all assertions intact. The original 24-file / 279-test group passes on Node 24.19.0 with two workers. Please review only; no repair or merge requested. |
|
🦞👀 Re-review progress:
|
…penclaw#159864) * fix(code-mode): stop bookkeeping changes hiding repeated tool loops Co-authored-by: VACInc <[email protected]> * style: satisfy Code Mode regression fixture brace rule Co-authored-by: VACInc <[email protected]> * test(codex): isolate retry-clock fixtures from real storage setup Scope real run-attempt setup and its database worker teardown to the durable-receipt test. Keep all retry delivery, pin-release, and zero-timer assertions unchanged. Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
What Problem This Solves
Fixes: Code Mode can keep rediscovering the same tools or resuming unchanged work because changing execution titles, telemetry counters, and bridge IDs disguise repeated activity as progress.
User Impact
With loop detection enabled, repeated equivalent Code Mode activity reaches the existing warning/block/recovery path. Real output, returned data, errors, and changes to pending operations remain distinguishable. Receipts still show their original counters and IDs.
Scope: this does not classify arbitrary equivalent JavaScript rewrites, add a scheduler, alter notification settings, or make command processes survive a Gateway restart. No configuration migration, permission relaxation, or production deployment.
Why This Change Was Made
The detector compared Code Mode bookkeeping as though it were task output. Code Mode now supplies a private, immutable comparison snapshot; suspended work records the actual operation and arguments instead of a fresh bridge ID. Execution titles remain display metadata rather than action identity. Guest-owned fields with the same names retain their meaning. Automatically retained results are compared using the original guest value, not their fresh reference IDs.
Requested by @VACInc.
Work sessions
Evidence
pnpm test src/agents/code-mode.loop-detection.test.ts --maxWorkers=1passed 6/6, 42.11 s wall, 511 ms test bodies on the final six-case fixture (29.26 s worker preparation). Original four-case cold run took 34.49 s wall, primarily worker preparation. Different cache states are not a claimed speedup.687ab1d) and the Knip CLI entrypoint (0d02ab7). A later Codex fixture failed its global zero-timer assertion; real-storage setup is now scoped to the durable-receipt test instead of the three pure fake-clock cases. All delivery, release, and zero-timer assertions and timeouts remain unchanged. The original 24-file / 279-test group passes with Node 24.19.0 and two workers, matching CI’s runtime and worker budget. Targeted lint passes; independent P0–P2 review of the small isolation diff found no actionable issue. The exact two CI timers were not reproduced locally; this is a fixture-isolation repair, not a claimed production timer fix.38489245064e7d2f75ee4dd8b085ef1a509b549e, including bothopenclaw/ci-gatechecks. Final rollup: 143 passed, 48 skipped, no pending or failing checks. ClawSweeper review completed for that same head at 2026-09-27 21:38:49 UTC: no actionable findings, security findings, or before-merge items.Merged by @VACInc at 2026-09-27 21:49:20 UTC after CI qualification:
aea667c.View the OpenClaw team session