Skip to content

The agent that grows with you

fix(gateway): report the reasoning display a session actually streams

yoniebans3a6893b558e4
diff --git a/gateway/session_busy_controls.py b/gateway/session_busy_controls.py
index dd1ee1e451c..e2ba88ec748 100644
--- a/gateway/session_busy_controls.py
+++ b/gateway/session_busy_controls.py
@@ -88,8 +88,8 @@ def verbose_config(connection, ref, params, write):
def show_reasoning_config(connection, ref, params, write):
"""Session-scoped reasoning display (the classic CLI's ``/reasoning show|hide`` and verbose
- reasoning): whether a local-viewer turn of this session streams ``reasoning.delta``. Off until
- set, because a reasoning sink changes what the provider is asked for. Never a settings write."""
+ reasoning): whether a local-viewer turn of this session streams ``reasoning.delta``. Unset, it
+ reports the launch default the turn uses. Never a settings write."""
value = params.get('value')
word = str(value).strip().lower()
if write and word not in _YOLO_WORDS:
@@ -98,8 +98,13 @@ def show_reasoning_config(connection, ref, params, write):
live = connection.authority.sessions[ref.session_id]
if write:
live.show_reasoning = _YOLO_WORDS[word]
- return {'key': 'show_reasoning', 'value': '1' if getattr(live, 'show_reasoning', None) is True else '0',
- 'scope': 'session'}
+ shown = getattr(live, 'show_reasoning', None)
+ if shown is None:
+ from gateway.local_viewer_events import launch_shows_reasoning
+ from gateway.session_policy import policy_for_source
+ shown = launch_shows_reasoning(policy_for_source(connection.authority.runner, live.source),
+ connection.authority)
+ return {'key': 'show_reasoning', 'value': '1' if shown is True else '0', 'scope': 'session'}
def service_tier_config(connection, ref, params):