Repository navigation
refactor(agents): exec records its output file in the shared details.spill shape - #206984
Conversation
|
🦞👀 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. |
|
Rejected review findings:
|
|
Codex review: blocked before merge. What this changesThis PR moves exec output-file metadata into details.spill and updates persistence, history elision, and Tokenjuice to use that shape. Example: An exec output file at /tmp/openclaw-exec-1.log reaches its size limit.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR makes a focused consolidation, and inspection found no definite introduced code defect. Reviewed head: Before merge
FindingsNone. Agent review detailsHow this fits togetherExec produces command results and spill-file pointers; result bounding, transcript persistence, history projection, and Tokenjuice consume that metadata. flowchart LR
A[Exec process] --> B[Foreground result]
B --> C[Tokenjuice middleware]
C --> D[Record-time result bound]
D --> E[Transcript persistence]
E --> F[History projection]
F --> G[Model context]
Technical reviewBest possible solution: Keep one nested spill representation across exec production, bounding, persistence, elision, and Tokenjuice, preserving the explicitly accepted historical-session tradeoff. Do we have a high-confidence way to reproduce the issue? This is a representation refactor; source inspection confirms the two existing shapes and the consumers being consolidated. Is this the best way to solve the issue? The patch uses the existing shared representation, updates active consumers together, and preserves the separately exposed BashResult and BashToolDetails contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 82ddbf657c58. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -18, Tests -6. Total -24 across 9 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 27, 2026, 5:51 PM ET / 22:51 UTC. |
…spill shape
Exec's flat fullOutputPath/spillTruncated become details.spill { path, truncated? },
the shape web_fetch and the record-time bound already use. Readers of the flat
fields (spill lookup, persistence allowlists, tokenjuice) are removed.
Co-authored-by: Ayaan Zaidi <[email protected]>
742a229 to
e5978fc
Compare
…spill shape (openclaw#206984) ## What Problem This Solves A tool result can point to a file holding its full output. Two shapes record that pointer: - web_fetch and the record-time bound (openclaw#206880) use `details.spill { path, chars?, truncated? }`; - exec uses flat `details.fullOutputPath` plus `details.spillTruncated`. So every reader handles both shapes: - `getToolResultSpillDetails` (history elision and the bound's producer-spill reuse) falls back to the flat fields. It also reads a `spilledChars` field that nothing writes. - The persisted-details allowlists keep both shapes (6 extra keys). - The tokenjuice plugin checks exec's flat field to leave spilled results alone. ## Fix Exec records `details.spill { path, truncated? }`, the one shape. Exec has bytes, not chars, so it does not set `chars`. The flat fields and every reader of them are removed: - the flat fallback, and the never-written `spilledChars`, in `getToolResultSpillDetails`; - `fullOutputPath`, `spilledChars` and `spillTruncated` in both persistence allowlists; - tokenjuice now checks `details.spill`. Accepted edge case: no migration. Exec results recorded before this change keep their text footer (`Full output: <path>`), but history elision no longer finds their pointer in `details`. The owner approved this. Spill files live in the OS temp directory anyway, so old pointers rarely outlive the session. Not touched: `fullOutputPath` on the session `BashResult`/`BashToolDetails` types and the agent-core bash-execution message. Those are a different, extension-facing contract, and exec never writes them. ## User impact None visible. The exec result text is unchanged. Model-visible behavior is the same: elision and the bound reuse exec's file as before, through the shared shape. ## Evidence - `session-tool-result-guard.test.ts`: an exec output file cut at its limit records `spill: { path, truncated: true }`. - `tool-result-truncation.test.ts`: history elision with an exec-shaped spill keeps its pointer. - `runtime.integration.test.ts` (tokenjuice): a spilled exec result is left to the host. - `tool-result-bounds.test.ts` (owner, unchanged) and `session-tool-result-guard.tool-result-persist-hook.test.ts` (fallback keeps `spill`) still pass. - `bash-tools.exec-approval-output.test.ts`: a real exec spill path, read through workspace-only `read` (openclaw#206972), comes from `details.spill.path`. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A tool result can point to a file holding its full output. Two shapes record that pointer:
details.spill { path, chars?, truncated? };details.fullOutputPathplusdetails.spillTruncated.So every reader handles both shapes:
getToolResultSpillDetails(history elision and the bound's producer-spill reuse) falls back to the flat fields. It also reads aspilledCharsfield that nothing writes.Fix
Exec records
details.spill { path, truncated? }, the one shape. Exec has bytes, not chars, so it does not setchars. The flat fields and every reader of them are removed:spilledChars, ingetToolResultSpillDetails;fullOutputPath,spilledCharsandspillTruncatedin both persistence allowlists;details.spill.Accepted edge case: no migration. Exec results recorded before this change keep their text footer (
Full output: <path>), but history elision no longer finds their pointer indetails. The owner approved this. Spill files live in the OS temp directory anyway, so old pointers rarely outlive the session.Not touched:
fullOutputPathon the sessionBashResult/BashToolDetailstypes and the agent-core bash-execution message. Those are a different, extension-facing contract, and exec never writes them.User impact
None visible. The exec result text is unchanged. Model-visible behavior is the same: elision and the bound reuse exec's file as before, through the shared shape.
Evidence
session-tool-result-guard.test.ts: an exec output file cut at its limit recordsspill: { path, truncated: true }.tool-result-truncation.test.ts: history elision with an exec-shaped spill keeps its pointer.runtime.integration.test.ts(tokenjuice): a spilled exec result is left to the host.tool-result-bounds.test.ts(owner, unchanged) andsession-tool-result-guard.tool-result-persist-hook.test.ts(fallback keepsspill) still pass.bash-tools.exec-approval-output.test.ts: a real exec spill path, read through workspace-onlyread(fix(agents): read cannot open the full output of a large tool result under workspace-only read #206972), comes fromdetails.spill.path.