The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: effort pickers and /reasoning status say what ultra really sends
teknium139726f8bb7f2
diff --git a/agent/reasoning_effort.py b/agent/reasoning_effort.pyindex bd252fde323..9d79e72c395 100644--- a/agent/reasoning_effort.py+++ b/agent/reasoning_effort.py@@ -148,6 +148,24 @@ def clamp_effort(return max(below, key=EFFORT_LADDER.index) if below else min(candidates, key=EFFORT_LADDER.index)+def route_supported_efforts(provider: Optional[str], model: Optional[str]) -> tuple[str, ...]:+ """Levels the (provider, model) route's ENTRY clamp accepts: the Codex/OpenAI Responses set per+ model generation, else the widest OpenAI-compatible vocabulary (narrower providers clamp again+ downstream, never upward)."""+ if (provider or "").strip().lower() == "openai-codex":+ return codex_supported_efforts(model)+ return OPENAI_COMPAT_WIRE_EFFORTS+++def effort_display_label(effort: Optional[str], provider: Optional[str] = None, model: Optional[str] = None) -> str:+ """Picker / ``/reasoning`` status label for a ladder level: the level itself when the route sends+ it verbatim, else ``"<level> (sends <clamped> on this route)"`` so a Hermes-internal step such as+ ``ultra`` (#61634) is never presented as a distinct wire level the route does not have."""+ requested = str(effort or "").strip().lower()+ clamped = clamp_effort(requested, route_supported_efforts(provider, model))+ return requested if not requested or clamped == requested else f"{requested} (sends {clamped} on this route)"++def requested_effort(reasoning_config: Optional[dict]) -> Optional[str]:"""The user's explicit effort, or None (absent/malformed config, no effort, or reasoningdisabled) — callers then omit the wire field."""diff --git a/gateway/slash_commands_model.py b/gateway/slash_commands_model.pyindex 53ede6ad552..15fbb5a444d 100644--- a/gateway/slash_commands_model.py+++ b/gateway/slash_commands_model.py@@ -718,12 +718,25 @@ class GatewayModelCommandsMixin:if raw_args: # typed path — same applier the picker usesreturn self._apply_reasoning_selection(session_key, platform_key, args, persist_global=persist_global)rc = self._reasoning_config+ # Labels tell the truth about the route: a Hermes-internal step (``ultra``) that the wire+ # clamps is shown as "ultra (sends max on this route)" instead of a distinct level (#61634).+ from agent.reasoning_effort import effort_display_label+ from gateway.run import _load_gateway_config+ _session_route = ((getattr(self, "_session_model_overrides", {}) or {}).get(session_key) or {})+ _model_cfg = {}+ with contextlib.suppress(Exception): # fail-open on config read errors, like /model does+ _model_cfg = _load_gateway_config(config_path=self.config_path).get("model", {}) or {}+ _route = (+ _session_route.get("provider") or _model_cfg.get("provider"),+ _session_model or _model_cfg.get("default") or _model_cfg.get("model"),+ )if rc is None:level, current_effort = t("gateway.reasoning.level_default"), "medium"elif rc.get("enabled") is False:level, current_effort = t("gateway.reasoning.level_disabled"), "none"else:- level = current_effort = rc.get("effort", "medium")+ current_effort = rc.get("effort", "medium")+ level = effort_display_label(current_effort, *_route)display_state = t("gateway.reasoning.display_on") if self._show_reasoning else t("gateway.reasoning.display_off")has_session_override = session_key in (getattr(self, "_session_reasoning_overrides", {}) or {})scope = t("gateway.reasoning.scope_session") if has_session_override else t("gateway.reasoning.scope_global")@@ -737,7 +750,8 @@ class GatewayModelCommandsMixin:title=t("gateway.reasoning.picker_title", level=level, scope=scope, display=display_state),choices=[{"value": "none", "label": t("gateway.reasoning.choice_none"), "is_current": current_effort == "none"},- *({"value": lv, "label": lv, "is_current": lv == current_effort} for lv in VALID_REASONING_EFFORTS),+ *({"value": lv, "label": effort_display_label(lv, *_route), "is_current": lv == current_effort}+ for lv in VALID_REASONING_EFFORTS),*({"value": v, "label": t(f"gateway.reasoning.choice_{v}"), "is_current": False}for v in ("reset", "show", "hide")),],diff --git a/hermes_cli/cli_commands_mixin.py b/hermes_cli/cli_commands_mixin.pyindex d8c7bed4925..997c8bfaacd 100644--- a/hermes_cli/cli_commands_mixin.py+++ b/hermes_cli/cli_commands_mixin.py@@ -2563,11 +2563,13 @@ class CLICommandsMixin:"""Handle /reasoning [<level> [--global]|show|hide|full|clamp] — effort level (sessionscope unless --global) and thinking display toggles (always saved)."""from cli import CLI_CONFIG, _parse_reasoning_config+ from agent.reasoning_effort import effort_display_labelraw = _command_arg(cmd)+ _route = (getattr(self, "provider", None), getattr(self, "model", None))if not raw: # show current staterc = self.reasoning_configlevel = ("medium (default)" if rc is None else "none (disabled)"- if rc.get("enabled") is False else rc.get("effort", "medium"))+ if rc.get("enabled") is False else effort_display_label(rc.get("effort", "medium"), *_route))display_state = "on ✓" if self.show_reasoning else "off"full_state = "full" if getattr(self, "reasoning_full", False) else "clamped to 10 lines"return _cp(_accent_line(f"Reasoning effort: {level}"),@@ -2602,7 +2604,8 @@ class CLICommandsMixin:if not isinstance(CLI_CONFIG.get("agent"), dict):CLI_CONFIG["agent"] = {}CLI_CONFIG["agent"]["reasoning_effort"] = arg- _cp(_accent_line(f"✓ Reasoning effort set to '{arg}' {_scope_outcome(explicit_global, saved)}"))+ _cp(_accent_line(f"✓ Reasoning effort set to '{effort_display_label(arg, *_route)}' "+ f"{_scope_outcome(explicit_global, saved)}"))def _handle_busy_command(self, cmd: str):"""Handle /busy [status|queue|steer|interrupt] — what Enter does while Hermes is working."""diff --git a/tests/agent/test_reasoning_effort_labels.py b/tests/agent/test_reasoning_effort_labels.pynew file mode 100644index 00000000000..913e0ef439e--- /dev/null+++ b/tests/agent/test_reasoning_effort_labels.py@@ -0,0 +1,15 @@+"""#61634: ``ultra`` is Hermes-internal and every wire clamps it; the display label used by the+effort pickers and ``/reasoning`` status must say what the route really sends."""+from agent.reasoning_effort import effort_display_label+++def test_clamped_level_label_names_the_wire_level():+ assert effort_display_label("ultra", "openai-codex", "gpt-5.6-sol") == "ultra (sends max on this route)"+ assert effort_display_label("ultra", "openai-codex", "gpt-5.5") == "ultra (sends xhigh on this route)"+ assert effort_display_label("ultra", "openrouter", "anthropic/claude-opus-4.5") == "ultra (sends max on this route)"+++def test_supported_level_label_is_the_level_itself():+ assert effort_display_label("max", "openai-codex", "gpt-5.6-sol") == "max"+ assert effort_display_label("high", None, None) == "high"+ assert effort_display_label("", None, None) == ""diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.mdindex cd9146c8856..9f9f22ad303 100644--- a/website/docs/user-guide/configuration.md+++ b/website/docs/user-guide/configuration.md@@ -1810,6 +1810,13 @@ unreachable or a model isn't listed, Hermes falls back to its built-inmodel-family list and passes your effort through unchanged.:::+:::note `ultra` is clamped to the strongest level the route accepts+`ultra` is a Hermes-internal ladder step: no provider wire accepts it, so every route clamps it+to its strongest level (`max` on GPT-5.6 Codex and OpenAI-compatible routes, `xhigh` on older+Codex models). The effort pickers and `/reasoning` status show this as+`ultra (sends max on this route)` so the level you see is the level that is sent.+:::+You can also change the reasoning effort at runtime with the `/reasoning` command:```