fix(opencode): apply default header timeout to all providers - #40069
Open
tancheng33 wants to merge 1 commit into
Open
fix(opencode): apply default header timeout to all providers#40069tancheng33 wants to merge 1 commit into
tancheng33 wants to merge 1 commit into
Conversation
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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