Repository navigation
fix(ai): one retry layer for a gateway call - #5973
Merged
Merged
Conversation
The gateway owns the retries and the fallbacks of a call. A pydantic-ai call to a gateway chat group goes through GatewayCallModel, which sends it at most ai.max_retries + 1 times, and only when it did not reach the gateway or when its stream failed before its first event. The SDK and the HTTP transport of the gateway chat client retry nothing. The direct client resends only a failed connect to the gateway. ai.request_timeout_seconds sets one deadline per call, and the router timeout (900 s) now ends before it.
dan-petty
force-pushed
the
fix/5965-one-retry-layer
branch
from
November 16, 2026 13:33
bf0d338 to
e6593c1
Compare
dan-petty
marked this pull request as ready for review
November 16, 2026 13:41
dan-petty-release Bot
added a commit
that referenced
this pull request
Nov 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.164.0](v0.163.0...v0.164.0) (2026-11-16) ### Features * **roadmap:** Verify a claimed missing check in a helper ([#5868](#5868)) ([e6cf731](e6cf731)) ### Bug Fixes * **ai:** one retry layer for a gateway call ([#5973](#5973)) ([87ebf9f](87ebf9f)), closes [#5965](#5965) * **roadmap:** Refuse a class claim the staged source lacks ([#5834](#5834)) ([b12cca7](b12cca7)) --- 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.
The LLM gateway owns the retries and the fallbacks of a model call. LiteLLM 1.103.11 raises a 408 error inside a stream (an OpenRouter timeout) with no retry and no fallback, and the client sent a pydantic-ai call up to 9 times for other failures.
GatewayCallModel, a pydantic-aiFallbackModelof the same model: at mostai.max_retries+ 1 sends, only after a failed connect or a stream that failed before its first event. The SDK and the transport make no retries.LLMClientwith providergatewaysends a call again only after a failed connect.ai.request_timeout_seconds(1200 s): one deadline over all sends of a call. The router timeout goes from 1500 s to 900 s, below each call deadline. The settings refuse an implement call deadline above the step limit.StreamRetryModelis deleted.Closes #5965
Change:
openspec/changes/archive/2026-11-16-5965-one-retry-layer/