Skip to content

feat(transports/codex): pass reasoning.effort to xAI Responses API - #22807

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8e5cdc1d
May 9, 2026
Merged

feat(transports/codex): pass reasoning.effort to xAI Responses API#22807
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8e5cdc1d

Conversation

@teknium1

@teknium1 teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

agent.reasoning_effort (and any caller-injected reasoning_config.effort) is now actually transmitted on the xAI Responses path. Previously the is_xai_responses branch in build_kwargs() only set include=["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): set kwargs["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, and minimal→low clamp parity.

Validation

Before After
reasoning_effort reaching xAI dropped sent as reasoning.effort
tests/agent/transports/ 166 passed 169 passed
Live grok-4.3 call (per @Julientalbot) reasoning_tokens=0 reasoning_tokens=153 (effort=low)

Salvages #22055 by @Julientalbot. Authorship preserved via rebase-merge.

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.
@teknium1
teknium1 merged commit cd712b1 into main May 9, 2026
13 of 15 checks passed
@teknium1
teknium1 deleted the hermes/hermes-8e5cdc1d branch May 9, 2026 20:23
@Julientalbot

Copy link
Copy Markdown
Contributor

Thank you @teknium1 !

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-8e5cdc1d vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7906 on HEAD, 7906 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4180 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/xai xAI (Grok) labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/xai xAI (Grok) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants