The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(voice): voice turns default to reasoning off, the lowest valid level where off is refused
Teknium98a6dcf58678
diff --git a/agent/voice_turn_route.py b/agent/voice_turn_route.pyindex 3374c02f494..d7f93a194a7 100644--- a/agent/voice_turn_route.py+++ b/agent/voice_turn_route.py@@ -23,10 +23,14 @@ logger = logging.getLogger(__name__)TASK = "voice_chat"-# Agent fields the route swap touches outside the ``_primary_runtime``-shaped snapshot.+# Agent fields the route swap touches outside the ``_primary_runtime``-shaped snapshot. The+# reasoning-rejection flags are facts about one route: the voice model starts without the main+# model's and leaves its own behind (a learned floor is remembered per route instead).+_REJECTION_FIELDS = ("_reasoning_disable_rejected", "_reasoning_floor_required", "_reasoning_effort_rejected")_EXTRA_FIELDS = ("_fallback_activated", "_fallback_index", "_provider_fallback_active", "_provider_fallback_route","_rate_limit_backoff_count", "_credential_pool", "_credential_pool_entry_id", "_config_context_length",+ *_REJECTION_FIELDS,)@@ -66,6 +70,40 @@ def _fits(agent: Any, messages: List[Dict[str, Any]], system_prompt: str) -> booreturn tokens < limit+def _lowest_effort(agent: Any) -> Optional[str]:+ """The weakest enabled level the active route accepts when it cannot switch reasoning OFF, else+ None (OFF goes on the wire as configured). Static knowledge only; a route that 400s on the disable+ anyway is learned by turn_recovery and remembered by ``end_voice_turn_route``."""+ from agent.auxiliary_reasoning_floor import REASONING_FLOOR_EFFORT, known_reasoning_floor+ off = {"enabled": False}+ if known_reasoning_floor(off, agent.provider, agent.base_url, agent.model, TASK) is not off:+ return REASONING_FLOOR_EFFORT+ if agent.api_mode == "codex_responses":+ from agent.codex_responses_adapter import classify_responses_route+ from agent.transports.codex import _resolve_reasoning+ route = classify_responses_route(agent)+ # An enabled "none" clamps to "none" where the route has it, else to its weakest level+ # (None: the route takes no reasoning field at all).+ effort, _ = _resolve_reasoning(agent.model, {+ "provider": agent.provider, "base_url": agent.base_url, "is_codex_backend": route.is_codex_backend,+ "is_xai_responses": route.is_xai_responses, "reasoning_config": {"enabled": True, "effort": "none"}})+ return None if effort in (None, "none") else effort+ if agent.api_mode == "anthropic_messages":+ from agent.anthropic_adapter import _MANDATORY_THINKING_CLAUDE_SUBSTRINGS, _model_matches+ # Mandatory-thinking Claude omits the disable and thinks at its default effort.+ return REASONING_FLOOR_EFFORT if _model_matches(agent.model, _MANDATORY_THINKING_CLAUDE_SUBSTRINGS) else None+ return None+++def _voice_reasoning(agent: Any, effort: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:+ """``effort`` for the active route: reasoning OFF becomes the lowest valid level where OFF is+ not an option."""+ if not (isinstance(effort, dict) and effort.get("enabled") is False):+ return effort+ lowest = _lowest_effort(agent)+ return {"enabled": True, "effort": lowest} if lowest else effort++def _capture(agent: Any) -> Dict[str, Any]:from agent.agent_runtime_helpers import _build_primary_runtime_snapshotreturn {@@ -125,10 +163,12 @@ def begin_voice_turn_route(agent: Any, messages: List[Dict[str, Any]], system_prreturn agent._cached_system_prompt or system_promptfrom agent.chat_completion_helpers import rewrite_prompt_model_identityrewrite_prompt_model_identity(agent, agent.model, agent.provider)+ for name in _REJECTION_FIELDS:+ setattr(agent, name, False)agent._turn_route_task = TASKlogger.info("Voice turn routed to %s (%s)", agent.model, agent.provider)if effort is not None:- agent.reasoning_config = effort+ agent.reasoning_config = _voice_reasoning(agent, effort)return agent._cached_system_prompt or system_prompt@@ -141,6 +181,10 @@ def end_voice_turn_route(agent: Any) -> None:agent._turn_route_task = ""try:if "snapshot" in state:+ if getattr(agent, "_reasoning_floor_required", False):+ # The voice model 400'd on the disable this turn: start the next voice turn at the floor.+ from agent.auxiliary_reasoning_floor import remember_reasoning_floor+ remember_reasoning_floor(agent.provider, agent.base_url, {"model": agent.model}, None)_reinstall(agent, state)except Exception:logger.warning("Voice turn route restore failed; the next turn re-resolves the main runtime",diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 67cecea3455..770fcc5a3a4 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -787,7 +787,7 @@ DEFAULT_CONFIG = {},"memory_query_rewrite": _aux(8, reasoning_effort=False),"tts_audio_tags": _aux(30),- "voice_chat": _aux(120), # spoken voice-mode turns (agent/voice_turn_route.py); auto = session model+ "voice_chat": {**_aux(120), "reasoning_effort": "none"}, # agent/voice_turn_route.py; off = lowest valid# Kanban: triage_specifier expands a Triage one-liner into a spec (cheap model OK);# kanban_decomposer emits a JSON graph of child tasks (more tokens)."triage_specifier": _aux(120),diff --git a/hermes_cli/main_provider_setup.py b/hermes_cli/main_provider_setup.pyindex 9d73edd047a..e7e0304afa4 100644--- a/hermes_cli/main_provider_setup.py+++ b/hermes_cli/main_provider_setup.py@@ -199,7 +199,10 @@ def _prompt_aux_reasoning_effort(task: str, current: str) -> Optional[str]:def _reset_aux_to_auto() -> int:"""Reset every known aux task (built-in + plugin) back to auto/empty. Returns number reset."""from hermes_cli.config import load_config, save_config- def _clear(entry: dict, auto: str) -> bool:+ from hermes_cli.config_defaults import DEFAULT_CONFIG+ defaults = DEFAULT_CONFIG.get("auxiliary") or {}++ def _clear(entry: dict, auto: str, task: str = "") -> bool:# Only the routing fields; timeout/download_timeout (aux) and max_concurrent_children# etc. (delegation) are user-tuned and preserved. *auto* is the reset provider value# ("auto" for aux tasks, "" for delegation); anything else counts as a change.@@ -208,14 +211,16 @@ def _reset_aux_to_auto() -> int:entry["provider"] = autochanged = Truefor field in ("model", "base_url", "api_key", "reasoning_effort"):- if entry.get(field) or entry.get(field) is False:- entry[field] = ""+ # Reset = the shipped default: "" everywhere except a slot that ships one (voice_chat: none).+ default = str((defaults.get(task) or {}).get(field) or "") if isinstance(defaults.get(task), dict) else ""+ if (entry.get(field) or entry.get(field) is False or default) and entry.get(field) != default:+ entry[field] = defaultchanged = Truereturn changedcfg = load_config()aux = _ensure_dict_section(cfg, "auxiliary")- count = sum(_clear(_ensure_dict_section(aux, task), "auto") for task, _name, _desc in _all_aux_tasks())+ count = sum(_clear(_ensure_dict_section(aux, task), "auto", task) for task, _name, _desc in _all_aux_tasks())dele = cfg.get("delegation")if isinstance(dele, dict):count += _clear(dele, "")diff --git a/hermes_cli/web_server_config.py b/hermes_cli/web_server_config.pyindex 773a9c47967..921eeb4ba11 100644--- a/hermes_cli/web_server_config.py+++ b/hermes_cli/web_server_config.py@@ -807,6 +807,12 @@ def _normalize_aux_reasoning_effort(value: Optional[str]) -> Optional[str]:return "none" if parsed.get("enabled") is False else parsed["effort"]+def _aux_default_effort(slot: str) -> str:+ from hermes_cli.config_defaults import DEFAULT_CONFIG+ block = (DEFAULT_CONFIG.get("auxiliary") or {}).get(slot)+ return str(block.get("reasoning_effort") or "") if isinstance(block, dict) else ""++def _apply_aux_assignment_sync(cfg: dict, provider: str, model: str, task: str, base_url: str, api_key: str,reasoning_effort: Optional[str] = _UNSET) -> dict:from hermes_cli.config import save_config@@ -862,7 +868,12 @@ def _apply_aux_assignment_sync(cfg: dict, provider: str, model: str, task: str,slot_cfg.pop("base_url", None)clear_model_endpoint_credentials(slot_cfg)if effort is None:- slot_cfg.pop("reasoning_effort", None)+ # "Inherit" is an explicit "" where the slot ships a default (voice_chat: none); popping+ # the key would bring that default straight back.+ if _aux_default_effort(slot):+ slot_cfg["reasoning_effort"] = ""+ else:+ slot_cfg.pop("reasoning_effort", None)elif effort is not _UNSET:slot_cfg["reasoning_effort"] = effortaux[slot] = slot_cfgdiff --git a/tests/agent/test_voice_turn_route.py b/tests/agent/test_voice_turn_route.pyindex a29221e9e2e..86a3707c4f1 100644--- a/tests/agent/test_voice_turn_route.py+++ b/tests/agent/test_voice_turn_route.py@@ -44,6 +44,9 @@ def test_voice_turn_routes_then_restores(tmp_path, monkeypatch, voice_window_ok)voice_models = [r["model"] for r in voice.main_requests()]if voice_window_ok:assert voice_models == ["voice-model"]+ # Unconfigured effort: the voice turn goes out with reasoning off, the main turns untouched.+ assert voice.main_requests()[0]["reasoning_effort"] == "none"+ assert {r["reasoning_effort"] for r in main.main_requests()} == {"medium"}assert main_models == ["fake-model", "fake-model"]assert spoken["model"] == "voice-model"else: # too large for the voice model's window: the main model answers, nothing compacts@@ -54,6 +57,23 @@ def test_voice_turn_routes_then_restores(tmp_path, monkeypatch, voice_window_ok)assert agent._fallback_activated is False[email protected]("model,api_mode,expected", [+ ("gpt-6-astra", "codex_responses", "low"), # Responses ladder has no "none"+ ("claude-opus-5-5", "anthropic_messages", "low"), # mandatory thinking+ ("gpt-5.6-sol", "codex_responses", None), # "none" is on its ladder: stays off+ ("claude-sonnet-4-6", "anthropic_messages", None), # accepts thinking.type=disabled+])+def test_reasoning_off_falls_to_the_lowest_valid_level(model, api_mode, expected):+ from types import SimpleNamespace++ from agent.voice_turn_route import _voice_reasoning++ agent = SimpleNamespace(model=model, api_mode=api_mode, provider="custom",+ base_url="https://api.openai.com/v1" if "gpt" in model else "https://api.anthropic.com")+ got = _voice_reasoning(agent, {"enabled": False})+ assert got == ({"enabled": True, "effort": expected} if expected else {"enabled": False})++def test_voice_usage_never_becomes_the_session_route(tmp_path):from hermes_state import SessionDBdiff --git a/website/docs/user-guide/features/voice-mode.md b/website/docs/user-guide/features/voice-mode.mdindex 6efef22009e..5dc8c86deeb 100644--- a/website/docs/user-guide/features/voice-mode.md+++ b/website/docs/user-guide/features/voice-mode.md@@ -250,9 +250,11 @@ auxiliary:voice_chat:provider: openrouter # "auto" = the session's model (default)model: google/gemini-3-flash-preview # empty with a provider = that provider's fast model- reasoning_effort: low # optional; applies to voice turns only+ reasoning_effort: none # default: reasoning off on voice turns (see below)```+Reasoning is off on voice turns by default, also when the slot is left on `auto` and the session's model answers. A model that cannot switch reasoning off (gpt-6-astra, mandatory-thinking Claude, routes whose catalog marks it mandatory) gets its lowest accepted level instead, and a route that rejects the disable at runtime is remembered for the next voice turn. Set any level, or `""` to use the session's effort.+It applies to every chained voice turn: CLI and TUI voice mode, the Desktop voice conversation, and voice notes on messaging platforms. The voice turn has the full toolset; only the model answering it changes. The next typed message goes back to the session's model, and so do memory and skill reviews after the turn. Usage is recorded under the `voice_chat` task, so the session keeps the model you picked as its own.The voice model never forces a compaction: when the conversation is already larger than its context window, that turn runs on the session's model and a one-time notice says so. GPT-Live voice chat ignores this slot, because there the voice layer already is the fast model and delegates real work to the session's model.