Skip to content

fix(combo): preserve terminal upstream error codes - #15154

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
shipsfromrio:fix/combo-terminal-error-code
Oct 2, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
shipsfromrio:fix/combo-terminal-error-code

Conversation

@shipsfromrio

Copy link
Copy Markdown
Contributor

Problem

When every target of a combo fails, the aggregated error drops the terminal upstream error code. A Responses client that gets invalid_encrypted_content from the last target sees a generic bad_request instead, so it can't tell that it should drop the replayed reasoning item and retry.

executeTargetAttempt.ts recorded each failure without its structured code, comboAttemptLoop.ts rebuilt the terminal error without a code, and utils/error.ts then fell back to the status-based default. The round-robin path returned a bare { error: { message } } body.

Closes #15139

Fix

  • Record structuredError.code on each combo failure entry (priority and round-robin paths).
  • resolveComboTerminalCode() keeps the terminal target's code only when it represents the aggregate verdict: same status and the same failure class for every entry. Mixed failures keep today's aggregate status and generic code.
  • Round-robin now returns through errorResponse(), so its body gets the same shape and message sanitization as the priority path.

Tests

New tests/unit/combo-error-code-terminal.test.ts: Responses SSE frames, fallback, missing codes, sanitization and mixed failures. Seven assertions fail with the source change reverted. With combo-terminal-status-policy-10501.test.ts, 13/13 pass locally.

@diegosouzapw
diegosouzapw merged commit c74037b into diegosouzapw:release/v3.8.52 Oct 2, 2026
10 of 16 checks passed
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @shipsfromrio — merged into release/v3.8.52; it ships in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(backend): keep the terminal upstream error code in combo error frames

2 participants