fix(opencode): apply default header timeout to all providers - #40069
fix(opencode): apply default header timeout to all providers#40069tancheng33 wants to merge 1 commit into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found two potentially related PRs:
The current PR (#40069) appears to be the primary/newer iteration addressing the header timeout issue across all providers, whereas #36650 may have focused on a different timeout aspect (request timeout vs. header timeout). PR #40010 addresses a related stability concern with stalled streams. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #39859
Type of change
What does this PR do?
Only the
openaiprovider gets a defaultheaderTimeout(300s). Every other provider — including the zen/opencodeprovider from the issue — waits for response headers forever. When a connection is established but silently blackholed, the CLI hangs indefinitely with no error: exactly the symptom in #39859 (log stops afterllm runtime selected, nothing ever happens). #36029 root-caused one common trigger on Windows: the CLI connects over an IPv6 path that stays Established but never delivers data, while browsers/Electron retry over IPv4 and work — which is why the Web UI works on the same machine.This applies the same 300s header-timeout default to all providers at the fetch layer (
packages/opencode/src/provider/provider.ts), so a blackholed connection now fails with the existing actionableProviderHeaderTimeoutErrorinstead of hanging forever. Behavior details:headerTimeout: <ms>still overrides, andheaderTimeout: falsestill disables entirely (??preservesfalse);One existing test was renamed (
headerTimeout is opt-in for non-OpenAI providers→default headerTimeout does not abort briefly delayed headers) since it now documents the new default; its assertions are unchanged and still pass. If keeping header timeout opt-in for non-OpenAI providers was a deliberate decision, happy to hear the reasoning — but a silent infinite hang seems strictly worse than a 5-minute failure with a clear error, and anyone with a legitimately slower provider can raise or disable it in config.How did you verify your code works?
bun test test/provider/header-timeout.test.ts— 6/6 pass (including headers-never-arrive abort and delayed-SSE-body no-abort).bun test test/provider/provider.test.ts— 99/99 pass.bun typecheckinpackages/opencodepasses; full-repo typecheck passes via the pre-push hook.Screenshots / recordings
Not a UI change.
Checklist