The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): the live-work dock drops a queued prompt when its turn takes it
Teknium9c7b6dec40d1
diff --git a/hermes_cli/cli_tui_runtime_mixin.py b/hermes_cli/cli_tui_runtime_mixin.pyindex 69278b7cccc..fe574ed129f 100644--- a/hermes_cli/cli_tui_runtime_mixin.py+++ b/hermes_cli/cli_tui_runtime_mixin.py@@ -59,10 +59,24 @@ class CLITuiRuntimeMixin:with suppress(Exception):step()+ def _tui_dock_drop_dequeued(self):+ """Re-read the live-work dock once an input has left ``_pending_input``.++ The spinner thread polls the dock once a second, so without this the prompt a turn just took+ (a seeded ``-q`` prompt above all) stays listed as queued while the turn starts. If the reply+ prints in that window the dock shrinks only after it, leaving blank rows under the prompt.+ The turn's own invalidate repaints the refreshed rows.+ """+ monitor = getattr(self, "_subagent_monitor", None)+ if monitor is not None:+ with suppress(Exception):+ monitor.refresh()+def _tui_process_one_input(self, user_input):"""Route one submitted input: file drop, /resume pick, ! shell, slash command, or a chat turn."""from cli import _DIM, _PASTE_REF_RE, _RST, _cprint, _detect_file_drop, _looks_like_slash_command, _strip_leaked_bracketed_paste_wrappers, _strip_leaked_terminal_responses_with_metafrom tools.process_registry_notifications import TimelineNotification+ self._tui_dock_drop_dequeued()user_input, is_voice_input, is_seeded_query = self._tui_unwrap_input(user_input)if not user_input:returndiff --git a/tests/hermes_cli/test_session_dock.py b/tests/hermes_cli/test_session_dock.pyindex dae4a786963..e30441249df 100644--- a/tests/hermes_cli/test_session_dock.py+++ b/tests/hermes_cli/test_session_dock.py@@ -74,3 +74,34 @@ def test_dock_ignores_a_goal_manager_left_over_from_another_session(hermes_home)assert goal_line(SimpleNamespace(session_id="old-sid", _goal_manager=mgr)).startswith("⊙ Goal")assert goal_line(SimpleNamespace(session_id="new-sid", _goal_manager=mgr)) == ""assert goal_line(SimpleNamespace(session_id="new-sid")) == ""+++def test_dock_drops_the_prompt_a_turn_takes_from_the_queue_before_the_turn_runs(hermes_home):+ """A seeded ``-q`` prompt (or any queued input) leaves ``_pending_input`` when its turn starts;+ the dock must stop listing it then, not up to a second later on the spinner thread's poll,+ or the dock is still painted when the reply prints and shrinks under it afterwards."""+ from unittest.mock import Mock++ from cli import HermesCLI, _SeededQueryMessage+ from hermes_cli.cli_subagent_monitor import SubagentMonitor++ cli = HermesCLI.__new__(HermesCLI)+ cli.session_id, cli.agent = "sid-a", None+ cli._pending_input = queue.Queue()+ cli._pending_input.put(_SeededQueryMessage("hello"))+ monitor = cli._subagent_monitor = SubagentMonitor(cli)+ monitor.refresh()+ monitor._last_poll = float("inf") # the 1 s poll would not fire again during this turn+ assert monitor.queued == ["hello"]++ seen = []+ for attr, value in {"_pending_resume_sessions": [], "_typed_voice_stop": lambda t: False,+ "handle_bang_shell": lambda t: False, "_turn_summary_begin": lambda: None,+ "_tui_after_turn": lambda: None, "_app": SimpleNamespace(invalidate=lambda: None),+ "chat": Mock(side_effect=lambda *a, **k: seen.append(list(monitor.queued)))}.items():+ setattr(cli, attr, value)+ cli._tui_process_one_input(cli._pending_input.get_nowait())++ assert cli.chat.call_args.args[0] == "hello"+ assert seen == [[]]+ assert not monitor.has_rows