From 668c7aef26f7b44034a0711dcd552c2bd9bb660d Mon Sep 17 00:00:00 2001 From: Badri Narayanan S Date: Sat, 3 Jan 2026 22:38:46 +0530 Subject: [PATCH] correct els if condition for state.inToolLoop --- src/format/thinking-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/format/thinking-utils.js b/src/format/thinking-utils.js index 83fa902..af9b3de 100644 --- a/src/format/thinking-utils.js +++ b/src/format/thinking-utils.js @@ -464,7 +464,7 @@ export function closeToolLoopForThinking(messages) { }); logger.debug('[ThinkingUtils] Applied thinking recovery for interrupted tool'); - } else { + } else if (state.inToolLoop) { // For tool loops: add synthetic messages to close the loop const syntheticText = state.toolResultCount === 1 ? '[Tool execution completed.]'