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.]'