diff --git a/apps/sim/executor/handlers/workflow/workflow-handler.test.ts b/apps/sim/executor/handlers/workflow/workflow-handler.test.ts index d6df0cd77d6..3e817b5beed 100644 --- a/apps/sim/executor/handlers/workflow/workflow-handler.test.ts +++ b/apps/sim/executor/handlers/workflow/workflow-handler.test.ts @@ -50,10 +50,6 @@ describe('WorkflowBlockHandler', () => { // Reset all mocks vi.clearAllMocks() - // Clear the static execution stack - - ;(WorkflowBlockHandler as any).executionStack.clear() - // Setup default fetch mock mockFetch.mockResolvedValue({ ok: true, @@ -102,20 +98,6 @@ describe('WorkflowBlockHandler', () => { ) }) - it('should detect and prevent cyclic dependencies', async () => { - const inputs = { workflowId: 'child-workflow-id' } - - // Simulate a cycle by adding the execution to the stack - - ;(WorkflowBlockHandler as any).executionStack.add( - 'parent-workflow-id_sub_child-workflow-id_workflow-block-1' - ) - - await expect(handler.execute(mockBlock, inputs, mockContext)).rejects.toThrow( - 'Error in child workflow "child-workflow-id": Cyclic workflow dependency detected: parent-workflow-id_sub_child-workflow-id_workflow-block-1' - ) - }) - it('should enforce maximum depth limit', async () => { const inputs = { workflowId: 'child-workflow-id' } diff --git a/apps/sim/executor/handlers/workflow/workflow-handler.ts b/apps/sim/executor/handlers/workflow/workflow-handler.ts index 9555f8da319..fc3603417d4 100644 --- a/apps/sim/executor/handlers/workflow/workflow-handler.ts +++ b/apps/sim/executor/handlers/workflow/workflow-handler.ts @@ -21,7 +21,6 @@ const MAX_WORKFLOW_DEPTH = 10 */ export class WorkflowBlockHandler implements BlockHandler { private serializer = new Serializer() - private static executionStack = new Set() canHandle(block: SerializedBlock): boolean { return block.metadata?.id === BlockType.WORKFLOW @@ -47,15 +46,6 @@ export class WorkflowBlockHandler implements BlockHandler { throw new Error(`Maximum workflow nesting depth of ${MAX_WORKFLOW_DEPTH} exceeded`) } - // Check for cycles - include block ID to differentiate parallel executions - const executionId = `${context.workflowId}_sub_${workflowId}_${block.id}` - if (WorkflowBlockHandler.executionStack.has(executionId)) { - throw new Error(`Cyclic workflow dependency detected: ${executionId}`) - } - - // Add current execution to stack - WorkflowBlockHandler.executionStack.add(executionId) - // Load the child workflow from API const childWorkflow = await this.loadChildWorkflow(workflowId) @@ -102,9 +92,6 @@ export class WorkflowBlockHandler implements BlockHandler { const result = await subExecutor.execute(workflowId) const duration = performance.now() - startTime - // Remove current execution from stack after completion - WorkflowBlockHandler.executionStack.delete(executionId) - logger.info(`Child workflow ${childWorkflowName} completed in ${Math.round(duration)}ms`) const childTraceSpans = this.captureChildWorkflowLogs(result, childWorkflowName, context) @@ -131,8 +118,6 @@ export class WorkflowBlockHandler implements BlockHandler { } catch (error: any) { logger.error(`Error executing child workflow ${workflowId}:`, error) - const executionId = `${context.workflowId}_sub_${workflowId}_${block.id}` - WorkflowBlockHandler.executionStack.delete(executionId) const { workflows } = useWorkflowRegistry.getState() const workflowMetadata = workflows[workflowId] const childWorkflowName = workflowMetadata?.name || workflowId