The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): send Ink and Desktop the turn's reasoning by default
yoniebansf90419e9b6f6
diff --git a/gateway/local_viewer_events.py b/gateway/local_viewer_events.pyindex a4d509ed805..0bffc3cac8d 100644--- a/gateway/local_viewer_events.py+++ b/gateway/local_viewer_events.py@@ -56,10 +56,20 @@ def wire(turn, agent) -> dict:def show_reasoning(turn) -> bool:- """The session's ``show_reasoning`` display flag (``config.set``), off until a viewer sets it."""+ """The session's ``show_reasoning`` display flag (``config.set``, ``/reasoning show|hide``); unset, the+ launch's ``display.show_reasoning`` (default on), as main's TUI gateway resolved it for Ink and Desktop."""owner = getattr(turn, "_approval_owner", None)live = owner[0].sessions.get(owner[1]) if owner is not None else None- return getattr(live, "show_reasoning", None) is True+ flag = getattr(live, "show_reasoning", None)+ if flag is not None or live is None:+ return flag is True+ from gateway.session_policy import active_policy+ policy = active_policy()+ if policy is None:+ return False+ from utils import is_truthy_value+ display = policy.config(owner[0], secrets=False).get("display") or {}+ return is_truthy_value(display.get("show_reasoning"), default=True)def _is_active_session_subagent(turn, payload: dict, event_type: str = "") -> bool:diff --git a/gateway/session_settlement_recovery.py b/gateway/session_settlement_recovery.pyindex 37292c1788c..c78ae3422b5 100644--- a/gateway/session_settlement_recovery.py+++ b/gateway/session_settlement_recovery.py@@ -60,6 +60,8 @@ def completion_payload(row, settled, response, captured):complete['billing'] = captured_result['billing_block']if isinstance(captured_result.get('failure_reason'), str) and captured_result['failure_reason']:complete['failure_reason'] = captured_result['failure_reason']+ if isinstance(captured_result.get('last_reasoning'), str) and captured_result['last_reasoning'].strip():+ complete['reasoning'] = captured_result['last_reasoning'].strip()# The committed row addresses of the turn: a viewer binds the streamed reply to# its stored row, so a transcript read racing this frame never paints it twice.# ``submission_id`` names whose turn it is: the sending viewer binds its optimistic