Skip to content

Only tool and loopback cycles are legal

Rejecting every other cycle is what makes the forward graph acyclic. Loop membership is defined by reachability sweeps over that acyclic graph, so loosening this rule would make loop extent ill-defined rather than merely permissive.

The rule

Normative: this is the rule
  1. Cycle detection MUST ignore tool and loopback edges.
  2. A cycle formed only from those edge types MUST NOT refuse compilation.
  3. Any other cycle MUST refuse compilation.
  4. The graph that remains once the ignored edge types are removed is therefore acyclic, and rules that depend on that acyclicity can rely on it.

What it means

Cycle detection does not walk the graph as stored — it first removes every tool and loopback edge, then checks what is left for a cycle. A cycle is legal exactly when it disappears once those edge types are taken out, whatever mix of edge types formed it. The one case a mix does not save: a cycle built entirely from ordinary connections has nothing for the removal to take out, so it always refuses compilation.

Example

The same two-node shape, back and forth, once with both edges ordinary and once with the return edge a loopback:

Two edges back and forth, both ordinary connectionsrefused
[
  { "source": "node_a", "target": "node_b" },
  { "source": "node_b", "target": "node_a" }
]
The same shape, the return edge a loopbacklegal
[
  { "source": "iterator_1", "target": "node_b", "sourceHandle": "iterator_1-output-item" },
  { "source": "node_b", "target": "iterator_1", "targetHandle": "iterator_1-input-loop_back" }
]

The first refuses compilation with Circular dependency detected in workflow; the second compiles, because removing the loopback edge before checking leaves nothing but a single forward connection.

Why

Recorded under OPEN-25, OPEN-32.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · CMP-5 · changed in spec 1.0