Skip to content

fix(chatgpt): preserve non-success response errors - #2053

Merged
gold-silver-copper merged 1 commit into
mainfrom
fix-chatgpt-http-status-2037
Jul 9, 2026
Merged

fix(chatgpt): preserve non-success response errors#2053
gold-silver-copper merged 1 commit into
mainfrom
fix-chatgpt-http-status-2037

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • check ChatGPT Responses non-streaming HTTP status before parsing the SSE body
  • return CompletionError::from_http_response(status, body) for non-2xx responses so status/body helpers work
  • add unit coverage for 401 and 429 status/body propagation
  • add live-recorded ChatGPT cassette coverage for the 401 Responses API error path
  • document the provider checklist requirement for non-2xx completion errors

Fixes #2037

Tests

  • cargo fmt
  • RIG_PROVIDER_TEST_MODE=record CHATGPT_ACCESS_TOKEN=invalid-token-for-recording CHATGPT_ACCOUNT_ID=invalid-account cargo test -p rig --all-features --test chatgpt chatgpt::cassette::http_errors::nonstreaming_unauthorized_preserves_status_and_body -- --nocapture --test-threads=1
  • cargo test -p rig-core providers::chatgpt::tests::completion_http_non_success_preserves_status_and_body -- --nocapture
  • cargo test -p rig --all-features --test chatgpt chatgpt::cassette::http_errors -- --nocapture --test-threads=1
  • cargo clippy --all-targets --all-features
  • cargo test -- --test-threads=1

Cassette notes: the committed ChatGPT cassette was recorded live against https://chatgpt.com/backend-api/codex using an intentionally invalid access token to produce a deterministic 401. I did not live-record a 429 fixture because reliably forcing ChatGPT rate limiting would require intentionally exhausting a real account/rate limit; the 429 path is covered by the unit test instead.

@gold-silver-copper
gold-silver-copper force-pushed the fix-chatgpt-http-status-2037 branch from 4f8664e to ff18b10 Compare July 9, 2026 00:41
@gold-silver-copper
gold-silver-copper added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 9d74cc5 Jul 9, 2026
6 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(chatgpt): non-streaming Responses path ignores HTTP status — close remaining structured-error gaps

1 participant