Repository navigation
A stream cut mid-reply is never retried; the turn fails and the partial reply is dropped #12688
sishuaigong
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
When the Messages stream ends before message_stop, the turn fails and the partial reply, including tool calls already received, is discarded. Every user on a flaky network or behind a proxy that cuts idle streams is affected; Claude Code and Codex retry the same event at once.
Reproduction
Current behavior
The turn ends with DeepSeek Messages stream ended before message_stop (will_retry: false); the calls already received are not run. packages/llm/llm-deepseek/src/translate.ts line 165 throws LlmError(…, 'STREAM_CLOSED'), and packages/llm/llm-pi-ai/src/stream.ts line 243 throws the same code for the pi-ai path. packages/llm/llm/src/retry-policy.ts lines 18 to 24 define DEFAULT_RETRYABLE_CODES as the empty-response code, RATE_LIMIT, SERVER, TIMEOUT and TRANSPORT; STREAM_CLOSED is not in it, so packages/llm/llm-retry/src/index.ts line 212 declines the retry.
Expected behavior
A stream that ends early is a transport failure: STREAM_CLOSED is retried with the same backoff as TRANSPORT, and the calls already received are kept when the retry resends the request.
Environment
dsh 0.2.2-alpha.2 (commit ce7073d, 1 Nov 2026); Linux x86_64, Ubuntu 24.04, in a virtual machine; run as the ACP server over stdio; model deepseek-v4-flash through DEEPSEEK_BASE_URL; permission mode danger-full-access.
All reactions