The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): send show_reasoning when the session flag is unknown
unsupportedpastelseb54244142ed
diff --git a/hermes_cli/gateway_agent.py b/hermes_cli/gateway_agent.pyindex 1ff9767b9ec..cd141e0a805 100644--- a/hermes_cli/gateway_agent.py+++ b/hermes_cli/gateway_agent.py@@ -425,12 +425,12 @@ class GatewayAgent:self._sync_show_reasoning()def _sync_show_reasoning(self):- """Sent when the value differs from what this session and gateway life hold: /new, /resume and- /branch rotate the session, and a restarted gateway starts without the flag. Unset reads as off- for a classic launch, so ``_show_reasoning_sent`` is the (session, epoch) holding "1"."""+ """Sent unless this viewer already set the value: a session it attaches (/new, /resume, /branch)+ may hold another viewer's "1". A "0" outlives a redial (a restarted gateway starts with the+ flag unset, read as off); a "1" is set again on each gateway life."""show = self._reasoning_callback is not None- key = (self.session_id, self.connection.epoch)- if show == (self._show_reasoning_sent == key):+ sent = self._show_reasoning_sent+ if sent and sent[:2] == (self.session_id, show) and (not show or sent[2] == self.connection.epoch):returntry:self.connection.call("config.set", session_id=self.session_id, key="show_reasoning",@@ -438,7 +438,7 @@ class GatewayAgent:except GatewayClientError as exc:logger.debug("config.set show_reasoning failed: %s", exc)return- self._show_reasoning_sent = key if show else None+ self._show_reasoning_sent = (self.session_id, show, self.connection.epoch)@propertydef service_tier(self):diff --git a/tests/hermes_cli/test_classic_cli_gateway_session.py b/tests/hermes_cli/test_classic_cli_gateway_session.pyindex 6ab9b4cbdc1..31a21273e6d 100644--- a/tests/hermes_cli/test_classic_cli_gateway_session.py+++ b/tests/hermes_cli/test_classic_cli_gateway_session.py@@ -76,6 +76,13 @@ def test_a_new_session_gets_the_show_reasoning_flag(gateway):assert client.reasoning_sets() == [(SID, "1"), ("local-new", "1")]+def test_a_hidden_viewer_resuming_a_session_turns_its_reasoning_flag_off(gateway):+ conn, client = gateway+ agent = GatewayAgent(connection=conn, session_id=SID)+ agent.session_id = "local-shown" # /resume of a session another viewer left showing reasoning+ assert ("local-shown", "0") in client.reasoning_sets()++def test_a_restarted_gateway_gets_the_flag_again_before_the_next_turn(gateway):conn, client = gatewayagent = GatewayAgent(connection=conn, session_id=SID, reasoning_callback=print)