fix(workflow): reject non-JoinNode fan-in at validation time#1041
Open
wolo-lab wants to merge 2 commits into
Open
fix(workflow): reject non-JoinNode fan-in at validation time#1041wolo-lab wants to merge 2 commits into
wolo-lab wants to merge 2 commits into
Conversation
A plain (non-Join) node with two or more unconditional incoming edges is activated once per completed predecessor. The scheduler keys bookkeeping (runsByName / runCancels) by node name with no already-running guard, so the second activation overwrites the first while it is still running: mixed outputs (ErrMultipleOutputs / wrong output) and a lost cancel func. adk-python serializes per-node executions (skip-if-RUNNING) and allows plain fan-in, but adk-go has no such serialization yet. Until it does, reject the graph at construction with a clear "not yet supported" error instead of corrupting the run. Only unconditional (Route == nil) incoming edges are counted, so conditional fan-in and loop-back back-edges — whose predecessors don't all fire together — are not rejected. JoinNode (barrier-gated) fan-in is exempt. Add validation tests (diamond rejected; JoinNode diamond, loop-back, and conditional fan-in allowed) plus an e2e check that New() surfaces it.
hanorik
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In a diamond like Start → A, A → B, A → C, B → D, C → D where D is a plain node (not a JoinNode), D has two predecessors. When B and C each complete, the scheduler schedules D twice.
The scheduler keys its per-node bookkeeping (runsByName / runCancels) by node name and has no "already running" guard, so the second activation of D overwrites the first while it's still running:
JoinNode fan-in is safe (it's barrier-gated — it waits for all predecessors and gets the aggregated input), but nothing stopped a plain node from being used as a fan-in target, so the corruption happened silently.
How adk-python handles it (for context)
adk-python's v2 graph engine allows plain fan-in: it buffers a trigger per predecessor and serializes per-node execution (_schedule_ready_nodes skips a node already RUNNING), so a plain fan-in node runs once per trigger, never concurrently. adk-go has no such per-node serialization yet.
Solution
Rather than serialization, reject the unsupported graph at construction with a clear, honest error (ErrUnsupportedFanIn: "non-JoinNode fan-in is not yet supported ... use a JoinNode to converge branches"). This turns silent state corruption into a fail-fast build error, and the message signals it's a temporary limitation. When per-node serialization lands later, the check can be removed.
The check counts only unconditional (Route == nil) incoming edges, so it rejects exactly the diamond case while leaving legitimate graphs alone: