diff --git a/src/LLMProviders/chainRunner/AutonomousAgentChainRunner.ts b/src/LLMProviders/chainRunner/AutonomousAgentChainRunner.ts index d71c5274..cabe0d3b 100644 --- a/src/LLMProviders/chainRunner/AutonomousAgentChainRunner.ts +++ b/src/LLMProviders/chainRunner/AutonomousAgentChainRunner.ts @@ -599,15 +599,19 @@ ${params} } if (toolCall.name === "localSearch") { - const processed = loopDeps.processLocalSearchResult(result); - collectedSources.push(...processed.sources); - result.result = loopDeps.applyCiCOrderingToLocalSearchResult( - processed.formattedForLLM, - originalUserPrompt || "" - ); - result.displayResult = processed.formattedForDisplay; + if (result.success) { + const processed = loopDeps.processLocalSearchResult(result); + collectedSources.push(...processed.sources); + result.result = loopDeps.applyCiCOrderingToLocalSearchResult( + processed.formattedForLLM, + originalUserPrompt || "" + ); + result.displayResult = processed.formattedForDisplay; + } } else if (toolCall.name === "readNote") { - result.displayResult = ToolResultFormatter.format("readNote", result.result); + if (result.success) { + result.displayResult = ToolResultFormatter.format("readNote", result.result); + } } toolResults.push(result);