Skip to content

Commit a5c224e

Browse files
fix(workflow-block): remove process specific circular dependency check (#1293)
* fix(workflow-block): remove process specific circular dep check * remove comments
1 parent 0785f6e commit a5c224e

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

apps/sim/executor/handlers/workflow/workflow-handler.test.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ describe('WorkflowBlockHandler', () => {
5050
// Reset all mocks
5151
vi.clearAllMocks()
5252

53-
// Clear the static execution stack
54-
55-
;(WorkflowBlockHandler as any).executionStack.clear()
56-
5753
// Setup default fetch mock
5854
mockFetch.mockResolvedValue({
5955
ok: true,
@@ -102,20 +98,6 @@ describe('WorkflowBlockHandler', () => {
10298
)
10399
})
104100

105-
it('should detect and prevent cyclic dependencies', async () => {
106-
const inputs = { workflowId: 'child-workflow-id' }
107-
108-
// Simulate a cycle by adding the execution to the stack
109-
110-
;(WorkflowBlockHandler as any).executionStack.add(
111-
'parent-workflow-id_sub_child-workflow-id_workflow-block-1'
112-
)
113-
114-
await expect(handler.execute(mockBlock, inputs, mockContext)).rejects.toThrow(
115-
'Error in child workflow "child-workflow-id": Cyclic workflow dependency detected: parent-workflow-id_sub_child-workflow-id_workflow-block-1'
116-
)
117-
})
118-
119101
it('should enforce maximum depth limit', async () => {
120102
const inputs = { workflowId: 'child-workflow-id' }
121103

apps/sim/executor/handlers/workflow/workflow-handler.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const MAX_WORKFLOW_DEPTH = 10
2121
*/
2222
export class WorkflowBlockHandler implements BlockHandler {
2323
private serializer = new Serializer()
24-
private static executionStack = new Set<string>()
2524

2625
canHandle(block: SerializedBlock): boolean {
2726
return block.metadata?.id === BlockType.WORKFLOW
@@ -47,15 +46,6 @@ export class WorkflowBlockHandler implements BlockHandler {
4746
throw new Error(`Maximum workflow nesting depth of ${MAX_WORKFLOW_DEPTH} exceeded`)
4847
}
4948

50-
// Check for cycles - include block ID to differentiate parallel executions
51-
const executionId = `${context.workflowId}_sub_${workflowId}_${block.id}`
52-
if (WorkflowBlockHandler.executionStack.has(executionId)) {
53-
throw new Error(`Cyclic workflow dependency detected: ${executionId}`)
54-
}
55-
56-
// Add current execution to stack
57-
WorkflowBlockHandler.executionStack.add(executionId)
58-
5949
// Load the child workflow from API
6050
const childWorkflow = await this.loadChildWorkflow(workflowId)
6151

@@ -102,9 +92,6 @@ export class WorkflowBlockHandler implements BlockHandler {
10292
const result = await subExecutor.execute(workflowId)
10393
const duration = performance.now() - startTime
10494

105-
// Remove current execution from stack after completion
106-
WorkflowBlockHandler.executionStack.delete(executionId)
107-
10895
logger.info(`Child workflow ${childWorkflowName} completed in ${Math.round(duration)}ms`)
10996

11097
const childTraceSpans = this.captureChildWorkflowLogs(result, childWorkflowName, context)
@@ -131,8 +118,6 @@ export class WorkflowBlockHandler implements BlockHandler {
131118
} catch (error: any) {
132119
logger.error(`Error executing child workflow ${workflowId}:`, error)
133120

134-
const executionId = `${context.workflowId}_sub_${workflowId}_${block.id}`
135-
WorkflowBlockHandler.executionStack.delete(executionId)
136121
const { workflows } = useWorkflowRegistry.getState()
137122
const workflowMetadata = workflows[workflowId]
138123
const childWorkflowName = workflowMetadata?.name || workflowId

0 commit comments

Comments
 (0)