Repository navigation
fix(ai): chat calls stream their reply, and the gateway keeps the stream open past the 125 s edge timeout - #2379
Merged
Merged
Conversation
…eam open past the 125 s edge timeout A workstation reaches the gateway through the Cloudflare tunnel, and the edge cuts a request that has no data for 125 s. The client sent each OpenAI-compatible chat call without streaming, so a reply that took longer than 125 s failed with 524, the gateway counted a 499, and each retry was cut again. - The gateway config sets litellm_settings.sse_keepalive_ping_interval_seconds: 30. LiteLLM writes ": ping" SSE comments into a streamed reply that has no data, also before the first token. - Every OpenAI-compatible chat call that returns one reply sends stream: true with stream_options.include_usage, and joins the chunks with ChatCompletionStreamState of the OpenAI SDK. The blocking read is deleted. - The response size limit applies to the decoded data of the stream. A cut stream fails as the streamed path fails. - An error frame after a ping gives the error of the HTTP status that it names, and the spend ledger records it as a failed attempt (record_failed_attempt). - The read timeout limits each wait for the next data of a reply. The settings description, docs/CONFIGURATION.md, k8s/README.md and the gateway config comments say so. - The shared test fakes stream a canned chat completion to a request with stream: true, as a server does, and the canned reply of a review dry run is a stream. Closes #2365
Owner
Author
|
Checks run on the branch before the push (2026-10-27):
Evidence for the design:
After the merge, when Argo CD has rolled the gateway onto the new config:
|
…body names usage, is HTML or is cut
dan-petty
force-pushed
the
fix/2365-gateway-stream-keepalive
branch
from
October 27, 2026 19:56
0a1b042 to
4e8cdba
Compare
dan-petty
marked this pull request as ready for review
October 27, 2026 20:03
Owner
Author
|
The first run failed the changed-line coverage step (89 %). The new commit covers the lines: an empty stream, and the failed-attempt branches that |
Owner
Author
|
After the merge, Argo CD rolled the gateway onto the new config at 20:05 UTC (2026-10-27). Checks through the Cloudflare tunnel:
|
dan-petty
pushed a commit
that referenced
this pull request
Oct 27, 2026
🤖 I have created a release *beep* *boop* --- ## [0.7.4](v0.7.3...v0.7.4) (2026-10-27) ### Bug Fixes * **ai:** chat calls stream their reply, and the gateway keeps the stream open past the 125 s edge timeout ([#2379](#2379)) ([0abf552](0abf552)), closes [#2365](#2365) * **ai:** the devops ai failover help says that the gateway failover records a route, not that it reroutes requests ([#2376](#2376)) ([6560b93](6560b93)), closes [#2079](#2079) * **docs:** add home page, remove raw markdown publishing, and check links ([#2070](#2070)) ([#2372](#2372)) ([7f9321c](7f9321c)) * **llm:** pass num_ctx with direct ollama embedding requests ([#2378](#2378)) ([ff47504](ff47504)), closes [#2089](#2089) * **roadmap:** intake's reply schema limits each fixed field to its values, so the model cannot leave type empty ([#2380](#2380)) ([b9220b1](b9220b1)), closes [#2370](#2370) * **telemetry:** a gateway inference span names the deployment model that served the call as gen_ai.response.model ([#2381](#2381)) ([78dbd1d](78dbd1d)) ### Performance Improvements * **ci:** lower the coverage floor to 85% and fail a pull request below 90% on its changed lines ([#2375](#2375)) ([9f97c14](9f97c14)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.
A workstation reaches the gateway through the Cloudflare tunnel, and the edge cuts a request that has no data for 125 s. The client sent each OpenAI-compatible chat call without streaming, so a reply that took longer than 125 s failed with 524, the gateway counted a 499, and each retry was cut again.
Closes #2365