Repository navigation
fix(agents): disclose 64 KiB code-mode stderr-tail truncation - #130182
Conversation
|
@clawsweeper re-review Split from #128997 per the second-round ruling (issuecomment-5404301364): this PR marks the previously unmarked 64 KiB code-mode stderr-tail truncation (src/agents/sessions/tools/limits.ts helper) with a retention-loss disclosure in the exit error message, without changing the tail retention policy. Regression tests were red before the fix and green after (limits.test.ts 17/17, tool-search.stream-errors.test.ts 4/4, tool-search.test.ts 136/136). |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:59 PM ET / 22:59 UTC. ClawSweeper reviewWhat this changesThe PR reports the exact number of stderr bytes discarded from Code Mode’s 64 KiB retained tail when a child process exits unsuccessfully. Merge readinessNo blocking defect was found in the current PR head: it records loss at the bounded-tail owner, waits for stderr drain before rendering non-clean failures, and retains the clean-exit IPC grace. Keep this PR open for normal merge validation; the local partial clone could not load the current-main tree for a three-way comparison because its promisor remote could not resolve GitHub. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTool Search gives OpenClaw agents a compact tool catalog and runs flowchart LR
A[Agent tool request] --> B[Tool Search]
B --> C[Isolated Node child]
C --> D[Stderr stream]
D --> E[Bounded tail accounting]
C --> F[Exit or IPC result]
E --> G[Failure rendering]
F --> G
G --> H[Agent-visible result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +82, Tests +301. Total +383 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep loss accounting at the bounded-tail helper and render one disclosure at the Code Mode failure owner, then verify the exact head against an inspectable current-main merge result before landing. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main reproduction was run: the source path and focused regression tests establish the failing event order, but the local partial clone could not load the current-main tree. Is this the best way to solve the issue? Yes for the Code Mode path: the patch records loss at its producer and renders it once after stderr drains while leaving find and grep unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 34ccf63e1379. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Round-5 [P2] addressed at head 292c38e (commit
PR description updated with a matching "Round-5 follow-up" Evidence subsection documenting all of this. Verification run at exactly this head just now:
On the real-behavior proof ask: the standing real-child evidence (Evidence section) already proves byte-exact 64 KiB accounting against a live spawned child, including event-order disclosure. Extending it to observe CI on this fresh head was still reporting at post time. |
|
@clawsweeper re-review Round-7 real owner-boundary evidence (runCodeModeChild invocation with a real spawned Node child, 70,414 B stderr → 65,536 B retained tail + 4,878 B exact disclosed, non-zero exit) was added to the PR body at 22:08:19Z — one second after the last auto-review snapshot was taken. Re-requesting review so the fresh snapshot includes it. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Record retention loss at the shared bounded-tail owner and render failed child diagnostics after Node closes its stdio. Preserve the clean-exit IPC grace and disclose the separately bounded display preview. End outstanding bridge work at the common settlement boundary, including fatal exits. Co-authored-by: Finn763 <[email protected]>
292c38e to
b96f14a
Compare
|
Maintainer refresh at b96f14a: simplified the existing repair against current main, preserving @Finn763's co-author credit. One bounded-tail API replaces the wrapper pair; Node @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…aw#130182) * fix: preserve child stderr diagnostics and cancel settled bridge work Record retention loss at the shared bounded-tail owner and render failed child diagnostics after Node closes its stdio. Preserve the clean-exit IPC grace and disclose the separately bounded display preview. End outstanding bridge work at the common settlement boundary, including fatal exits. Co-authored-by: Finn763 <[email protected]> * test: align child lifecycle regressions with lint rules --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Partially addresses #128967 for Tool Search's
tool_search_codechild. Find/grep retention disclosure remains separate work under that issue; this PR must not close it.A failed child could lose diagnostics arriving after
exit, silently discard earlier stderr at the retention cap, and then silently shorten the retained text again for display. A real child probe also found that failure could return while an already-started bridged tool remained alive.What Changed
The shared bounded-tail helper returns retained text and discarded UTF-8 bytes. All internal callers use that one API; the tracked-helper wrapper and Tool Search test facade are removed. Find/grep keep their existing display behavior.
Node's
closeevent owns failed-exit rendering after stdio drains. The existing 250 ms clean-exit IPC grace remains unchanged; IPC results, spawn/stream errors, abort, and timeout retain prompt settlement. The error distinguishes retention-cap loss from bytes omitted from the trimmed 500-character preview.The common settlement boundary now aborts outstanding bridge work for every terminal outcome, including fatal exits and successful final results with unfinished calls. It preserves the parent's cancellation reason and timeout error. No per-call controller registry or new timeout is introduced.
Production +48/-44 (net +4); tests/support +272/-140; documentation +5. No config option, dependency, storage schema, or native Codex/QuickJS behavior changes. This is the separate permission-restricted Node Tool Search bridge.
Thanks @Finn763 for the original repair and lifecycle cases. The maintainer rewrite preserves contributor credit and simplifies the owner boundary against current main.
Evidence
{proof:7}; fatal child failure now cancels an already-started host tool exactly once before fixture cleanup. Before the repair, the outer failure returned with that tool unfinished and its signal un-aborted. The timeout positive control also passes.exitversusclosecontract. On this Mac, Node's fatal reporter can itself stop writing after 65,536 bytes; that sender-side loss is not counted as parent retention loss. The isolated Linux owner-path proof received 70,355 bytes and exactly reported 4,819 discarded at retention plus 65,035 omitted from the trimmed preview. A read-only child-process observer independently counted received chunks; source hashes matched this candidate. Larger probes also matched the bytes actually received, without claiming sender-discarded bytes. Linux proof run; the Testbox command and timing result passed and the owned lease was stopped.Node child-process close contract.
Hosted CI initially timed out fetching the comparison base in
check-guards(exit124 after120 seconds), after the duplication and coercion checks passed. The unchanged exact head passed on the retry; no guard or timeout was weakened. The PR evidence-check heading was also corrected.