The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: share goal controls while messaging turns are active
Tekniumaacaeff42fce
diff --git a/gateway/run_busy.py b/gateway/run_busy.pyindex 0154fe28052..57e19f82500 100644--- a/gateway/run_busy.py+++ b/gateway/run_busy.py@@ -890,13 +890,9 @@ class GatewayBusySessionMixin:async def _busy_goal_command(self, event: MessageEvent, quick_key: str, source):# Control verbs are safe mid-run (state only); setting new goal text is rejected so we don't# race a second continuation against the current turn. wait/gate take an argument.- _goal_arg = (event.get_command_args() or "").strip().lower()- _goal_verb = _goal_arg.split(None, 1)[0] if _goal_arg else ""- if (- not _goal_arg- or _goal_arg in {"status", "pause", "resume", "clear", "stop", "done", "unwait"}- or _goal_verb in {"wait", "gate"}- ):+ from hermes_cli.goal_command import is_goal_control++ if is_goal_control(event.get_command_args() or ""):return await self._handle_goal_command(event)return "Agent is running — use /goal status / pause / clear / wait mid-run, or /stop before setting a new goal."diff --git a/hermes_cli/goal_command.py b/hermes_cli/goal_command.pyindex 9b0953a65c3..e334192f810 100644--- a/hermes_cli/goal_command.py+++ b/hermes_cli/goal_command.py@@ -155,6 +155,12 @@ def _set(mgr, arg, *, drafting, last_user_message, render, progress):return GoalCommandResult(output, goals.goal_kick_prompt(state.goal, last_user_message), kickoff=True)+def is_goal_control(arg: str) -> bool:+ """Whether this command controls an existing goal rather than replacing it."""+ normalized = arg.strip().lower()+ return normalized in _EXACT_HANDLERS or normalized.split(None, 1)[0] in {"wait", "gate"}++def dispatch_goal_command(mgr: goals.GoalManager, arg: str, *, authorize_gate: Callable[[], str | None],last_user_message=None, render: Callable = _english,diff --git a/tests/hermes_cli/test_goal_dispatch.py b/tests/hermes_cli/test_goal_dispatch.pyindex 5698537b0a8..b718424d8e4 100644--- a/tests/hermes_cli/test_goal_dispatch.py+++ b/tests/hermes_cli/test_goal_dispatch.py@@ -23,8 +23,13 @@ def _surface(surface, mgr, monkeypatch, prompts=None):prompts.append(cli._pending_input.get_nowait())return executeif surface == "gateway":+ from gateway.run_busy import GatewayBusySessionMixinfrom gateway.slash_commands_goals import GatewayGoalCommandsMixin- runner = object.__new__(GatewayGoalCommandsMixin)++ class Runner(GatewayBusySessionMixin, GatewayGoalCommandsMixin):+ pass++ runner = object.__new__(Runner)async def manager(event):return mgr, Noneasync def execute(fn, *args):@@ -34,8 +39,12 @@ def _surface(surface, mgr, monkeypatch, prompts=None):runner._adapter_and_key_for = lambda event: (None, None)runner._enqueue_goal_turn = lambda event, text, **kwargs: prompts.append(text)runner._resume_caller_is_admin = lambda source: True- return lambda arg: asyncio.run(runner._handle_goal_command(SimpleNamespace(- get_command_args=lambda: arg, source=None)))+ def execute(arg):+ event = SimpleNamespace(get_command_args=lambda: arg, source=None)+ if arg == 'show':+ return asyncio.run(runner._busy_goal_command(event, mgr.session_id, None))+ return asyncio.run(runner._handle_goal_command(event))+ return executefrom tui_gateway import serverserver._sessions[mgr.session_id] = {'session_key': mgr.session_id}def execute(arg):@@ -64,7 +73,9 @@ def test_surface_goal_state_matches_cli(surface, command, monkeypatch):mgr.set('original objective')mgr.add_gate('original gate')mgr.wait_on(os.getpid(), reason='existing barrier')- _surface(name, mgr, monkeypatch)(command)+ result = _surface(name, mgr, monkeypatch)(command)+ if name == 'gateway' and command == 'show':+ assert mgr.state.goal in resultstate = goals.load_goal(mgr.session_id)if state:from dataclasses import asdict