Repository navigation
Vouch request: fix 401 Insufficient balance retry classification #3103
Closed
JagravNaik
started this conversation in
General
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi there,
I would like to be vouched so my PR can be reviewed and merged. I have identified and implemented a fix for an issue where OpenCode Go
401 Insufficient balanceerrors are not triggering OMP's retry/fallback pipeline.Problem
OpenCode Go returns
401 Insufficient balancewhen quota is exhausted. This phrasing is not matched byUSAGE_LIMIT_PATTERNinpackages/ai/src/rate-limit-utils.ts, soisUsageLimitError()returns false, the retry pipeline never engages, and fallback chains (retry.fallbackChains) are never consulted.Fix (PR #3102)
Two-line change in
packages/ai/src/rate-limit-utils.ts:insufficient.?balancetoUSAGE_LIMIT_PATTERNinsufficient balancecheck toparseRateLimitReason→QUOTA_EXHAUSTEDTesting
Unit: 18/18 pass (2 new test cases added for
isUsageLimitErrorandparseRateLimitReasonwith the actual OpenCode Go 401 response body)Live end-to-end: Built locally and ran against an exhausted OpenCode Go account with a fallback chain configured. The retry pipeline engaged and the fallback fired correctly:
Before this fix, the same exhausted account errored out immediately with no retry or fallback attempt.
Thanks!
All reactions