Skip to content

Commit 23fdbbf

Browse files
committed
Fix redeploy
1 parent 59df90a commit 23fdbbf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

apps/sim/lib/copilot/tools/client/workflow/redeploy.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
99

1010
export class RedeployClientTool extends BaseClientTool {
1111
static readonly id = 'redeploy'
12+
private hasExecuted = false
1213

1314
constructor(toolCallId: string) {
1415
super(toolCallId, RedeployClientTool.id, RedeployClientTool.metadata)
@@ -30,6 +31,12 @@ export class RedeployClientTool extends BaseClientTool {
3031
async execute(): Promise<void> {
3132
const logger = createLogger('RedeployClientTool')
3233
try {
34+
if (this.hasExecuted) {
35+
logger.info('execute skipped (already executed)', { toolCallId: this.toolCallId })
36+
return
37+
}
38+
this.hasExecuted = true
39+
3340
this.setState(ClientToolCallState.executing)
3441

3542
const { activeWorkflowId } = useWorkflowRegistry.getState()

apps/sim/stores/panel/copilot/store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,11 @@ const sseHandlers: Record<string, SSEHandler> = {
13071307
updateStreamingMessage(set, context)
13081308

13091309

1310+
// Do not execute on partial tool_call frames
1311+
if (isPartial) {
1312+
return
1313+
}
1314+
13101315
// Prefer interface-based registry to determine interrupt and execute
13111316
try {
13121317
const def = name ? getTool(name) : undefined
@@ -1892,6 +1897,7 @@ const subAgentSSEHandlers: Record<string, SSEHandler> = {
18921897
const id: string | undefined = toolData.id || data?.toolCallId
18931898
const name: string | undefined = toolData.name || data?.toolName
18941899
if (!id || !name) return
1900+
const isPartial = toolData.partial === true
18951901

18961902
// Arguments can come in different locations depending on SSE format
18971903
// Check multiple possible locations
@@ -1958,6 +1964,10 @@ const subAgentSSEHandlers: Record<string, SSEHandler> = {
19581964

19591965
updateToolCallWithSubAgentData(context, get, set, parentToolCallId)
19601966

1967+
if (isPartial) {
1968+
return
1969+
}
1970+
19611971
// Execute client tools in parallel (non-blocking) - same pattern as main tool_call handler
19621972
try {
19631973
const def = getTool(name)

0 commit comments

Comments
 (0)