Repository navigation
fix: preserve Code Mode recovery after wrapped tool output - #176407
Conversation
Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 8aabfbcb-0f39-413c-9e6f-bfc714cc090b
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves producer-owned Code Mode checkpoint facts through output rewriting and transcript serialization. Example: A replay-safe network_read call returns 30,000 characters, its output is wrapped and capped, and the Gateway restarts.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current recovery defect, preserves existing recovery policy, and has no actionable correctness finding; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCode Mode produces execution results, the transcript guard carries private provenance into canonical storage, and restart recovery consumes the stored checkpoint to select continuation tools. flowchart LR
A[Code Mode executor] --> B[Private result provenance]
B --> C[Output hooks and caps]
C --> D[Canonical transcript storage]
D --> E[Restart recovery policy]
E --> F[Fresh restricted tool construction]
Technical reviewBest possible solution: Persist executor-owned checkpoint facts through the existing provenance and canonical append owners, retaining text parsing only for older stored transcripts. Do we have a high-confidence way to reproduce the issue? Current-main source shows the failure: network-protected or truncated display text reaches a JSON-only checkpoint reader; the PR also records failing base regressions and real Gateway reproduction. Is this the best way to solve the issue? The patch fixes the producer-to-storage invariant rather than relaxing recovery parsing, reuses existing owners, and preserves the shipped legacy transcript contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1066a5c4910. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +117, Tests +166, Docs +4. Total +287 across 8 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 18, 2026, 5:29 PM ET / 21:29 UTC (Revision 2). |
Co-authored-by: steipete <[email protected]>
Resolve the shared freshness-hook conflicts with the upstream pnpm run invocation and both regression suites. Preserve the reviewed Code Mode production sources. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 528ef8af-ec0e-44a3-b109-70dc6f6eef0d
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…176407) * fix: preserve Code Mode recovery after wrapped tool output Co-authored-by: steipete <[email protected]> * fix: preserve Code Mode recovery after wrapped tool output Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 8aabfbcb-0f39-413c-9e6f-bfc714cc090b * test: provide required plugin metadata in recovery fixture Co-authored-by: steipete <[email protected]> * Publish openclaw/pi-typed-recovery-facts Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 528ef8af-ec0e-44a3-b109-70dc6f6eef0d --------- Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes restart recovery losing a safe Code Mode checkpoint when tool-result hooks wrap or rewrite its displayed output.
User Impact
Safe interrupted Code Mode work can resume after a restart without trusting rewritten display text. Unsafe or unfinished effects are not made replayable by forged output. Existing text-only transcripts keep their recovery behavior; this change adds no configuration requirement.
Why This Change Was Made
Record execution status and replay safety at the producer, carry them through existing private result provenance, and stamp the canonical transcript after serialization. Current checkpoints are authoritative, including explicit non-checkpoints; legacy text parsing remains only for older transcripts.
The shared pre-commit fix has since landed upstream. Conflict resolution keeps upstream's exact
pnpm runinvocation and both its compound-script test and this branch's real-hook success/failure and spaced-filename tests. The CI repair supplies the fixture's requiredoptional: truemetadata; it does not change production behavior.Evidence
Worked on by
Work sessions