fix(provider): remap Codex auto model#4240
Conversation
📝 WalkthroughWalkthroughRemaps Codex Responses ChangesCodex OAuth auto-model remap
README and docs link corrections
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/inference/provider/compatible_tests.rs (1)
1073-1081: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive the expected model from
OPENAI_CODEX_MODEL_HINTS.This regression is meant to verify “
autobecomes the first concrete Codex model,” but the matcher hardcodes the current first entry. IfOPENAI_CODEX_MODEL_HINTSchanges order later, the implementation will stay correct and this test will fail for the wrong reason. Build the expected"model"field from the same constant the helper uses.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/inference/provider/compatible_tests.rs` around lines 1073 - 1081, The test expectation is hardcoded to a specific model value, which makes it brittle if OPENAI_CODEX_MODEL_HINTS changes order. Update the compatible test around the body_json assertion to derive the expected "model" from the same OPENAI_CODEX_MODEL_HINTS constant used by the helper, so the regression continues to verify that auto resolves to the first concrete Codex model without depending on a fixed entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openhuman/inference/provider/compatible_tests.rs`:
- Around line 1073-1081: The test expectation is hardcoded to a specific model
value, which makes it brittle if OPENAI_CODEX_MODEL_HINTS changes order. Update
the compatible test around the body_json assertion to derive the expected
"model" from the same OPENAI_CODEX_MODEL_HINTS constant used by the helper, so
the regression continues to verify that auto resolves to the first concrete
Codex model without depending on a fixed entry.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d1762a3e-cb4d-4c01-91bb-33400e15d6f3
📒 Files selected for processing (8)
docs/README.de.mddocs/README.ja-JP.mddocs/README.ko.mddocs/README.ur-pk.mddocs/README.zh-CN.mddocs/agent-workflows/cursor-cloud-agents.mdsrc/openhuman/inference/provider/compatible_helpers.rssrc/openhuman/inference/provider/compatible_tests.rs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openhuman/inference/provider/compatible_helpers.rs`:
- Around line 176-177: The Responses error/reporting paths in
compatible_helpers.rs are still using the original model value instead of the
remapped request_model, which makes telemetry and structured error fields
inconsistent after auto is rewritten. Update the helper branches that build
error/status/reporting payloads to thread request_model through every path,
including the final structured ("model", ...) field, so Codex OAuth and related
failures are attributed to the concrete wire model actually sent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7660400-009c-4d15-9811-aad507dfad8d
📒 Files selected for processing (1)
src/openhuman/inference/provider/compatible_helpers.rs
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openhuman/inference/provider/compatible_helpers.rs`:
- Around line 176-177: The Responses error/reporting paths in
compatible_helpers.rs are still using the original model value instead of the
remapped request_model, which makes telemetry and structured error fields
inconsistent after auto is rewritten. Update the helper branches that build
error/status/reporting payloads to thread request_model through every path,
including the final structured ("model", ...) field, so Codex OAuth and related
failures are attributed to the concrete wire model actually sent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7660400-009c-4d15-9811-aad507dfad8d
📒 Files selected for processing (1)
src/openhuman/inference/provider/compatible_helpers.rs
🛑 Comments failed to post (1)
src/openhuman/inference/provider/compatible_helpers.rs (1)
176-177: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Use the remapped model in every Responses error/reporting path.
After Lines 60-73 rewrite
autotorequest_model, this block still reportsmodel, so Codex OAuth failures are attributed to"auto"even though the wire request was sent with a concrete model. That leaves the new telemetry contract inconsistent with the actual request body. Threadrequest_modelthrough all of these helpers and the final structured("model", …)field.Suggested fix
if super::super::is_budget_exhausted_http_400(status, &error) { super::super::log_budget_exhausted_http_400( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_custom_openai_upstream_bad_request_http_400( self.name.as_str(), status, @@ super::super::log_custom_openai_upstream_bad_request_http_400( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_provider_access_policy_denied_http_403(status, &error) { super::super::log_provider_access_policy_denied_http_403( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_provider_config_rejection_http( status, self.name.as_str(), @@ super::super::log_provider_config_rejection( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_byo_provider_auth_failure_http( self.name.as_str(), status, @@ super::super::log_byo_provider_auth_failure( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_openai_oauth_session_expired_http( self.name.as_str(), status, @@ super::super::log_openai_oauth_session_expired( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::is_provider_insufficient_credits_402(status, &error) { @@ super::super::log_provider_insufficient_credits_402( "responses_api", self.name.as_str(), - Some(model), + Some(request_model), status, ); } else if super::super::should_report_provider_http_failure(status) { @@ &[ ("provider", self.name.as_str()), - ("model", model), + ("model", request_model), ("status", status_str.as_str()), ("failure", "non_2xx"), ], ); }Also applies to: 187-195, 205-206, 216-217, 227-228, 241-242, 251-251
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/inference/provider/compatible_helpers.rs` around lines 176 - 177, The Responses error/reporting paths in compatible_helpers.rs are still using the original model value instead of the remapped request_model, which makes telemetry and structured error fields inconsistent after auto is rewritten. Update the helper branches that build error/status/reporting payloads to thread request_model through every path, including the final structured ("model", ...) field, so Codex OAuth and related failures are attributed to the concrete wire model actually sent.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openhuman/inference/provider/compatible_tests.rs (1)
1069-1108: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winSplit these Codex remap tests into a dedicated test module.
compatible_tests.rsis already >1,100 lines, so adding more cases here deepens an existing module-size violation and makes this provider test matrix harder to navigate. Please move the new Codex Responses remap coverage into a focused sibling test file/submodule instead of extending this file further. As per coding guidelines,Rust modules must be ≤ ~500 lines in size.Also applies to: 1110-1158
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/inference/provider/compatible_tests.rs` around lines 1069 - 1108, The new Codex remap coverage should not stay in compatible_tests.rs because that module is already too large; move the added tests, including codex_responses_remaps_auto_model_before_posting and the related Codex remap cases, into a dedicated sibling test module/file for the OpenAiCompatibleProvider provider tests. Keep the existing assertions and setup intact, but relocate the test helpers and imports so the provider test matrix stays organized and the module size remains within the guideline.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/openhuman/inference/provider/compatible_tests.rs`:
- Around line 1069-1108: The new Codex remap coverage should not stay in
compatible_tests.rs because that module is already too large; move the added
tests, including codex_responses_remaps_auto_model_before_posting and the
related Codex remap cases, into a dedicated sibling test module/file for the
OpenAiCompatibleProvider provider tests. Keep the existing assertions and setup
intact, but relocate the test helpers and imports so the provider test matrix
stays organized and the module size remains within the guideline.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ed105a34-1031-4afb-a55b-57ad9f0d23eb
📒 Files selected for processing (2)
src/openhuman/inference/provider/compatible_helpers.rssrc/openhuman/inference/provider/compatible_tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openhuman/inference/provider/compatible_helpers.rs
Summary
model=autoto the first known concrete Codex model before posting.stream: trueandmax_output_tokensomission behaviour intact.Problem
autoleaked intochatgpt.com/backend-api/codex/responses.autosentinel with HTTP 400.Solution
model=autoinchat_via_responses.autoto the firstOPENAI_CODEX_MODEL_HINTSentry before serializingResponsesRequest.auto.upstream/mainlacks them and Markdown Link Check fails without them.Submission Checklist
diff-cover) meet the gate enforced by.github/workflows/pr-ci.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge. Covered by targeted Rust regression and CI diff coverage.## Related— no matrix feature IDs changed.Closes #NNNin the## RelatedsectionImpact
automodel alias.Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/GH-4206-codex-auto-modelb49d868d356f559a7edafec51e2dfb294a6cac45Validation Run
pnpm --filter openhuman-app format:check— no frontend changes.pnpm typecheck— no TypeScript changes.GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib codex_responses_remaps_auto_model_before_posting(RED before fix, GREEN after fix)GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib codex_responsesGGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib responses_api_primary_posts_directly_to_responsescargo fmt --manifest-path Cargo.toml --checkgit diff --checkGGML_NATIVE=OFF cargo check --manifest-path Cargo.tomlValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
autosentinel.The 'auto' model is not supported when using Codex with a ChatGPT account.Parity Contract
stream: trueandmax_output_tokensomission tests still pass.Duplicate / Superseded PR Handling
Summary by CodeRabbit
auto.