Skip to content

fix(ai): disable hidden provider 429 retries#4991

Merged
mitsuhiko merged 3 commits into
mainfrom
fix/provider-429-retries
May 26, 2026
Merged

fix(ai): disable hidden provider 429 retries#4991
mitsuhiko merged 3 commits into
mainfrom
fix/provider-429-retries

Conversation

@mitsuhiko

Copy link
Copy Markdown
Member

This addresses #4666 and #4945.

Currently we trust retry-after when a 429 comes around and we usually handle it with retries in the SDK first. This for instance means that when you run out of opencode go quota, you get stuck there retrying forever because the timeout is measured in days.

This makes three major changes:

  1. it disables sdk internal retries by default. Given the fact that we're already doing agent level retries that is the most sensible
  2. it enforces a 60 second upper bound for retry-after which is what other systems also do
  3. it sniffs the error messaage and tries to detect out of usage 429s and does not retry them

For opencode go it now looks like this instantly instead of getting stuck:

Error: 429 Monthly usage limit reached. Resets in 16 days. To continue using this model now, enable usage from your available balance: <snip>

@mitsuhiko mitsuhiko requested a review from badlogic May 25, 2026 21:55
@mitsuhiko mitsuhiko merged commit 8fb1e87 into main May 26, 2026
1 check passed
@mitsuhiko mitsuhiko deleted the fix/provider-429-retries branch May 26, 2026 21:42
baiyuqing pushed a commit to baiyuqing/pi that referenced this pull request May 27, 2026
cad0p pushed a commit to cad0p/pi that referenced this pull request May 27, 2026
hknet pushed a commit to hknet/pi-mono that referenced this pull request May 27, 2026
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.

1 participant