feat(reasoning): expose "max" effort level for Anthropic 4.6/4.7 adaptive thinking - #25401
feat(reasoning): expose "max" effort level for Anthropic 4.6/4.7 adaptive thinking#25401Vic563 wants to merge 1 commit into
Conversation
…tive thinking
The Anthropic adapter has supported "max" since Opus 4.7 launched (it's
also the strongest level Opus/Sonnet 4.6 accept), and ADAPTIVE_EFFORT_MAP
already routes it through to output_config.effort. But "max" was never
listed in VALID_REASONING_EFFORTS, so it failed parse_reasoning_effort()
validation everywhere upstream — config.yaml loaders, /reasoning slash
command, gateway, batch_runner — and users had to lie via "xhigh" + a 4.6
model to actually request it.
This makes "max" a first-class reasoning level alongside minimal/low/medium
/high/xhigh:
- Add "max" to VALID_REASONING_EFFORTS in hermes_constants.py and
document it as the Anthropic 4.7+ adaptive-thinking ceiling
- Update CLI help, gateway _load_reasoning_config, batch_runner help
+ valid_efforts, autocomplete subcommands, setup wizard canonical
order, and all 16 locale files (status + unknown_arg messages)
- Update bundled hermes-agent skill + corresponding website doc page
- Update website/docs/user-guide/configuration.md reference
Provider compatibility:
- Anthropic adapter (4.6+): pass-through via existing ADAPTIVE_EFFORT_MAP;
4.6/4.7 both accept "max" natively
- LM Studio: added "max" to _LM_VALID_EFFORTS; the existing allowed_options
clamp will downgrade if a model doesn't expose it
- Gemini 3 Flash/Pro: "max" maps to the same "high" thinking level as
"xhigh" (matches the existing xhigh treatment)
- Codex Responses (OpenAI/xAI): clamp "max" → "high" via _effort_clamp,
matching the existing minimal → low pattern. Same clamp applied in
auxiliary_client.py for consistency
Tests:
- test_hermes_constants.py: documented set guard now requires "max";
new test_max_is_a_valid_level covers normalization
- test_codex_transport.py: new test_max_effort_clamped verifies the
Codex backend never sees a literal "max"
- test_anthropic_adapter.py: pre-existing tests already cover max
on 4.6/4.7
360 reasoning/anthropic/codex/chat-completions tests pass. The 10
TestResolveAnthropicToken failures are pre-existing on origin/main
(env-var leakage, unrelated to this change).
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new "max" reasoning effort level to the existing set (none|minimal|low|medium|high|xhigh), wiring it through the constants registry, CLI/gateway commands, provider transports, localization strings, and documentation.
Changes:
- Add
"max"toVALID_REASONING_EFFORTSand accept it in parsing/validation paths. - Map
"max"appropriately in provider adapters (Codex/auxiliary clamp to"high"; Gemini maps to"high"; LM Studio accepts). - Update CLI/gateway help text, slash-command subcommands, and all locale strings; add tests.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| hermes_constants.py | Adds "max" to valid efforts; expanded docstring. |
| hermes_cli/main.py | Adds "max" to canonical order in prompt selection. |
| hermes_cli/commands.py | Adds "max" subcommand for /reasoning. |
| gateway/run.py | Accepts "max" and updates docstring. |
| cli.py | Updates /reasoning help/error text to include "max". |
| batch_runner.py | Adds "max" to valid efforts list and docstring. |
| agent/transports/codex.py | Clamps "max" → "high" for Codex backend. |
| agent/transports/chat_completions.py | Maps "max" for Gemini Flash/Pro. |
| agent/lmstudio_reasoning.py | Adds "max" to LM Studio's accepted set. |
| agent/auxiliary_client.py | Auxiliary client clamps "max" → "high". |
| locales/*.yaml (16 files) | Updates /reasoning usage and unknown-arg strings to include "max". |
| skills/.../SKILL.md, website/docs/... | Doc updates listing "max". |
| tests/test_hermes_constants.py | Adds test_max_is_a_valid_level; updates documented-levels set. |
| tests/agent/transports/test_codex_transport.py | Adds test_max_effort_clamped. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if effort not in {"minimal", "low", "medium", "high", "xhigh", "max"}: | ||
| effort = "medium" |
| _effort_clamp = {"minimal": "low", "max": "high"} | ||
| reasoning_effort = _effort_clamp.get(reasoning_effort, reasoning_effort) |
| thinking_config["thinkingLevel"] = ( | ||
| "high" if effort in {"high", "xhigh"} else "low" | ||
| "high" if effort in {"high", "xhigh", "max"} else "low" | ||
| ) |
| rather than 400ing the request.""" | ||
| messages = [{"role": "user", "content": "Hi"}] | ||
| kw = transport.build_kwargs( | ||
| model="gpt-5.4", messages=messages, tools=[], |
| treat it as their own ceiling — for example, OpenRouter/OpenAI-style | ||
| `reasoning.effort` consumers should map "max" to their highest supported | ||
| level. |
| @pytest.mark.parametrize( | ||
| "value", | ||
| ["bogus", "very-high", "max", "0", "off", "true", "default"], | ||
| ["bogus", "very-high", "0", "off", "true", "default"], |
|
Closing — change is being kept as a local customization rather than upstreamed. Branch remains on the fork (Vic563/hermes-agent feat/reasoning-max-alias) for personal use. |
|
Reopening — keeping the upstream contribution open as originally intended. |
|
Thanks for the thorough cross-provider analysis and tests. This is an automated hermes-sweeper review; the requested behavior is now implemented on main.
The member note identifying the earlier duplicate effort is consistent with this now-landed implementation. |
The Anthropic adapter has supported
"max"since Opus 4.7 launched (it is also the strongest level Opus/Sonnet 4.6 accept), andADAPTIVE_EFFORT_MAPalready routes it through tooutput_config.effort. But"max"was never listed inVALID_REASONING_EFFORTS, so it failedparse_reasoning_effort()validation everywhere upstream — config.yaml loaders,/reasoningslash command, gateway,batch_runner— and users had to lie via"xhigh"+ a 4.6 model to actually request it.This makes
"max"a first-class reasoning level alongsideminimal/low/medium/high/xhigh.Changes
"max"toVALID_REASONING_EFFORTSinhermes_constants.pyand document it as the Anthropic 4.7+ adaptive-thinking ceiling_load_reasoning_config,batch_runnerhelp +valid_efforts, autocomplete subcommands, setup wizardcanonical_order, and all 16 locale files (status+unknown_argmessages)hermes-agentskill + corresponding website doc pagewebsite/docs/user-guide/configuration.mdreferenceProvider compatibility
ADAPTIVE_EFFORT_MAP; 4.6/4.7 both accept"max"natively"max"to_LM_VALID_EFFORTS; the existingallowed_optionsclamp will downgrade if a model does not expose it"max"maps to the same"high"thinking level as"xhigh"(matches the existing xhigh treatment)"max"→"high"via_effort_clamp, matching the existingminimal→lowpattern. Same clamp applied inauxiliary_client.pyfor consistencyTests
test_hermes_constants.py: documented-set guard now requires"max"; newtest_max_is_a_valid_levelcovers normalization (MAX,Max, etc.)test_codex_transport.py: newtest_max_effort_clampedverifies the Codex backend never sees a literal"max"test_anthropic_adapter.py: pre-existing tests already covermaxon 4.6/4.7360 reasoning/anthropic/codex/chat-completions tests pass. The 10
TestResolveAnthropicTokenfailures observed during local testing are pre-existing onorigin/main(env-var leakage in test isolation, unrelated to this change).