Skip to content

fix(nodejs): handle stdio stdin errors#1584

Open
sjh9714 wants to merge 1 commit into
github:mainfrom
sjh9714:fix-stdio-error-teardown
Open

fix(nodejs): handle stdio stdin errors#1584
sjh9714 wants to merge 1 commit into
github:mainfrom
sjh9714:fix-stdio-error-teardown

Conversation

@sjh9714
Copy link
Copy Markdown

@sjh9714 sjh9714 commented Jun 5, 2026

Summary

Fixes #1427.

Unexpected stdin pipe errors from a spawned stdio runtime no longer get re-thrown from the EventEmitter error listener. The Node SDK now routes that condition through connection disposal, preserving the forceStop() guard and letting the existing JSON-RPC close/error handlers tear the client down.

Changes

  • Replace the stdio child stdin error rethrow with scoped connection disposal.
  • Add a regression test that emits a broken-pipe error on child stdin and verifies the SDK does not throw and disposes the connection.

Testing

  • npm ci from nodejs/
  • npm ci from test/harness/
  • npm test -- test/client.test.ts -t "disposes the stdio connection when child stdin emits an error" from nodejs/ (failed before the fix, passed after)
  • npm test -- test/client.test.ts from nodejs/
  • npm test -- --exclude 'test/e2e/**' from nodejs/
  • npm run lint from nodejs/
  • npm run typecheck from nodejs/
  • npm run format:check from nodejs/
  • npm run build from nodejs/
  • git diff --check
  • git diff --check origin/main...HEAD

Full e2e tests were not run locally.

Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.

@sjh9714 sjh9714 requested a review from a team as a code owner June 5, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CopilotClient stdin error handler re-throws inside an EventEmitter callback, causing uncaughtException

1 participant