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) {