Skip to content

Commit ecc61ba

Browse files
committed
fix(workflow-block): remove process specific circular dep check
1 parent 0785f6e commit ecc61ba

2 files changed

Lines changed: 3 additions & 30 deletions

File tree

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

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

53-
// Clear the static execution stack
54-
55-
;(WorkflowBlockHandler as any).executionStack.clear()
53+
// No cycle detection state to clear
5654

5755
// Setup default fetch mock
5856
mockFetch.mockResolvedValue({
@@ -102,19 +100,7 @@ describe('WorkflowBlockHandler', () => {
102100
)
103101
})
104102

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-
})
103+
// Cycle detection removed; relying on depth/timeout
118104

119105
it('should enforce maximum depth limit', async () => {
120106
const inputs = { workflowId: 'child-workflow-id' }

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

Lines changed: 1 addition & 14 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,8 +92,7 @@ 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)
95+
// No-op: execution id used only for logging
10796

10897
logger.info(`Child workflow ${childWorkflowName} completed in ${Math.round(duration)}ms`)
10998

@@ -131,8 +120,6 @@ export class WorkflowBlockHandler implements BlockHandler {
131120
} catch (error: any) {
132121
logger.error(`Error executing child workflow ${workflowId}:`, error)
133122

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

0 commit comments

Comments
 (0)