mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-04 00:35:58 +00:00
Stream-end events are emitted at the end of every assistant turn. When the agent has more tool-call rounds queued, the runner sets `_resuming=True` on the metadata. Without a guard, every intermediate stream end removed the OnIt reaction (the first one wins, since `_reaction_ids.pop` empties the slot) and re-added `done_emoji`, producing a DONE reaction after every tool call instead of only at final completion. Wrap the OnIt removal and `done_emoji` add in a `not _resuming` guard so the OnIt indicator persists across tool-call rounds and DONE fires exactly once when the agent's final response lands. `_resuming` already flows through outbound metadata (`nanobot/agent/loop.py:747`) and survives `_coalesce_stream_deltas` because pure `_stream_end` messages without `_stream_delta` skip the merge branch. Tests: - test_no_removal_when_resuming - test_done_emoji_only_on_final_stream_end