Repository navigation
fix(sse): skip disabled providers in combo fallback (404 instead of 400) #4500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diegosouzapw
merged 1 commit into
release/v3.8.33
from
fix/port-pr-336-skip-disabled-combo
Jun 21, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,6 +247,19 @@ test("checkPipelineGates reapplies runtime breaker settings to existing breakers | |
| }); | ||
|
|
||
| test("handleNoCredentials reports missing provider credentials and exhausted accounts", async () => { | ||
| // Ported from upstream decolua/9router#336 (Ibrahim Ryan): when a provider has | ||
| // zero usable connections (all disabled, or none configured at all), the | ||
| // historical 400 BAD_REQUEST classified the failure as non-fallbackable, so a | ||
| // combo like `antigravity/opus → github/opus` died on the first leg with a | ||
| // hard 400 even though the next combo target was perfectly healthy. | ||
| // | ||
| // The combo target loop (open-sse/services/combo.ts) deliberately breaks on | ||
| // 400 to prevent infinite fallback loops with body-specific 4xx errors | ||
| // (#4279/PR#4316). 404 NOT_FOUND, by contrast, flows through checkFallbackError | ||
| // as `shouldFallback: true` (generic-error catch-all path, | ||
| // open-sse/services/accountFallback.ts:1593-1599) so the next combo target is | ||
| // tried. We surface "no active credentials" as 404 so combo can skip past a | ||
| // disabled-credentials provider instead of failing the whole request. | ||
|
Comment on lines
+250
to
+262
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the comment in // Ported from upstream decolua/9router#336 (Ibrahim Ryan): when a provider has
// zero usable connections (all disabled, or none configured at all), the
// historical 400 BAD_REQUEST classified the failure as non-fallbackable, so a
// combo like `antigravity/opus → github/opus` died on the first leg with a
// hard 400 even though the next combo target was perfectly healthy.
//
// The combo target loop (open-sse/services/combo.ts) deliberately breaks on
// 400 to prevent infinite fallback loops with body-specific 4xx errors
// (#4279/PR#4316). 404 NOT_FOUND, by contrast, flows through checkFallbackError
// as `shouldFallback: true` (matching the status_404 rule in
// open-sse/config/errorConfig.ts) so the next combo target is
// tried. We surface "no active credentials" as 404 so combo can skip past a
// disabled-credentials provider instead of failing the whole request. |
||
| const missing = handleNoCredentials(null, null, "openai", "gpt-4o-mini", null, null); | ||
| const exhausted = handleNoCredentials( | ||
| null, | ||
|
|
@@ -260,8 +273,8 @@ test("handleNoCredentials reports missing provider credentials and exhausted acc | |
| const missingJson = (await missing.json()) as any; | ||
| const exhaustedJson = (await exhausted.json()) as any; | ||
|
|
||
| assert.equal(missing.status, 400); | ||
| assert.match(missingJson.error.message, /No credentials for provider: openai/); | ||
| assert.equal(missing.status, 404); | ||
| assert.match(missingJson.error.message, /No active credentials for provider: openai/); | ||
| assert.equal(exhausted.status, 500); | ||
| assert.match(exhaustedJson.error.message, /Primary account failed/); | ||
| }); | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states that
404flows through the generic-error catch-all path inopen-sse/services/accountFallback.ts(lines 1593-1599). However,checkFallbackErroractually matches thestatus_404rule defined inERROR_RULES(inopen-sse/config/errorConfig.tsline 156) viafindMatchingErrorRule, which returnsshouldFallback: truewith a 2-minute cooldown (COOLDOWN_MS.notFound).While this doesn't negatively affect the behavior (since there are no active credentials to apply a cooldown to anyway), we should correct the comment to avoid misleading future maintainers about how the 404 status code is routed through the fallback engine.