From 8f5c2d1a062dc85eb9d5521167df7b642fbb9bc3 Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Mon, 23 Mar 2026 03:27:13 +0000 Subject: [PATCH] fix(cli): stop spinner after non-streaming interactive replies --- nanobot/cli/commands.py | 5 +++++ nanobot/cli/stream.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index db348ed..d0ec145 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -752,6 +752,7 @@ def agent( on_stream_end=renderer.on_end, ) if not renderer.streamed: + await renderer.close() _print_agent_response( response.content if response else "", render_markdown=markdown, @@ -873,9 +874,13 @@ def agent( if turn_response: content, meta = turn_response[0] if content and not meta.get("_streamed"): + if renderer: + await renderer.close() _print_agent_response( content, render_markdown=markdown, metadata=meta, ) + elif renderer and not renderer.streamed: + await renderer.close() except KeyboardInterrupt: _restore_terminal() console.print("\nGoodbye!") diff --git a/nanobot/cli/stream.py b/nanobot/cli/stream.py index 161d530..16586ec 100644 --- a/nanobot/cli/stream.py +++ b/nanobot/cli/stream.py @@ -119,3 +119,10 @@ class StreamRenderer: self._start_spinner() else: _make_console().print() + + async def close(self) -> None: + """Stop spinner/live without rendering a final streamed round.""" + if self._live: + self._live.stop() + self._live = None + self._stop_spinner()