From 175e200d8864298166dfbb2a154af31389258752 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 12 Apr 2026 00:47:43 +0300 Subject: [PATCH] fix(llm): stopping a tool call leaves an infinite spinner --- .../src/widgets/type_widgets/llm_chat/useLlmChat.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts index be522928bb..f52fb6cc61 100644 --- a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts +++ b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts @@ -259,6 +259,16 @@ export function useLlmChat( /** Shared cleanup: finalize collected content and reset streaming state. */ function finalizeStream() { + // Mark any in-progress tool calls as stopped so they don't show infinite spinners + for (const [i, block] of contentBlocks.entries()) { + if (block.type === "tool_call" && !block.toolCall.result) { + contentBlocks[i] = { + type: "tool_call", + toolCall: { ...block.toolCall, result: "[Stopped]", isError: true } + }; + } + } + const finalNewMessages: StoredMessage[] = []; if (thinkingContent) {