From 623c8b65f1f4107ec6e3fee48974558f29309037 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 20 Jun 2025 14:13:50 -0700 Subject: [PATCH] Set failed response message when a research iteration fails. Previously summarizedResult would be unset when a tool call failed. This caused research to fail due to ChatMessageModel failures when constructing tool chat histories and would have caused similar errors in other constructed chat histories. Putting a failed iteration message in the summary prevents that while letting the research agent continue its research. --- src/khoj/routers/research.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/khoj/routers/research.py b/src/khoj/routers/research.py index ce4332ba..6405ac91 100644 --- a/src/khoj/routers/research.py +++ b/src/khoj/routers/research.py @@ -499,5 +499,6 @@ async def research( # intermediate_result = await extract_relevant_info(this_iteration.query, results_data, agent) this_iteration.summarizedResult = results_data + this_iteration.summarizedResult = this_iteration.summarizedResult or "Failed to get results." previous_iterations.append(this_iteration) yield this_iteration