Skip to content

fix(copilot): clear O_NONBLOCK on subprocess pipes to prevent BlockingIOError#23

Merged
jrob5756 merged 1 commit intomainfrom
fix/copilot-pipe-blocking-mode
Mar 6, 2026
Merged

fix(copilot): clear O_NONBLOCK on subprocess pipes to prevent BlockingIOError#23
jrob5756 merged 1 commit intomainfrom
fix/copilot-pipe-blocking-mode

Conversation

@jrob5756
Copy link
Copy Markdown
Collaborator

@jrob5756 jrob5756 commented Mar 6, 2026

Summary

  • Adds _fix_pipe_blocking_mode() to CopilotProvider that clears O_NONBLOCK on the Copilot CLI subprocess stdin/stdout pipes after startup
  • Prevents BlockingIOError when large JSON-RPC messages (e.g., prompts with many gathered articles) exceed the OS pipe buffer
  • Safe because the SDK already runs pipe writes in a thread-pool executor where blocking is correct

Test plan

  • Verify existing tests pass (make test)
  • Test with large prompt payloads that previously triggered BlockingIOError
  • Confirm normal workflow execution is unaffected

🤖 Generated with Claude Code

…gIOError

Large JSON-RPC messages (e.g., prompts with many gathered articles)
can exceed the OS pipe buffer. When the asyncio event loop sets
O_NONBLOCK on inherited file descriptors, writes raise BlockingIOError
instead of blocking until the reader drains the pipe. This adds a
post-start fixup that clears O_NONBLOCK on stdin/stdout of the Copilot
CLI subprocess, since the SDK already runs writes in a thread-pool
executor where blocking is safe and correct.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jrob5756 jrob5756 merged commit 6c88f0e into main Mar 6, 2026
2 of 3 checks passed
@jrob5756 jrob5756 deleted the fix/copilot-pipe-blocking-mode branch March 6, 2026 02:31
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.

1 participant