fix(codex transport): default reasoning_enabled=False for non-reasoning models - #30530
Open
vishnumohta wants to merge 1 commit into
Open
fix(codex transport): default reasoning_enabled=False for non-reasoning models#30530vishnumohta wants to merge 1 commit into
vishnumohta wants to merge 1 commit into
Conversation
…ng models
The Codex Responses transport defaulted reasoning_enabled=True, which adds
include[reasoning.encrypted_content] to every request through that path.
Non-reasoning models reject that field with HTTP 400:
Error code: 400 - {'error': {'message': 'Encrypted content is not
supported with this model.', 'type': 'invalid_request_error',
'param': 'include', 'code': None}}
This bites the fallback chain on personal-laptop deployments: when the
primary local model (MLX, Ollama) goes down and Hermes falls back to a
non-reasoning OpenAI model (gpt-4o-mini, gpt-4.1-mini), the whole tool
list is rejected before the request even reaches the model.
Flipping the default to False fixes this transparently:
- Non-reasoning models: include[encrypted_content] no longer sent ✓
- Reasoning models (o1, o3, grok-thinking, codex backend, xAI): still
opt in via reasoning_config={"enabled": True} or {"effort": "..."}
- All existing opt-in code paths (lines 87-90) preserved unchanged
Repro:
hermes chat -q 'hello' --model gpt-4o-mini
# Before: HTTP 400 'Encrypted content is not supported with this model'
# After: responds normally
Collaborator
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the generic Responses payload path. The current main transport still defaults reasoning on and emits include=["reasoning.encrypted_content"] for generic non-xAI/non-GitHub calls (agent/transports/codex.py:156-165,290-301), so the underlying compatibility issue remains.
Problems
- The proposed
reasoning_enabled = Falsedoes not preserve either stated opt-in form. The following logic only changesreasoning_effort; it never restoresreasoning_enabled=True(agent/transports/codex.py:160-164). Thus both{"enabled": true}and{"effort": "medium"}skip the reasoning payload branch. Current coverage requires the effort-only form to emit a reasoning effort (tests/agent/transports/test_codex_transport.py:70-86). - The same translation exists independently for configured auxiliary calls (
agent/auxiliary_client.py:918-948), which this one-file change leaves exposed.
Suggested changes
- Replace the global default flip with a shared capability gate used by both construction paths; preserve the intentional xAI encrypted-reasoning replay branch (
agent/transports/codex.py:273-289). - Add direct payload tests for unsupported and supported targets plus the auxiliary adapter.
Automated hermes-sweeper review.
| # include[reasoning.encrypted_content] field with HTTP 400 "Encrypted | ||
| # content is not supported with this model." Reasoning-capable models | ||
| # (o1, o3, grok-thinking, etc.) still opt in via | ||
| # reasoning_config={"enabled": True} or {"effort": "medium"}. |
Contributor
There was a problem hiding this comment.
This flips the default but the branch below never sets reasoning_enabled=True for either reasoning_config={"enabled": True} or an effort-only config; it only updates reasoning_effort. Both advertised opt-in forms will therefore omit reasoning entirely, contrary to the existing contract in tests/agent/transports/test_codex_transport.py:70-86.
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
The Codex Responses transport (
agent/transports/codex.py) defaultsreasoning_enabled = True, which causes Hermes to addinclude[\"reasoning.encrypted_content\"]to every request through that path. Non-reasoning models reject this field with HTTP 400:```
Error code: 400 - {'error': {'message': 'Encrypted content is not supported with this model.', 'type': 'invalid_request_error', 'param': 'include', 'code': None}}
```
Who's affected
Anyone whose fallback chain (or primary chain) includes a non-reasoning OpenAI model. Common cases:
gpt-4o-mini(small, cheap, frequently used as a fallback)gpt-4.1-mini(same)I hit this on a personal-laptop deployment running MLX as primary with
gpt-4o-minias the fallback. When MLX OOM'd under memory pressure, Hermes correctly fell back to OpenAI but every request was rejected before reaching the model because the tool list contained the include field.The fix
One-line default flip in
build_kwargs():```diff
Resolve reasoning effort
reasoning_effort = "medium"
-reasoning_enabled = True
+reasoning_enabled = False
reasoning_config = params.get("reasoning_config")
```
Plus a comment block above explaining the rationale.
Backward compatibility
The existing opt-in path is preserved. Reasoning-capable models (o1, o3, grok-thinking, the Codex backend itself, xAI Grok) still get reasoning when callers pass:
```python
reasoning_config = {"enabled": True}
or
reasoning_config = {"effort": "medium"}
```
The if-branch at lines 86-90 that handles
reasoning_configis unchanged. Only the default for callers that pass no config flips.Repro
```bash
hermes chat -q 'hello' --model gpt-4o-mini
Before: HTTP 400 'Encrypted content is not supported with this model'
After: responds normally
```
Risk
Low. The downstream branches at lines 116+ that gate on `if reasoning_enabled` already correctly skip when the flag is False, so the only behavioral change is: callers that previously got reasoning-by-default without setting any config now get no reasoning by default. Any code path that genuinely wants reasoning was already passing `reasoning_config` (the documented opt-in surface).
Tested in production for ~10 days on a multi-model deployment (MLX primary, OpenAI fallback) — no regressions observed.
🤖 Generated with Claude Code