Skip to content

fix(provider): enforce chunk timeout regardless of content type - #47621

Open
totalolage wants to merge 1 commit into
anomalyco:devfrom
totalolage:stream-timeout-fix
Open

fix(provider): enforce chunk timeout regardless of content type#47621
totalolage wants to merge 1 commit into
anomalyco:devfrom
totalolage:stream-timeout-fix

Conversation

@totalolage

@totalolage totalolage commented Sep 6, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #47605

Related to #26487.

Type of change

  • Bug fix

What does this PR do?

chunkTimeout currently only checks responses marked text/event-stream. If a provider omits or mislabels that header, a stalled response can leave the session waiting indefinitely.

This removes the header check so the existing timeout also covers those responses and Bedrock binary streams. It applies to all response bodies through the SDK fetch wrapper, including JSON. Timeout defaults and opt-outs are unchanged. Native and WebSocket transports are outside this change.

Uses the same approach as the closed, unmerged #39516, with more regression coverage.

How did you verify your code works?

Added localhost SDK tests for missing and incorrect headers, reasoning followed by a stall, binary streams, JSON responses, cancellation, and retry-to-completion. The new timeout regressions fail against the original implementation.

  • 139 focused tests passed.
  • bun typecheck passed in packages/opencode.
  • Full package suite: 3559 passed, 26 failed, 22 skipped, one todo. All 26 failures also reproduced against the original implementation in the same environment.

The full run used a worktree-local TMPDIR after /tmp filled, which affected unrelated tests. A clean-environment full-suite pass is still unverified. Focused tests and typecheck passed after the final test-only corrections.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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.

Missing Content-Type bypasses model response body timeout and leaves sessions busy indefinitely

1 participant