Skip to content

Preserve Codex statusless transport errors - #100

Open
mulfyx wants to merge 1 commit into
raine:mainfrom
mulfyx:fix/codex-http-response-body-message
Open

Preserve Codex statusless transport errors#100
mulfyx wants to merge 1 commit into
raine:mainfrom
mulfyx:fix/codex-http-response-body-message

Conversation

@mulfyx

@mulfyx mulfyx commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve the descriptive source message for statusless Codex transport errors
  • keep structured detail values for statusful upstream responses
  • cover an HTTP response-body failure after semantic output has already been streamed

Problem

Codex HTTP body failures use status 0, a descriptive message, and an internal detail discriminator such as http_response_body. The shared error mapper preferred detail whenever it was present, so Claude Code received:

API Error: http_response_body

instead of the actionable transport message. This is especially confusing after partial output, where replay is intentionally disabled to avoid duplicating text or tool side effects.

Fix

For statusless errors, always surface CodexError.message. Preserve the existing detail-first behavior for statusful upstream errors.

The regression test serves a deliberately truncated HTTP response after a valid text delta and verifies that:

  • partial semantic output is preserved
  • the stream terminates with event: error
  • the descriptive response-body transport error is returned
  • the internal http_response_body discriminator is not exposed as the user-facing message

This follows the same post-commit boundary used by CLIProxyAPI: retry is allowed only before the first deliverable payload; after partial output, the stream is terminated with an error rather than replayed (bootstrap handler, post-payload regression test). Codex itself also treats a stream ending before response.completed as an incomplete attempt (Codex regression test).

Verification

  • cargo fmt --check
  • cargo test --offline --all-targets
  • cargo clippy --offline --all-targets -- -D warnings

All checks pass on the current main base (v0.1.32).

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.

1 participant