Files
codex-proxy-rs/backend
ce12ba3f43 fix(openai): classify status-less stream invalid_request_error as a request error (#722)
* fix(openai): classify status-less stream invalid_request_error as a request error

Codex can reject a request with an in-stream `error` frame that carries
`error.type=invalid_request_error` but no HTTP status. That frame fell
through to the "unavailable" branch, so a non-streaming caller received
502 upstream_unavailable for its own invalid request.

Constraint: Capacity, flex and turn rate limit rejections keep their existing categories
Rejected: Treat every status-less stream failure as a request error | would hide real upstream outages
Confidence: high
Scope-risk: narrow
Tested: Rust 1.99.1 fmt --check; provider-openai transport::diagnostics + provider::contract (348 passed); clippy -p provider-openai --all-targets -D warnings; the new case fails without the classification change
Not-tested: End-to-end request against a live upstream on this base

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(openai): cover status-less stream errors through the provider

Keep the stream failure constructor private to the crate. Exercise the original SSE error through the provider so the test covers classification, retry behavior, and the frame delivered to clients.

Co-authored-by: Codex <noreply@openai.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
2026-11-16 12:37:26 +08:00
..