From 45f33853cf952b8642c104a5ecaa263a473f4963 Mon Sep 17 00:00:00 2001 From: Nikolas de Hor Date: Fri, 20 Feb 2026 09:37:42 -0300 Subject: [PATCH] fix: only apply interim fallback when no tools were used Addresses Codex review: if the model sent interim text then used tools, the interim text should not be used as fallback for the final response. --- nanobot/agent/loop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py index d817815..177302e 100644 --- a/nanobot/agent/loop.py +++ b/nanobot/agent/loop.py @@ -245,7 +245,8 @@ class AgentLoop: final_content = None continue # Fall back to interim content if retry produced nothing - if not final_content and interim_content: + # and no tools were used (if tools ran, interim was truly interim) + if not final_content and interim_content and not tools_used: final_content = interim_content break