Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

fix(tracing): clear stream_tool_accumulated at turn start

xf gongf0f06d8a3d38
diff --git a/cubepi/tracing/recorder.py b/cubepi/tracing/recorder.py
index 344d5ff..9c5caee 100644
--- a/cubepi/tracing/recorder.py
+++ b/cubepi/tracing/recorder.py
@@ -670,6 +670,9 @@ class Recorder:
run.turn_terminated_by_tool = False
run.turn_input_messages = []
run.turn_output_messages = []
+ # Reset per-turn stream-recording state so a partially-streamed tool
+ # call in a prior turn cannot inflate accumulated counts in this turn.
+ run.stream_tool_accumulated.clear()
def _on_turn_end(self, event: TurnEndEvent) -> None:
run = self._run