Skip to content

fix(resilience): surface Responses failed.error.message in 502s - #12472

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
RaviTharuma:fix/12136-responses-upstream-error
Sep 4, 2026
Merged

fix(resilience): surface Responses failed.error.message in 502s#12472
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
RaviTharuma:fix/12136-responses-upstream-error

Conversation

@RaviTharuma

Copy link
Copy Markdown
Contributor

Fixes #12136.

describeMalformedNonStream treated every Responses status=failed body as the generic "upstream reported a failed response without usable output" string, even when openai-responses.ts already stored the real upstream error at response.error.

This keeps the request-scoped upstream_response_failed code (combo skip / exhaustion unchanged) and interpolates a sanitized error.message when present. Empty/missing error still uses the generic fallback.

The 3.8.49 vs 3.8.50 producer regression remains a separate follow-up; this only stops the classifier from discarding the error the translator already holds.

Copilot AI lite review requested due to automatic review settings September 2, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, includes a targeted unit test, and preserves existing failure classification behavior while improving error visibility.

Pull request overview

Improves non-streaming /v1/responses malformed-response diagnostics by surfacing a provider-supplied response.error.message (sanitized) when status="failed", instead of always using the generic fallback string. This aligns the 502 body with the upstream error already preserved by the translator, while keeping the existing request-scoped upstream_response_failed classification.

Changes:

  • Update describeMalformedNonStream() to include response.error.message (trimmed; fallback unchanged when missing/empty).
  • Add a unit test asserting the upstream error message is surfaced for failed Responses bodies.

Commands run: Not run in this review (please run npm run test:coverage).
Changed test files: tests/unit/diagnostics.test.ts
Coverage (custom): Not verified in this review (must meet 60/60/60/60 via npm run test:coverage).

File summaries
File Description
open-sse/utils/diagnostics.ts Use response.error.message (when present) in the failed-Responses diagnostic message while preserving existing classification fields.
tests/unit/diagnostics.test.ts Add regression coverage ensuring failed Responses bodies surface the upstream error message.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread open-sse/utils/diagnostics.ts
Return trimmed upstream message from describeMalformedNonStream and
leave sanitization to buildErrorBody for a single sanitization pass.

Signed-off-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
@RaviTharuma
RaviTharuma force-pushed the fix/12136-responses-upstream-error branch from 77b1a61 to d3f3764 Compare September 3, 2026 23:26
@diegosouzapw
diegosouzapw merged commit bb8e75a into diegosouzapw:release/v3.8.51 Sep 4, 2026
15 of 16 checks passed
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(resilience): parallel gpt-5.6-sol /v1/responses: 502 'upstream reported a failed response without usable output' then combo skip

3 participants