From b4fd925111ffdcd90e910574fdbc2ebb7b196232 Mon Sep 17 00:00:00 2001 From: Logan Yang Date: Thu, 23 Oct 2025 17:08:04 -0700 Subject: [PATCH] fix: Enhance error handling in AutonomousAgentChainRunner for local search and readNote tool calls (#1956) --- .../chainRunner/AutonomousAgentChainRunner.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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);