fix(failover): treat HTTP 5xx as rate-limit for model fallback#21049
Closed
maximalmargin wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(failover): treat HTTP 5xx as rate-limit for model fallback#21049maximalmargin wants to merge 1 commit intoopenclaw:mainfrom
maximalmargin wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Treat 502/503/504 as failover-eligible (rate_limit reason) so configured model fallbacks trigger when the primary provider is overloaded or temporarily unavailable. Fixes openclaw#20999
Member
|
Nice catch on the failover gap. I’m closing this as a duplicate of #21017 for #20999. We’re keeping #21017 because it includes explicit regression tests and aligns 502/503/504 handling with the existing timeout/transient classification path. Your PR helped validate the root cause and urgency. If you want this reopened for an alternative reason-mapping approach, say the word and we can re-check quickly. |
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
Treat HTTP 502/503/504 as failover-eligible (rate_limit reason) so configured model fallbacks trigger when the primary provider is overloaded or temporarily unavailable.
Changes
resolveFailoverReasonFromError()rate_limitfailures to enable existing fallback/cooldown behaviorFixes
Closes #20999
Greptile Summary
Adds handling for HTTP 502 (Bad Gateway), 503 (Service Unavailable), and 504 (Gateway Timeout) status codes in
resolveFailoverReasonFromError(), treating them asrate_limitfailures to enable model fallback when the primary provider is overloaded or temporarily unavailable.rate_limitreason, which triggers the existing failover/cooldown behavior inrunWithModelFallback()isTransientHttpError()logic inpi-embedded-helpers/errors.tswhich treats 500, 502, 503 and Cloudflare 5xx codes as transient failures (mapped to timeout)Confidence Score: 5/5
Last reviewed commit: b09e1b0