fix(failover): recognize model_cooldown as rate-limit for fallback#17231
Closed
thebtf wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(failover): recognize model_cooldown as rate-limit for fallback#17231thebtf wants to merge 1 commit intoopenclaw:mainfrom
thebtf wants to merge 1 commit intoopenclaw:mainfrom
Conversation
bfc1ccb to
f92900f
Compare
Author
|
Thanks for the review! Updated the PR description to include the contribution checklist: local validation results, scope confirmation, and AI-assistance transparency. Let me know if anything else is needed. |
e905f75 to
8b1040d
Compare
632087c to
0cac9be
Compare
7fc8f4c to
dd06017
Compare
dd06017 to
530fc5e
Compare
CLIProxyAPI Plus returns `model_cooldown: All credentials for model X are cooling down` when all API keys for a model hit 429 rate limits. This error was not matched by any `ERROR_PATTERNS` entry, so `classifyFailoverReason()` returned `null` and `coerceToFailoverError()` could not wrap it as a `FailoverError`. As a result, `runWithModelFallback()` threw immediately instead of advancing to the next candidate in the fallback chain. Add `"model_cooldown"` (error type) and `"cooling down"` (message text) to the `rateLimit` pattern list so the error is correctly classified as `rate_limit` and triggers model fallback.
530fc5e to
8ae0593
Compare
18 tasks
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.
Summary
model_cooldown: All credentials for model X are cooling downwhen all API keys for a model hit 429 rate limitsERROR_PATTERNSentry, causingclassifyFailoverReason()to returnnullrunWithModelFallback()threw immediately instead of advancing to the next candidate in the fallback chain"model_cooldown"and"cooling down"to therateLimitpattern list so the error triggers model fallbackDetails
When using OpenClaw with CLIProxyAPI Plus as a provider, if all API credentials for a given model enter cooldown (due to upstream 429 rate limits), CLIProxyAPI returns an error with type
model_cooldownand message text containing "cooling down".Without this fix,
coerceToFailoverError()cannot wrap this as aFailoverError, so the error is thrown directly to the user instead of triggering fallback to the next model in the chain.Validation
pnpm build— passespnpm check— passespnpm test— passes (no existing tests cover this specific pattern; the change adds string literals to an existing array)model_cooldownerrorsContribution checklist
Test plan
gemini-3-pro-preview→minimax-m2.5-free)model_cooldownerror from CLIProxyAPI (rate-limit all credentials for primary model)classifyFailoverReason("model_cooldown: All credentials...")returns"rate_limit"Greptile Summary
Adds
"model_cooldown"and"cooling down"to therateLimiterror patterns inERROR_PATTERNS, so that CLIProxyAPI Plus cooldown errors (returned when all API keys for a model hit upstream 429 rate limits) are correctly classified as rate-limit errors byclassifyFailoverReason(). Without this fix, these errors were unrecognized, causingcoerceToFailoverError()to returnnullandrunWithModelFallback()to throw immediately instead of advancing to the next model in the fallback chain.auth,billing,timeout, etc.).ERROR_PATTERNSalso lack individual test coverage.Confidence Score: 5/5
matchesErrorPatternsusing.includes()) is well-established and used by all other entries. The new strings are specific to CLIProxyAPI Plus error responses and won't false-positive against other error categories. The failover pipeline (classifyFailoverReason→coerceToFailoverError→runWithModelFallback) is thoroughly understood and the fix correctly slots into the existing architecture.Last reviewed commit: 0cac9be