Fix a bug in AWSNovaSonicLLMService where we would mishandle cancelled tool calls in context

This commit is contained in:
Paul Kompfner
2025-12-09 12:12:55 -05:00
parent 0c5bccd1f1
commit b821dd2507

View File

@@ -486,7 +486,7 @@ class AWSNovaSonicLLMService(LLMService):
async def _process_completed_function_calls(self, send_new_results: bool):
# Check for set of completed function calls in the context
for message in self._context.get_messages():
if message.get("role") and message.get("content") != "IN_PROGRESS":
if message.get("role") and message.get("content") not in ["IN_PROGRESS", "CANCELLED"]:
tool_call_id = message.get("tool_call_id")
if tool_call_id and tool_call_id not in self._completed_tool_calls:
# Found a newly-completed function call - send the result to the service