fix bug SKY-7319 - when the conditional block doesn't have any block inside, the workflow fails the DAG check (#4300)

This commit is contained in:
Shuchang Zheng
2025-12-16 01:29:57 +08:00
committed by GitHub
parent ce717146f3
commit 0572746608

View File

@@ -1349,8 +1349,11 @@ class WorkflowService:
return
if target not in label_to_block:
raise InvalidWorkflowDefinition(f"Block {source} references unknown next_block_label {target}")
adjacency[source].add(target)
incoming[target] += 1
# Only increment incoming count if this is a new edge
# (multiple branches of a conditional block may point to the same target)
if target not in adjacency[source]:
adjacency[source].add(target)
incoming[target] += 1
for label, block in label_to_block.items():
if isinstance(block, ConditionalBlock):