Skip to content

Commit e26bb12

Browse files
committed
Fix run workflow
1 parent 58a82bb commit e26bb12

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

apps/sim/lib/copilot/tools/client/run-tool-execution.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ async function doExecuteRunTool(
121121
return
122122
}
123123

124+
const existingToolCallId = activeRunToolByWorkflowId.get(targetWorkflowId)
125+
if (existingToolCallId) {
126+
logger.warn('[RunTool] Execution prevented: another run tool is already active', {
127+
toolCallId,
128+
toolName,
129+
existingToolCallId,
130+
})
131+
await reportCompletion(
132+
toolCallId,
133+
MothershipStreamV1ToolOutcome.error,
134+
'Workflow is already being executed by another tool. Wait for it to complete.'
135+
)
136+
return
137+
}
138+
124139
setActiveWorkflow(targetWorkflowId)
125140
activeRunToolByWorkflowId.set(targetWorkflowId, toolCallId)
126141

@@ -129,6 +144,7 @@ async function doExecuteRunTool(
129144

130145
if (isExecuting) {
131146
logger.warn('[RunTool] Execution prevented: already executing', { toolCallId, toolName })
147+
activeRunToolByWorkflowId.delete(targetWorkflowId)
132148
setToolState(toolCallId, ClientToolCallState.error)
133149
await reportCompletion(
134150
toolCallId,

0 commit comments

Comments
 (0)