fix: Windows hang in Claude Code MCP stdio adapter - #36
Open
rebekahrichar wants to merge 1 commit into
Open
Conversation
loop.connect_read_pipe(sys.stdin) requires an overlapped-I/O handle under ProactorEventLoop; an inherited stdin pipe on Windows isn't one, so the adapter hung on startup with OSError: [WinError 6] The handle is invalid. Reading via asyncio.to_thread(sys.stdin.readline) works identically on Windows, Linux, and macOS. Verified against tests/integration/test_claude_code_stdio.py and tests/integration/test_mcp_server.py (18/18 passing) plus the full suite (670/674 passing; remaining 4 are pre-existing POSIX-only test gaps). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
atlas_core/adapters/claude_code.py) hung forever on startup on Windows.loop.connect_read_pipe(sys.stdin)requires an overlapped-I/O handle underProactorEventLoop, and an inherited stdin pipe on Windows isn't one — it fails withOSError: [WinError 6] The handle is invalid, which the surrounding code silently swallowed into a hang.asyncio.to_thread(sys.stdin.readline), which works identically on Windows, Linux, and macOS.Reproduced independently via a manual JSON-RPC handshake over both Git Bash and PowerShell pipes, and via the repo's own
tests/integration/test_claude_code_stdio.pysubprocess test (which hung identically before the fix).Test plan
pytest tests/integration/test_claude_code_stdio.py -v— 4/4 passing (previously hung indefinitely on Windows)pytest tests/integration/test_mcp_server.py tests/integration/test_claude_code_stdio.py -v— 18/18 passingpytest tests/ -q— 670 passed, 22 skipped, 4 failed (all 4 pre-existing, unrelated POSIX-only gaps: two Hermes installer tests that shell out to a.shinstaller, two CLI tests that exec a.shfile directly without bash)./demo.shend-to-end on Windows (Docker Desktop + WSL2 + Neo4j 5.26) — full Ripple propagation loop closes correctly.mcp.jsonconfig on Windows — all 17 tools list and dispatch correctly