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.
This commit is contained in:
Nikolas de Hor
2026-02-20 09:37:42 -03:00
parent 4eb07c44b9
commit 45f33853cf

View File

@@ -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