Repository navigation
fix(sse): stop stream readiness from treating a choices-less error frame as success (#7503) - #8504
Merged
diegosouzapw merged 1 commit intoJul 25, 2026
Conversation
This was referenced Jul 25, 2026
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 2, 2026
…ame as success (cheaper-inference#7503) (cheaper-inference#8504) Co-authored-by: ikelvingo <im.kelvinwong@gmail.com>
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ame as success (cheaper-inference#7503) (cheaper-inference#8504) Co-authored-by: ikelvingo <im.kelvinwong@gmail.com>
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.
Refs #7503
Root cause
When a mid-stream provider failure (e.g. the
auggieCLI passthrough executor failing to spawn its local binary) emits an SSEdata: {"error":{...}}frame with nochoiceskey, OmniRoute's stream-readiness gate (open-sse/utils/streamReadiness.ts) classified that frame as a valid "ready" (successful) stream signal, becausehasNonPingStructuredPayload()treated ANY non-empty JSON object — including a bare{error:...}frame — as readiness confirmation. This blocked combo fallback to the next candidate and let the malformed frame reach the client as a fake HTTP 200. OpenAI-SDK-based clients (VS Code Copilot, Cline) then throw a hard client-side error because they never received a single populatedchoicesentry for the whole request — "Response contained no choices."Fix
hasNonPingStructuredPayload()now recognizes an error-only structured payload (has anerrorkey, and none of the content-bearing keys —choices,candidates,delta,tool_calls, etc.) and does NOT treat it as a readiness signal. A stream that only ever emits such frames now falls through to the existingSTREAM_EARLY_EOF/ timeout failure paths, which combo already uses to fail over to the next candidate. Frames that legitimately carry both anerrorfield and real content-bearing keys are unaffected.Regression test (Hard Rule #18)
tests/unit/repro-7503-no-choices.test.ts— RED before the fix, GREEN after.Gates run
npm run typecheck:core— cleannpx eslint --suppressions-location config/quality/eslint-suppressions.json open-sse/utils/streamReadiness.ts tests/unit/repro-7503-no-choices.test.ts— cleannode scripts/check/check-file-size.mjs— same 5 pre-existing frozen violations as the purerelease/v3.8.49tip (tokenHealthCheck.ts,sse/handlers/chat.ts,sse/services/auth.ts,accountFallback.ts,combo.ts); nothing newnode scripts/check/check-complexity.mjs— reports 2169 > baseline 2130, but probed against a throwaway detached worktree of the pureorigin/release/v3.8.49tip: identical violation set (only line numbers shift), so this is pre-existing drift, not introduced herenode scripts/check/check-cognitive-complexity.mjs— same: 956 > baseline 951 reproduces identically on the pure tip in a throwaway probe worktree; not introduced by this PRnode scripts/check/check-changelog-integrity.mjs— OKnode scripts/check/check-test-discovery.mjs— OK, new test file discoverednode --import tsx/esm --test tests/unit/stream-readiness.test.ts tests/unit/combo-stream-readiness-fallback.test.ts tests/unit/stream-readiness-policy.test.ts tests/unit/runtime-timeouts.test.ts tests/unit/executor-kiro.test.ts tests/unit/auggie-executor.test.ts— 90/90 pass, no regressions in the existing stream-readiness/combo-fallback/executor suites