fix(ai): honor chunkTimeout on HTTP SSE streams - #46802
Closed
holny wants to merge 2 commits into
Closed
Conversation
The chunkTimeout provider setting was accepted but never read on the native path: HttpOptions had no field, the HTTP transport applied no stall guard, and settings dropped it silently. A stalled provider stream was bounded only by the OS socket. Add chunkTimeout to HttpOptions, apply it as a per-chunk timeout on the response stream in the HTTP transport, and thread it through provider settings (azure wired first; the remaining providers share the same config() pattern). Preserve the field when model.request hooks rebuild HttpOptions.
Author
|
Fixes #46692 — the linked-issue check doesn't resolve the keyword from a fork PR, so referencing it here directly. |
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Author
|
Another nudge — checks still green and the chunkTimeout wiring is unchanged since I opened it. Happy to rework anything if the approach needs adjusting. |
3 tasks
Author
|
Bumping this one again — happy to rebase onto the latest v2 if that helps move it along, or adjust the approach if there's any concern with the chunkTimeout wiring. |
6 tasks
Author
|
Superseded by #48158 - this PR's head fork was accidentally deleted on 2026-09-09 (not intentional); re-filed so the review can continue. Sorry for the noise. |
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
Fixes #46692
Type of change
What does this PR do?
chunkTimeoutwas accepted in provider settings but never read on the native path —HttpOptionshad no field, the HTTP transport applied no stall guard, and the setting was silently dropped. A stalled provider stream was bounded only by the OS socket.chunkTimeout(ms) toHttpOptionsand thread it throughmergeHttpOptionstransport/http.ts), failing with a typedTransportError(chunk-timeout) when no chunk arrives within the windowchunkTimeouttoProviderPackage.Settingsand wire it through the azure provider first; remaining providers share the sameconfig()pattern and can adopt the same fieldchunkTimeoutwhenmodel.requesthooks rebuildHttpOptionsHow did you verify your code works?
test/chunk-timeout.test.ts: a stalled SSE stream (one frame then silence) aborts withcode: chunk-timeoutunder a real clock;mergeHttpOptionskeeps the rightmost configured valuebun typecheck+bun testinpackages/ai(954 passing) andpackages/core(only pre-existing environment-dependent failures in git-worktree/pty tests, confirmed on a clean baseline)Checklist