Skip to content

Commit 95b17ff

Browse files
waleedlatif1claude
andcommitted
fix(copilot): abort in-progress tools when stream ends
Calls abortAllInProgressTools in the stream_end handler so tools stuck in generating/executing state are resolved when the stream closes, regardless of whether a done event was received. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 25a03f1 commit 95b17ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/sim/lib/copilot/client-sse/handlers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { STREAM_STORAGE_KEY } from '@/lib/copilot/constants'
33
import { asRecord } from '@/lib/copilot/orchestrator/sse/utils'
44
import type { SSEEvent } from '@/lib/copilot/orchestrator/types'
55
import {
6+
abortAllInProgressTools,
67
isBackgroundState,
78
isRejectedState,
89
isReviewState,
@@ -956,7 +957,7 @@ export const sseHandlers: Record<string, SSEHandler> = {
956957
}))
957958
context.streamComplete = true
958959
},
959-
stream_end: (_data, context, _get, set) => {
960+
stream_end: (_data, context, get, set) => {
960961
if (context.pendingContent) {
961962
if (context.isInThinkingBlock && context.currentThinkingBlock) {
962963
appendThinkingContent(context, context.pendingContent)
@@ -967,6 +968,7 @@ export const sseHandlers: Record<string, SSEHandler> = {
967968
}
968969
finalizeThinkingBlock(context)
969970
updateStreamingMessage(set, context)
971+
abortAllInProgressTools(set, get)
970972
},
971973
default: () => {},
972974
}

0 commit comments

Comments
 (0)