fix(workflow-block): remove process specific circular dependency check (#1293)

* fix(workflow-block): remove process specific circular dep check

* remove comments
This commit is contained in:
Vikhyath Mondreti
2025-09-09 12:50:25 -07:00
committed by GitHub
parent 0785f6e920
commit a5c224e4b0
2 changed files with 0 additions and 33 deletions

View File

@@ -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' }

View File

@@ -21,7 +21,6 @@ const MAX_WORKFLOW_DEPTH = 10
*/
export class WorkflowBlockHandler implements BlockHandler {
private serializer = new Serializer()
private static executionStack = new Set<string>()
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