From 541e84f5ae62b72fb40331de6977004ba0e655f3 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 15 Jun 2026 13:23:44 +0200 Subject: [PATCH] refac --- cptr/utils/chat_task.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cptr/utils/chat_task.py b/cptr/utils/chat_task.py index 273453f..f511f34 100644 --- a/cptr/utils/chat_task.py +++ b/cptr/utils/chat_task.py @@ -682,7 +682,9 @@ async def _load_message_history(chat_id: str, message_id: str) -> tuple[list[dic if turn["reasoning"]: entry["reasoning_items"] = turn["reasoning"] else: - # Subsequent turns: create a new assistant entry + # Subsequent turns: flush the pending entry (last tool + # result from previous turn) before creating a new one. + result.append(entry) entry = { "role": "assistant", "content": "",