Skip to content

fix(opencode): default header timeout to five minutes - #46903

Merged
rekram1-node merged 1 commit into
devfrom
header-timeout
Sep 2, 2026
Merged

rekram1-node merged 1 commit into
devfrom
header-timeout

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Sets the default timeout for waiting for provider response headers to five minutes (300,000 ms), so requests don't wait indefinitely before a response starts. The timer stops once headers arrive and does not limit the streamed response body. OpenAI's existing five-minute header timeout is unchanged.

To disable it for a provider, set headerTimeout to false in your project's opencode.json or global ~/.config/opencode/opencode.json:

{
  "provider": {
    "anthropic": {
      "options": {
        "headerTimeout": false
      }
    }
  }
}

Replace anthropic with your provider. To change the timeout instead, use a positive number of milliseconds, such as "headerTimeout": 600000 for ten minutes. Omit the setting to use the five-minute default.

@rekram1-node
rekram1-node merged commit b046973 into dev Sep 2, 2026
9 of 10 checks passed
@rekram1-node
rekram1-node deleted the header-timeout branch September 2, 2026 21:00
alltomatos pushed a commit to alltomatos/opencode that referenced this pull request Sep 15, 2026
headerTimeout and chunkTimeout were only enforced when a provider
config explicitly set them; with no config at all, a stalled
connection (no response headers, or an SSE stream that stops emitting
chunks without closing) could hang a request indefinitely.

Ported from upstream/dev (fix(opencode): default header timeout to
five minutes anomalyco#46903, fix(opencode): default chunk
timeout to five minutes anomalyco#44890): default both to
300000ms when unset, and update the config schema descriptions to
document the default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw
logic10492 added a commit to coding-chimera/chimera that referenced this pull request Sep 17, 2026
Port upstream opencode b04697366f (anomalyco/opencode#46903), extending
the user-approved #14 timeout-default decision to the header phase (same
rationale as the chunkTimeout default: half-dead relay streams must stop
hanging indefinitely; the header phase has an even smaller risk surface
since the timer stops once headers arrive).

- resolveSDK: headerTimeout ?? 300_000, mirroring the chunkTimeout
  default; false still disables (headerTimeoutMs === false -> no
  controller), configured values unchanged.
- Config schema: headerTimeout already accepted Union(PositiveInt,
  Literal(false)); descriptions synced to the upstream terminal wording
  '(default: 300000)'.
- OPENAI_HEADER_TIMEOUT_DEFAULT is KEPT (not merged into the global
  default): upstream retains the loader-level injection at this sha, and
  it is not redundant in observable semantics - it keeps the default
  visible in openai.options.headerTimeout (pinned by two fork tests) and
  config-overridable at the provider level. A comment now documents the
  relationship with the resolveSDK global default (identical value,
  single file, no drift surface).
- getResponsesTransport keeps raw pass-through semantics (headerTimeout
  is not part of ResponsesTransport options at all; same treatment as
  chunkTimeout in the previous batch).
- Tests mirror upstream: default-applied-at-fetch loop covers both
  timeouts with the other explicitly disabled; 'opt-in for non-OpenAI'
  test becomes 'can be disabled with false'; the OpenAI disable test
  adopts the upstream 4eb29a64f0 terminal state (header AND chunk
  asserted false).

Upstream-Sha: b04697366f05419e9bd7a92f841813dd976161c9
rossigee pushed a commit to rossigee/opencode that referenced this pull request Sep 18, 2026
rldona pushed a commit to rldona/FlupCode that referenced this pull request Sep 24, 2026
Jovan1666 pushed a commit to Jovan1666/opencode that referenced this pull request Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant