fix(codex): handle stdout/stderr stream errors in sandbox exec processes#102386
fix(codex): handle stdout/stderr stream errors in sandbox exec processes#102386lsr911 wants to merge 2 commits into
Conversation
The sandbox exec process spawns child processes with stdout/stderr
data handlers but does not register error handlers on the streams.
If a stdio pipe errors (e.g. broken pipe), the managed process state
is not updated and the error is unhandled.
Add stream-level error handlers that set managed.failure and emit
process closed, matching the existing child.once('error') behavior.
Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 2:01 AM ET / 06:01 UTC. Summary PR surface: Source +7. Total +7 across 1 file. Reproducibility: yes. source-reproducible: current main lacks stdout/stderr stream error listeners in the sandbox exec process spawner, and upstream Codex consumes process/read.failure as the remote process failure channel. I did not run a live stream-error reproduction in this read-only review. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the focused handler after the contributor adds redacted real behavior proof, with focused stdout/stderr stream-error regression coverage preferred if feasible. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main lacks stdout/stderr stream error listeners in the sandbox exec process spawner, and upstream Codex consumes process/read.failure as the remote process failure channel. I did not run a live stream-error reproduction in this read-only review. Is this the best way to solve the issue? Yes, the patch is the narrow owner-boundary fix because OpenClaw owns the child process and both stdout and stderr are sandbox exec process output streams. The remaining gap is proof, not a better implementation location. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a3f00d32c914. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7. Total +7 across 1 file. View PR surface stats
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
|
…esses If both stdout and stderr emit errors, the second error would overwrite the first failure message. Add an early return guard so only the first stream error is preserved, matching the expected behavior where Codex consumes process/read.failure. Co-Authored-By: Claude <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing: re-review pending without resolution. The sandbox exec stream error approach needs integration-test proof that is blocked by test infrastructure complexity. |
What Problem This Solves
The sandbox exec process spawner (
processes.ts) registerschild.stdout.on("data")andchild.stderr.on("data")handlers but does not register error handlers on the stdio streams. If a pipe errors (e.g. broken pipe, EPIPE), the error is unhandled — only process-level errors (child.once("error")) are caught.Why This Change Was Made
Adds
child.stdout.on("error", onStreamError)andchild.stderr.on("error", onStreamError)handlers that setmanaged.failureand emit process closed, matching the existingchild.once("error")behavior.Same pattern as #101505 (mushuiyu886: codex app-server stdio stream errors) and 5+ other merged PRs.
Files Changed
extensions/codex/src/app-server/sandbox-exec-server/processes.ts🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]