Skip to content

The agent that grows with you

fix(cli): clear the preparing-line dedupe set on every stream reset

teknium17aa8249876c7
diff --git a/hermes_cli/cli_stream_mixin.py b/hermes_cli/cli_stream_mixin.py
index 2a63ddefa36..ec99e7beea3 100644
--- a/hermes_cli/cli_stream_mixin.py
+++ b/hermes_cli/cli_stream_mixin.py
@@ -519,6 +519,8 @@ class CLIStreamMixin:
self._reasoning_buf = ""
self._reasoning_preview_buf = ""
self._deferred_content = ""
+ # A batch cancelled/errored before any tool.started would otherwise mute the next turn's line.
+ self.__dict__.pop("_tool_gen_announced", None)
self._stream_table_buf = []
self._in_stream_table = False
self._stream_box_live = False
diff --git a/tests/cli/test_tool_gen_start_dedupe.py b/tests/cli/test_tool_gen_start_dedupe.py
index 5bea4d8a5e6..2fb32c55a16 100644
--- a/tests/cli/test_tool_gen_start_dedupe.py
+++ b/tests/cli/test_tool_gen_start_dedupe.py
@@ -23,3 +23,6 @@ def test_repeated_tool_in_one_batch_prints_once():
with patch.object(_scrollback._cli_mod, "_cprint", lambda line: None):
cli._on_tool_progress("tool.started", "terminal", "ls", {"command": "ls"})
assert sum("preparing terminal" in p for p in _announce(cli, ["terminal"])) == 1
+ # A batch that never reached tool.started (cancel/error) must not mute the next invocation.
+ cli._reset_stream_state()
+ assert sum("preparing terminal" in p for p in _announce(cli, ["terminal"])) == 1