Skip to content

fix(agents): suppress unhandled stdout/stderr stream errors in waitForChildProcess#100421

Closed
cxbAsDev wants to merge 1 commit into
openclaw:mainfrom
cxbAsDev:fix/agents-child-process-stream-errors
Closed

fix(agents): suppress unhandled stdout/stderr stream errors in waitForChildProcess#100421
cxbAsDev wants to merge 1 commit into
openclaw:mainfrom
cxbAsDev:fix/agents-child-process-stream-errors

Conversation

@cxbAsDev

@cxbAsDev cxbAsDev commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

waitForChildProcess attaches data listeners to child.stdout and child.stderr, but does not attach error listeners. If either stream emits an error event, the unhandled error can crash the OpenClaw process even though the child process exit has already been observed.

Why This Change Was Made

Add no-op error handlers to both stdout and stderr streams before the data handlers. Stream read errors are treated as non-fatal because the child process error/exit/close handlers report the real outcome. The new listeners are also removed in cleanup to avoid leaks.

User Impact

More robust child process waiting: transient stream read errors no longer crash the agent runtime.

Evidence

  • Added a regression test in src/agents/utils/child-process.test.ts that creates a fake child with PassThrough stdout/stderr, emits error events on both streams, and verifies waitForChildProcess still resolves successfully.
  • Verified the test fails on main with Error: stdout read failed and passes with this fix.
  • oxlint passes on the changed files.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS r: too-many-prs Auto-close: author has more than twenty active PRs. labels Jul 5, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling r: too-many-prs Auto-close: author has more than twenty active PRs. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant