Skip to content

feat: add automatic reasoning effort resolution - #61410

Open
0xSynthex wants to merge 1 commit into
NousResearch:mainfrom
0xSynthex:pr/auto-reasoning-effort
Open

feat: add automatic reasoning effort resolution#61410
0xSynthex wants to merge 1 commit into
NousResearch:mainfrom
0xSynthex:pr/auto-reasoning-effort

Conversation

@0xSynthex

@0xSynthex 0xSynthex commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • allow reasoning_effort: auto to parse as a first-class marker
  • resolve auto per request with deterministic local heuristics (low / medium / high)
  • apply the resolved concrete reasoning config across OpenAI-compatible, Anthropic, Codex, and max-iteration summary paths
  • update /reasoning help text and gateway config docs

Why

Users can keep a stable config while avoiding one fixed reasoning level for every task. The resolver is local-only and does not mutate prompts or tools, so prompt caching remains stable.

Tests

  • python -m pytest tests/test_auto_reasoning_effort.py -q
  • ruff check agent/chat_completion_helpers.py gateway/run.py hermes_cli/cli_commands_mixin.py hermes_constants.py tests/test_auto_reasoning_effort.py

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Jul 9, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Implements the feature requested in #40306 (auto reasoning mode). Related: #40306.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing a local, cache-safe resolver. The feature is still needed on current main, but there are a few correctness gaps to address.

Problems

  • Gateway /reasoning auto is still rejected by the hard-coded level list in gateway/slash_commands.py:2730-2738; changing the loader docstring in gateway/run.py does not reach the command handler.
  • The GitHub Responses branch still constructs github_reasoning_extra from raw agent.reasoning_config at agent/chat_completion_helpers.py:770; run_agent.py:5433-5449 therefore maps raw auto to its fallback instead of the resolved effort.
  • The LM Studio summary effort is calculated from raw config before summary_reasoning_config is resolved at agent/chat_completion_helpers.py:1661-1671, so auto becomes LM Studio's default medium (agent/lmstudio_reasoning.py:35-47).

Suggested changes

  • Route gateway parsing through the shared parser, pass resolved config to GitHub/LM Studio special paths, and add transport plus summary regression tests.
  • Update the public config docs at website/docs/user-guide/configuration.md:1279-1301 and cli-config.yaml.example:739-742.

Automated hermes-sweeper review.

Comment thread gateway/run.py
"""Load reasoning effort from config.yaml.

Reads agent.reasoning_effort from config.yaml. Valid: "none",
Reads agent.reasoning_effort from config.yaml. Valid: "none", "auto",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documents auto, but gateway /reasoning auto still fails because gateway/slash_commands.py:2730-2738 hard-codes its accepted levels. Please update that handler and add a gateway command test.

from hermes_constants import resolve_auto_reasoning_config

tools_for_api = agent.tools
reasoning_config = resolve_auto_reasoning_config(agent.reasoning_config, api_messages)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resolved value is bypassed for GitHub Responses: the payload at line 770 is still built by _github_models_reasoning_extra_body() from raw agent.reasoning_config, which maps auto to its fallback medium. Pass this resolved config through that special path.

agent._resolve_lmstudio_summary_reasoning_effort()
if _is_lmstudio_summary else None
)
try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For LM Studio, _lm_reasoning_effort was already computed from raw agent.reasoning_config at lines 1661-1663. Resolve first, then derive the LM Studio effort from the resolved config; otherwise iteration-limit summaries use medium for auto.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 11, 2026
@doryani-ai

doryani-ai commented Aug 9, 2026

Copy link
Copy Markdown

Hi @0xSynthex — I’m sorry: I missed that this PR was already open and linked from #40306 when preparing #82578. I should have reviewed and credited your work first; thank you for implementing the deterministic local approach ahead of mine.

After comparing them, I think #82578 may still be useful as a separate candidate because it was built around some additional lifecycle requirements—per-session state, full tool-loop restoration, explicit override/Desktop behavior, and delegated-child handling. That is not meant to diminish this PR. I’m happy to follow whatever consolidation path you and the maintainers prefer, including reworking or closing mine. I’ve updated #82578 to acknowledge this PR properly.

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 P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants