Skip to content

The agent that grows with you

feat(tui_gateway): session.info reports the wire level the route sends for the effort

teknium1e2a02106cf47
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index b02d8f7428f..dd51281cad4 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -574,6 +574,7 @@ export interface SessionLiveInfo {
model?: string
provider?: string
reasoning_effort?: string
+ reasoning_effort_wire?: string
service_tier?: string
fast?: boolean
yolo?: boolean
@@ -2694,6 +2695,7 @@ export interface SessionCwdSetResult {
model?: string
provider?: string
reasoning_effort?: string
+ reasoning_effort_wire?: string
service_tier?: string
fast?: boolean
yolo?: boolean
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index 2ec97f8dcfe..a51208aaf1d 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -25217,6 +25217,11 @@
"title": "Reasoning Effort",
"type": "string"
},
+ "reasoning_effort_wire": {
+ "default": "",
+ "title": "Reasoning Effort Wire",
+ "type": "string"
+ },
"service_tier": {
"default": "",
"title": "Service Tier",
@@ -26067,6 +26072,11 @@
"title": "Reasoning Effort",
"type": "string"
},
+ "reasoning_effort_wire": {
+ "default": "",
+ "title": "Reasoning Effort Wire",
+ "type": "string"
+ },
"service_tier": {
"default": "",
"title": "Service Tier",
diff --git a/tests/tui_gateway/test_reasoning_session_scope.py b/tests/tui_gateway/test_reasoning_session_scope.py
index 69939246bd1..097bb24df7c 100644
--- a/tests/tui_gateway/test_reasoning_session_scope.py
+++ b/tests/tui_gateway/test_reasoning_session_scope.py
@@ -51,6 +51,17 @@ class TestSessionInfoReasoningEffort:
def test_unset_reports_empty(self) -> None:
info = _session_info(_agent(None))
assert info["reasoning_effort"] == ""
+ assert info["reasoning_effort_wire"] == ""
+
+ def test_wire_level_is_what_the_route_actually_sends(self) -> None:
+ """`ultra` is a Hermes-internal step (#61634): the route clamps it, and the Desktop must be able to
+ say so ("ultra sends max on this route") instead of presenting Ultra as a distinct wire level."""
+ info = _session_info(_agent({"enabled": True, "effort": "ultra"}))
+ assert info["reasoning_effort"] == "ultra"
+ assert info["reasoning_effort_wire"] == "max"
+ # Verbatim levels report themselves, so clients only annotate a real clamp.
+ assert _session_info(_agent({"enabled": True, "effort": "high"}))["reasoning_effort_wire"] == "high"
+ assert _session_info(_agent({"enabled": False}))["reasoning_effort_wire"] == ""
class TestConfigSetReasoningSessionScope:
diff --git a/tui_gateway/contracts/common.py b/tui_gateway/contracts/common.py
index a445d278ba0..5121c20d7ed 100644
--- a/tui_gateway/contracts/common.py
+++ b/tui_gateway/contracts/common.py
@@ -65,6 +65,9 @@ class SessionLiveInfo(OpenModel):
model: str = ""
provider: str = ""
reasoning_effort: str = ""
+ # The level the route's entry clamp actually sends for ``reasoning_effort`` ("" when unset/none;
+ # equal when verbatim). Lets clients label a clamped Hermes step ("ultra sends max on this route").
+ reasoning_effort_wire: str = ""
service_tier: str = ""
fast: bool = False
yolo: bool = False
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index 40bf6bcb17b..846a1443748 100644
--- a/tui_gateway/server.py
+++ b/tui_gateway/server.py
@@ -30,6 +30,7 @@ from utils import file_signature, is_truthy_value
from hermes_state_ids import new_session_id
from tools.environments.local import hermes_subprocess_env
from agent.replay_cleanup import canonicalize_replay_history
+from agent.reasoning_effort import clamp_effort, route_supported_efforts
from agent.compaction_display import project_compaction_message_for_display # noqa: F401
from agent.skill_commands import describe_skill_invocation # noqa: F401
from agent.conversation_loop import INTERRUPT_WAITING_FOR_MODEL_PREFIX # noqa: F401
@@ -2089,10 +2090,18 @@ def _session_info(agent, session: dict | None = None) -> dict:
# Broadcast/resume callers need not be bound to this session's profile.
with _profile_build_scope(sess.get("profile_home") or _hermes_home):
provider = _runtime_model_config(agent).get("provider", provider)
+ model = pending_model or mirror.get("model", getattr(agent, "model", ""))
+ # The level the route's entry clamp actually sends (== reasoning_effort when verbatim), so the
+ # Desktop can say "ultra sends max on this route" like `/reasoning` does instead of presenting a
+ # Hermes-internal step (#61634) as a wire level the route does not have.
+ reasoning_effort_wire = ""
+ if reasoning_effort and reasoning_effort != "none":
+ reasoning_effort_wire = str(clamp_effort(reasoning_effort, route_supported_efforts(pending_provider or provider, model)) or "")
info: dict = {
- "model": pending_model or mirror.get("model", getattr(agent, "model", "")),
+ "model": model,
"provider": pending_provider or provider,
- "reasoning_effort": reasoning_effort, "service_tier": service_tier, "fast": service_tier == "priority",
+ "reasoning_effort": reasoning_effort, "reasoning_effort_wire": reasoning_effort_wire,
+ "service_tier": service_tier, "fast": service_tier == "priority",
"yolo": yolo, "approval_mode": approval_mode,
"tools": dict(mirror.get("tools") or {}) if isinstance(mirror.get("tools"), dict) else {},
"skills": dict(mirror.get("skills") or {}) if isinstance(mirror.get("skills"), dict) else {},