fix: retry transient errors before falling through combo chain#337
Open
East-rayyy wants to merge 1 commit intodecolua:masterfrom
Open
fix: retry transient errors before falling through combo chain#337East-rayyy wants to merge 1 commit intodecolua:masterfrom
East-rayyy wants to merge 1 commit intodecolua:masterfrom
Conversation
When all API keys for a provider are temporarily locked (e.g., 503 "No capacity available"), the combo handler now waits for the short cooldown to expire and retries the same model before falling through to the next model in the chain. This prevents unnecessary combo fallthrough to providers that may not work, when simply waiting 1-2 seconds would have resolved the issue. Behavior: - Checks Retry-After header and retryAfter body field from failed responses - Only retries if the delay is ≤10 seconds (COMBO_RETRY_MAX_DELAY_MS) - Maximum 2 retry attempts per model (COMBO_RETRY_MAX_ATTEMPTS) - Permanent errors (401, 403, etc.) are not retried - Falls through to next model if retries are exhausted or delay is too long Fixes decolua#335
776a592 to
70e6ab9
Compare
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
extractRetryDelayMs()helper to readRetry-Afterheader andretryAfterbody fieldFixes #335
Problem
A combo like
antigravity/opus → github/opuswould immediately fall through to GitHub when both Antigravity keys got transient 503s with 1-2 second cooldowns. Simply waiting 1-2 seconds would have let the request succeed on Antigravity, but instead it hit GitHub (which may have no active credentials), killing the client.How it works
Inside
handleComboChat, after a model fails with a fallbackable error:Retry-Afterheader orretryAfterin the JSON bodyCOMBO_RETRY_MAX_DELAY_MS(10s) and attempts <COMBO_RETRY_MAX_ATTEMPTS(2): wait, then retry the same modelshouldFallbackcheck runs firstChange
1 file changed —
open-sse/services/combo.jsThe
forloop over models now wraps each attempt in awhileloop that handles retries. All existing behavior is preserved when noRetry-Afteris present.Test plan