File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
apps/sim/lib/copilot/tools/client Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments