mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-19 13:33:35 +08:00
The configured request timeout (API_TIMEOUT_MS) only feeds the SDK client timeout, which on a streaming request is cleared the moment response headers arrive. Slow local/3P models return 200 headers fast but spend minutes prefilling before the first SSE token, so that window was governed by the idle watchdog (CLAUDE_STREAM_IDLE_TIMEOUT_MS, 240s) -- a separate env users cannot configure. The configured timeout therefore never applied to slow prefill, so raising it had no effect (#826, follow-up to #449). Split the stream watchdog into phases: use a first-token budget (tied to the user's request timeout via CLAUDE_STREAM_FIRST_TOKEN_TIMEOUT_MS) until the first chunk arrives, then switch to the shorter mid-stream idle budget. The overall max-duration cap (#766) still backstops trickling bodies; CLI defaults fall back to prior behavior.