Repository navigation
fix(agents): bound tool_search_code stderr accumulation - #101007
Conversation
|
Codex review: needs changes before merge. Reviewed July 6, 2026, 1:20 PM ET / 17:20 UTC. Summary PR surface: Source +6, Tests +15. Total +21 across 2 files. Reproducibility: yes. from source: current Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the bounded stderr storage after the child-exit diagnostic reports the newest retained stderr snippet and after the adjacent stderr stream-error change is rebased as needed. Do we have a high-confidence way to reproduce the issue? Yes from source: current Is this the best way to solve the issue? Mostly yes: reusing the existing session stderr tail helper is the narrowest maintainable fix. The remaining tweak is to take the displayed 500-character child-exit detail from the end of that retained tail, not from its beginning. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a34b8a8d6968. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests +15. Total +21 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
land-ready maintainer proof:
proof gap: the regression uses a synthetic stderr flood through the production tail helper; no live runaway code-mode child was induced. |
|
Merged via squash.
|
) * fix(agents): bound tool_search_code stderr accumulation * fix(agents): report latest bounded stderr --------- Co-authored-by: NIO <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
tool_search_codeaccumulated child stderr with unboundedstderr.push(chunk)insrc/agents/tool-search.ts. A noisy or runaway code-mode subprocess could grow gateway memory even though only the first 500 characters are surfaced in exit errors.Why This Change Was Made
Reuse the existing session-tool stderr tail helper (
appendBoundedTextTail, 64 KiB) already used by grep/find. Child stderr is now retained as a bounded UTF-8-safe tail instead of an ever-growing string array.User Impact
Normal code-mode runs are unchanged. Pathological stderr floods no longer accumulate unbounded memory in the gateway process.
Evidence
Focused test:
Result: passed — new regression verifies early overflow prefix is dropped and retained bytes stay within
SESSION_TOOL_STDERR_TAIL_BYTES.Real behavior proof
stderr.push(chunk)growth duringtool_search_codechild execution.node --import tsxnode scripts/run-vitest.mjs src/agents/tool-search.test.ts --run -t "bounds tool_search_code stderr"HEAD_OVERFLOW_ + 74KiB + TAILretains only the 64 KiB tail (65536bytes), drops the early prefix, and keeps the trailing marker.datahandler.Tests and validation
node scripts/run-vitest.mjs src/agents/tool-search.test.ts --run -t "bounds tool_search_code stderr"src/agents/tool-search.test.tsRisk checklist
tool_search_codechild exit error messages when stderr is very large.SESSION_TOOL_STDERR_TAIL_BYTES = 64 KiB); surfaced detail was already truncated to 500 chars.Current review state
AI-assisted disclosure