From 4313b8aff6fd76fb834fb8adcd6edffa4490cccf Mon Sep 17 00:00:00 2001 From: Teknium Date: Tue, 24 Mar 2026 06:33:21 -0700 Subject: [PATCH] fix(cli): ensure single closure of streaming boxes during tool generation - Updated `_on_tool_gen_start` method in `HermesCLI` to close open streaming boxes exactly once, preventing potential multiple closures. - Added a check for `_stream_box_opened` to manage the state of the streaming box more effectively, enhancing user experience during large payload streaming. --- cli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli.py b/cli.py index 85c804c18..7783e736a 100644 --- a/cli.py +++ b/cli.py @@ -4641,11 +4641,13 @@ class HermesCLI: def _on_tool_gen_start(self, tool_name: str) -> None: """Called when the model begins generating tool-call arguments. - Closes any open streaming boxes (reasoning / response) and prints a - short status line so the user sees activity instead of a frozen - screen while a large payload (e.g. a 45 KB write_file) streams in. + Closes any open streaming boxes (reasoning / response) exactly once, + then prints a short status line so the user sees activity instead of + a frozen screen while a large payload (e.g. 45 KB write_file) streams. """ - self._flush_stream() + if getattr(self, "_stream_box_opened", False): + self._flush_stream() + self._stream_box_opened = False self._close_reasoning_box() from agent.display import get_tool_emoji