Skip to content

The agent that grows with you

fix: attached `hermes chat` handles /yolo through the owner

Teknium86184f3da63c
diff --git a/hermes_cli/gateway_chat_view.py b/hermes_cli/gateway_chat_view.py
index cadf804a97f..23f7049e465 100644
--- a/hermes_cli/gateway_chat_view.py
+++ b/hermes_cli/gateway_chat_view.py
@@ -217,8 +217,17 @@ class GatewayChatView:
self.mutations.acknowledge(original, operation, payload)
print(f"{operation}: {target}")
return True
+ if command == "/yolo":
+ # This session's approval bypass on the owner (same verb as the TUI's /yolo and Desktop).
+ word = rest.strip().lower()
+ if word not in {"", "on", "off"}:
+ raise GatewayClientError("Usage: /yolo [on|off]")
+ result = await self.client.rpc("config.set", session_id=self.session_id, key="yolo",
+ **({"value": "1" if word == "on" else "0"} if word else {}))
+ print(f"YOLO {'on' if result.get('value') == '1' else 'off'} for this session")
+ return True
if command == "/help":
- print("/stop, /approve <id> <choice>, /answer <id> <text>, /discard <admission_id> (turn lost during restart), /quit (detach). /branch [title], /model <model> [--provider name], /compress [here [N] | <focus>] [--preview].")
+ print("/stop, /approve <id> <choice>, /answer <id> <text>, /discard <admission_id> (turn lost during restart), /yolo [on|off], /quit (detach). /branch [title], /model <model> [--provider name], /compress [here [N] | <focus>] [--preview].")
return True
raise GatewayClientError("Unsupported gateway CLI command; use /help. No local command was run.")
diff --git a/tests/hermes_cli/test_gateway_chat.py b/tests/hermes_cli/test_gateway_chat.py
index 445fb035d73..4cb51094e1f 100644
--- a/tests/hermes_cli/test_gateway_chat.py
+++ b/tests/hermes_cli/test_gateway_chat.py
@@ -109,3 +109,23 @@ async def test_rpc_preserves_notifications_and_errors():
await client.rpc("session.interrupt", session_id="stored", execution_generation=4)
event = await asyncio.wait_for(client.events.get(), 2)
assert event["params"]["text"] == "reply"
+
+
+async def test_yolo_slash_toggles_the_session_bypass_on_the_owner(capsys):
+ """`/yolo` in an attached `hermes chat` was refused as an unsupported command, so a `--yolo`
+ launch could not be revoked from the classic CLI; it is the owner's session-scoped config.set."""
+ from hermes_cli.gateway_chat_view import GatewayChatView
+ calls = []
+
+ class Peer:
+ async def rpc(self, method, **params):
+ calls.append((method, params))
+ return {"key": "yolo", "value": params.get("value", "0"), "scope": "session"}
+
+ view = GatewayChatView(Peer(), {"stored_session_id": "sid"})
+ assert await view.command("/yolo off") is True
+ assert await view.command("/yolo") is True
+ assert calls == [("config.set", {"session_id": "sid", "key": "yolo", "value": "0"}),
+ ("config.set", {"session_id": "sid", "key": "yolo"})]
+ assert "YOLO off for this session" in capsys.readouterr().out