Skip to content

Commit 2788c68

Browse files
committed
Tool results
1 parent cf9cc03 commit 2788c68

File tree

1 file changed

+12
-10
lines changed
  • apps/sim/lib/copilot/orchestrator/stream

1 file changed

+12
-10
lines changed

apps/sim/lib/copilot/orchestrator/stream/core.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,21 @@ export async function runStreamLoop(
105105

106106
const normalizedEvent = normalizeSseEvent(event)
107107

108-
// Skip duplicate tool events.
108+
// Skip duplicate tool events — both forwarding AND handler dispatch.
109109
const shouldSkipToolCall = shouldSkipToolCallEvent(normalizedEvent)
110110
const shouldSkipToolResult = shouldSkipToolResultEvent(normalizedEvent)
111111

112-
if (!shouldSkipToolCall && !shouldSkipToolResult) {
113-
try {
114-
await options.onEvent?.(normalizedEvent)
115-
} catch (error) {
116-
logger.warn('Failed to forward SSE event', {
117-
type: normalizedEvent.type,
118-
error: error instanceof Error ? error.message : String(error),
119-
})
120-
}
112+
if (shouldSkipToolCall || shouldSkipToolResult) {
113+
continue
114+
}
115+
116+
try {
117+
await options.onEvent?.(normalizedEvent)
118+
} catch (error) {
119+
logger.warn('Failed to forward SSE event', {
120+
type: normalizedEvent.type,
121+
error: error instanceof Error ? error.message : String(error),
122+
})
121123
}
122124

123125
// Let the caller intercept before standard dispatch.

0 commit comments

Comments
 (0)