feat(transports/codex): pass reasoning.effort to xAI Responses API - #22807
Merged
Conversation
The is_xai_responses branch only sent include=[reasoning.encrypted_content] without forwarding the resolved reasoning_effort. Other Responses providers (OpenAI, GitHub) already get effort forwarded — this aligns the xAI path. Without this, agent.reasoning_effort is silently dropped on the xAI direct path, making Hermes unable to control reasoning depth on grok-4.x via api.x.ai. Tests added to TestCodexBuildKwargs cover effort passthrough, disabled state, and minimal-clamp parity with non-xAI.
Contributor
|
Thank you @teknium1 ! |
Contributor
🔎 Lint report:
|
1 task
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
agent.reasoning_effort(and any caller-injectedreasoning_config.effort) is now actually transmitted on the xAI Responses path. Previously theis_xai_responsesbranch inbuild_kwargs()only setinclude=["reasoning.encrypted_content"]and silently dropped the resolved effort, so users on grok-4.3 got xAI's server-side default regardless of config.xAI's official docs (model-capabilities/text/reasoning) document
reasoning={"effort": "..."}as the exact wire format for grok-4.3 — same shape the non-xAI Responses branch already uses.Changes
agent/transports/codex.py(+1): setkwargs["reasoning"] = {"effort": reasoning_effort}in the xAI branch.summary: "auto"is deliberately omitted — xAI docs don't list it as an input on/responses.tests/agent/transports/test_codex_transport.py(+31): three new tests cover effort passthrough, disabled case, andminimal→lowclamp parity.Validation
reasoning_effortreaching xAIreasoning.efforttests/agent/transports/reasoning_tokens=0reasoning_tokens=153(effort=low)Salvages #22055 by @Julientalbot. Authorship preserved via rebase-merge.