anthropics / anthropics/claude-agent-sdk-typescript
Intermittent Error: Stream closed after the first tool call on Windows; disappears when debug: true
- Lingua principale
- Shell
- Stelle
- 1.8k
- Fork
- 226
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Summary — On Windows, tool calls intermittently fail with Tool permission request failed: Error: Stream closed. The first tool call in a session usually succeeds, then every subsequent call fails identically across unrelated tools (mcp__read__*, Write, Grep). Not URL/path-specific, not network. Biggest signal: enabling debug: true makes it disappear (14/14 tool calls succeed); without it, the stream dies after the first call — pointing to a timing/buffering race in the stdio control-stream transport to the spawned claude subprocess.
Environment — SDK 0.3.196 · Windows 11 · Electron 33.2 main process · subprocess-spawn (bundled claude binary) · subscription OAuth (CLAUDE_CODE_OAUTH_TOKEN).
Repro — (1) start a turn needing several tool calls (e.g. multiple fetch_url, or fetch + Write); (2) first completes outcome=ok, rest fail "Stream closed", whole session's stream stays dead even across fresh query() retries; (3) set debug: true → all succeed.
Ruled out — not network (in-process fetch_url catches its own errors → would return text, never "Stream closed"); not our permission logic (a debug run did 14 fetches + 4 subagents + writes all outcome=ok); not concurrency alone (repros at 2 subagents and on direct calls).
Impact/workaround — multi-tool turns unusable on Windows without debug; debug: true keeps the stream alive (not production-viable).
(Full version in the file has the query() options snippet + [Stall]-log notes.)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start by reproducing the issue on Windows with SDK 0.3.196 in Electron 33.2, comparing query() with debug: true and false. Inspect the query() options and the stdio control-stream transport, using the [Stall]-log notes mentioned in the issue. Done means multiple sequential tool calls remain usable without enabling debug.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- electron, typescript
- Ambito
- backend, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100