fix(combos): hop on definite zero-output context overflow - #4659
RHODIZSECURITY wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
2/4 boxes ticked. This PR stays in draft until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
리뷰 · 우선순위 73 / 80이 PR은 이종(heterogeneous) 콤보에서 고치는 곳은 현재 테스트는 분류·쿨다운·e2e·정책 폴백을 같이 뒤집습니다. 제로 출력 502 SSE → 백업 200, 평범한 context 400 → 더 큰 창 백업 200, 모순 봉투(코드만 CLE이고 메시지는 다른 거절)는 정지, 확정 오버플로에는 쿨다운 없음. 로컬 헤드에서 관련 스위트 300 PASS와 라인 454-491 (failover.ts, isDefiniteContextOverflow) - JSON 파싱이 실패하면 소문자 부분 문자열로 hop을 허가합니다. 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
Co-authored-by: RHODIZ IT <info.rhodiz@gmail.com>
2e03373 to
47146fa
Compare
Keep every assertion registered under the existing suite isolation and cleanup hooks. Static source inspection only; tests not executed on this connected host. Co-authored-by: RHODIZ IT <info.rhodiz@gmail.com>
1 similar comment
…n#4659) [skip ci] A heterogeneous combo mixes context windows, so a refusal that says "this turn does not fit THIS model" is not evidence the turn is impossible. The chain stopped at the first undersized target anyway, and a native transport made it worse by reporting a zero-output overflow as a generic upstream_server_error carrying precise context-window prose, which never looked like a context verdict at all. Classify that case from the innermost provider message. classifyError remaps any occurrence of "context window", "context length", "maximum context" or "too many tokens" found anywhere in the blob; inheriting that looseness would let a context_length_exceeded token sitting in a code field beside "Unsupported parameter: user" authorize a replay. The new classifier unwraps only the exact proxy wrapper, within four envelopes and 16,384 characters, and reads the leaf. Three bounds keep the widening honest: - A JSON-shaped body that does not parse fails closed. normalizeUpstreamErrorText caps classificationText at 500 characters, so a long envelope reaches the classifier as a prefix, and reading that prefix as prose would let whichever field landed in the first 500 bytes authorize a hop. - Only statuses that speak about the request are admitted: 400, 413, 422 and 5xx. A 401/403 body that merely quotes context prose keeps its provider-wide cooldown instead of being rescored as request-shaped. - Structured origin_rejected now stops explicitly. The existing test only matched that token in the message, so an origin reporting it out of band could have been overridden by context prose. Cooldown treats a definite overflow as request-shaped, so an oversized turn no longer cools a healthy target. This cannot duplicate visible output. A streaming child reaches combo classification only through preflightComboStreamResponse, which commits the child on any text, tool call or unknown event and synthesizes a failure envelope only for a zero-output terminal, so a turn whose text the client already saw is never reclassified as a hop. tests/helpers/combo-context-overflow-cases.ts pins that directly. Closes lidge-jun#4659 Co-authored-by: RHODIZ IT <info.rhodiz@gmail.com>
Root cause
A heterogeneous combo can receive a zero-output context overflow from a smaller-context target as a generic 5xx/502-style upstream failure whose structured outer code is
upstream_server_error, while the provider message clearly says the request exceeds that model's context window.Today the combo classifier can normalize that prose to
context_length_exceededand then stop the chain, so a later target with a larger context window is never tried. A contradictory envelope must still remain terminal: an outercontext_length_exceededtoken beside an unrelated message such asUnsupported parameter: useris not sufficient evidence to replay.Fix
isDefiniteContextOverflow()classifier that authorizes a hop only from concrete context-window prose, with strict wrapper/JSON unwrapping and a 16 KiB bound.Regression coverage
The focused current-
devsuite verifies:Verification on exact head
2e0337394:bun test tests/routing/router-combo-failover-classification.test.ts tests/server/server-combo-failover-e2e.test.ts tests/codex-integration/combos.test.ts tests/routing/routing-policy-fallback.test.ts-> 300 PASS / 0 FAIL, 1,503 assertions.bun x tsc --noEmit-> PASS.git diff --check-> PASS.This was reproduced on the RHODIZ HomeLab failover path while auditing
combo/rhodiz-coding-primary; the local 2.55 hotfix already uses the same bounded semantic rule. No provider credentials or private request contents are included here.Review readiness checklist
devat836511b9cwhen opened.