Skip to content

fix(runtime): skip the SDK retry when a backup model is set - #2190

Merged
elie222 merged 1 commit into
elie222:mainfrom
tc3oliver:fix/backup-skips-sdk-retry
Oct 25, 2026
Merged

elie222 merged 1 commit into
elie222:mainfrom
tc3oliver:fix/backup-skips-sdk-retry

Conversation

@tc3oliver

Copy link
Copy Markdown
Contributor

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: 0 and 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.

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

@tc3oliver is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Requests with configured backup models now pass maxRetries: 0, letting the runtime switch models without first waiting for an SDK retry.

  • Model calls use the backup chain without waiting for an SDK retry.

Reviews (1) · Last reviewed commit: "fix(runtime): skip the SDK retry when a ..." · Reviewed by Greptile

@elie222
elie222 merged commit d3e7f1a into elie222:main Oct 25, 2026
26 of 27 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Playwright screenshots

Feature frames for this PR:

Open screenshot gallery · Dashboard · CI run

Updated for commit 52c156f.

@tc3oliver
tc3oliver deleted the fix/backup-skips-sdk-retry branch November 13, 2026 05:07
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.

2 participants