anthropics / anthropics/claude-agent-sdk-typescript

Intermittent Error: Stream closed after the first tool call on Windows; disappears when debug: true

未关闭
#359 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Shell
星标
1.8k
派生
226
PR 合并指标
30 天内没有已合并 PR

描述

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.)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。