fix: log upstream error body in COMBO per-target failure warnings (#10597) - #10917
Merged
Merged
Conversation
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…bo-log-error-body fix: log upstream error body in COMBO per-target failure warnings (diegosouzapw#10597)
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.
Closes #10597
Root cause
The per-target combo failure log line (
log.warn("COMBO", "Model X failed, trying next", { status })) discarded the upstream error body even though it was already captured inerrorTexta few lines earlier (open-sse/services/combo.ts). This is the reporter's Problem #1 ("upstream 400 body is not logged") — operators could not distinguish a context-overflow 400 from a tool_use/tool_result pairing 400 from an auth 400 without reproducing the failing request.Fix
Added a redacted
errorBodyfield (via the already-importedredactConnectionLabel, reusing the existing 500-char truncation onerrorText) to:open-sse/services/combo.ts,handleComboChatInner)handleRoundRobinCombo)Purely additive to log metadata — no control-flow change.
Scope note: the last-resort compat-fallback debug log (
open-sse/services/combo/comboCompatFallback.ts) does not currently capture an error body at all (it only hasresult.status), so enriching it would require reading the response body there for the first time — out of scope for this surgical fix; left as a follow-up if operators need it too.Regression test (TDD)
tests/unit/combo-10597-error-body-logging.test.ts— fails on unfixed code (log meta was{"status":400}only) and passes after the fix (the upstream error text now appears in the COMBO warn log).RED before → GREEN after.
Gates run
node --import tsx/esm --test tests/unit/combo-10597-error-body-logging.test.ts— GREENnode --import tsx/esm --test tests/unit/combo-failure-log-message.test.ts— GREEN (pre-existing sibling test on the same log line, unaffected)node --import tsx/esm --test tests/unit/combo-quota-share-cooldown-wait.test.ts(isolated) — 7/7 GREEN (two of these flaked under full-suite CPU contention on this shared devbox during the batchcombo-*.test.tsrun — confirmed unrelated to this diff by re-running in isolation)node scripts/check/check-complexity.mjs— OK (2573 violations, baseline 2774)node scripts/check/check-cognitive-complexity.mjs— OK (1157 violations, baseline 1223)node scripts/check/check-file-size.mjs— no new violationsnode scripts/check/check-changelog-integrity.mjs— OKnpx eslint --suppressions-location config/quality/eslint-suppressions.json open-sse/services/combo.ts tests/unit/combo-10597-error-body-logging.test.ts— cleannpm run typecheck:core— exit 0, cleanNotes for the reporter
The revised hypothesis (compression pipeline breaking tool_use/tool_result pairing → Anthropic 400) remains unconfirmed and out of scope here —
MALFORMED_REQUEST_PATTERNSinopen-sse/services/accountFallback.tshas no entry for "tool_use ids were found without tool_result" yet. Once this ships, please share the newly-loggederrorBodyfrom the next production failure so we can confirm/refute that theory before scoping further work.