Repository navigation
fix(runtime): skip the SDK retry when a backup model is set - #2190
Merged
Merged
Conversation
|
@tc3oliver is attempting to deploy a commit to the Inbox Zero Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryRequests with configured backup models now pass
Reviews (1) · Last reviewed commit: "fix(runtime): skip the SDK retry when a ..." · Reviewed by Greptile |
Contributor
Playwright screenshotsFeature frames for this PR:
Open screenshot gallery · Dashboard · CI run Updated for commit |
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.
Why
With a backup model set, a failing primary was still retried once by the provider SDK (
MODEL_STREAM_MAX_RETRIES, default 1) before the runtime switched. For a primary that hangs, that means waiting out the request timeout twice, about four minutes at the default, before the backup gets the turn.What changed
When the request has backup models, model calls pass
maxRetries: 0, so the runtime's existing switch handles the failure. Without backups nothing changes. The trade-off: a single transient error such as a 429 now moves to the backup at once instead of retrying the primary. The last model in the chain still retries fast transient errors itself, but a hang there now fails after one timeout instead of two.How tested
A new fallback test checks that a call with a backup sends
maxRetries: 0and one without keeps the default. It fails without the change. The runtime fallback, transport, limits and tool-dispatch tests pass, typecheck passes and Biome is clean on the changed files; the unit suite passes except the backup script tests, which fail the same way on main on macOS.