fix(chatgpt): preserve non-success response errors - #2053
Merged
Conversation
gold-silver-copper
force-pushed
the
fix-chatgpt-http-status-2037
branch
from
July 9, 2026 00:41
4f8664e to
ff18b10
Compare
This was referenced Jul 9, 2026
Merged
Closed
Closed
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CompletionError::from_http_response(status, body)for non-2xx responses so status/body helpers workFixes #2037
Tests
cargo fmtRIG_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=1cargo test -p rig-core providers::chatgpt::tests::completion_http_non_success_preserves_status_and_body -- --nocapturecargo test -p rig --all-features --test chatgpt chatgpt::cassette::http_errors -- --nocapture --test-threads=1cargo clippy --all-targets --all-featurescargo test -- --test-threads=1Cassette notes: the committed ChatGPT cassette was recorded live against
https://chatgpt.com/backend-api/codexusing 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.