fix(transports/codex): gate xAI reasoning.effort per model#23106
Closed
zakame wants to merge 1 commit into
Closed
Conversation
Closed
1 task
Contributor
Author
|
Live test looks ok! 🚀 |
12 tasks
6be6600 to
88274a9
Compare
Contributor
Author
|
Looks superseded by #23435 but I've rebased with it:
|
88274a9 to
e9becd1
Compare
Contributor
Author
|
Now removed debug logging and consolidated tests |
e9becd1 to
1a13fb4
Compare
Fixes NousResearch#23088. xAI's Responses API rejects `reasoning.effort` on most Grok models with HTTP 400; only `grok-4.3` and `grok-4.20-multi-agent` accept it per the current official capability table. The codex transport was sending it (plus `reasoning.encrypted_content` include) unconditionally for every xAI model with reasoning enabled, breaking primary-model calls on `grok-4-1-fast` and similar. Gate both `kwargs["reasoning"]` and `kwargs["include"]` behind `grok_supports_reasoning_effort()` from `agent/model_metadata` — the canonical per-model allowlist using exact-or-hyphen-delimited prefix matching (with optional OpenRouter `x-ai/` strip). Unsupported models silently skip both keys with no logging. Also tighten `grok_supports_reasoning_effort` itself: - Switch from bare `startswith(prefix)` to `name == prefix or name.startswith(prefix + "-")` so that `grok-4.30-pro` cannot leak into the `grok-4.3` allowlist entry. - Remove `grok-3-mini` from `_GROK_EFFORT_CAPABLE_PREFIXES` — no longer listed in the official xAI reasoning docs; conservative omission avoids future 400s. - Fix stale docstring example (`grok-3-mini` → `grok-4.3`). Existing happy-path behavior on `grok-4.3` and `grok-4.20-multi-agent` is preserved; no other provider paths are touched. Tests: 56 tests across `TestCodexBuildKwargs` and the new `TestCodexXaiReasoningEffortGating`; 8 duplicate/overlapping tests removed so each scenario is covered exactly once. Aggregator prefix test updated to use `grok-4.3`; `grok-3-mini` test updated to assert effort is now dropped.
1a13fb4 to
f0ddde3
Compare
Contributor
Author
|
Rebased - |
Contributor
|
Closing — your underlying bug (#23088) is already fixed on Thanks for filing the bug AND submitting a fix on the same day — the issue you wrote was load-bearing for the eventual resolution. Sorry the parallel PR landed first; your patch shape was equivalent. |
Contributor
Author
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
Fixes #23088.
Test plan