fix: preserve streaming UI callbacks across agent loop iterations
StreamHandler.reset() was clearing on_content, on_thinking, and on_done callbacks after every LLM response, but they were only set once per turn. This caused the thinking indicator and streaming display to stop working after the first tool call in a multi-step agent turn. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -183,11 +183,8 @@ class StreamHandler:
|
||||
return bool(self._accumulated_reasoning) and not self._accumulated_content and not self._tool_calls
|
||||
|
||||
def reset(self) -> None:
|
||||
"""Clear all accumulators for the next turn."""
|
||||
"""Clear accumulators for the next LLM call, preserving UI callbacks."""
|
||||
self._accumulated_content = ""
|
||||
self._accumulated_reasoning = ""
|
||||
self._tool_calls.clear()
|
||||
self._usage = None
|
||||
self._on_content = None
|
||||
self._on_thinking = None
|
||||
self._on_done = None
|
||||
|
||||
Reference in New Issue
Block a user