fix(parallel): add parallel sentinel to make parallel-parallel and parallel-loop work correctly#2593
Merged
icecrasher321 merged 4 commits intostagingfrom Dec 27, 2025
Merged
Conversation
…rallel-loop work correctly
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile Summary
Important Files Changed
Confidence score: 4/5
Sequence DiagramsequenceDiagram
participant User
participant Executor
participant DAGBuilder
participant ParallelConstructor
participant EdgeConstructor
participant NodeOrchestrator
participant ParallelOrchestrator
participant ParallelExpander
participant BlockExecutor
User->>Executor: "Execute workflow"
Executor->>DAGBuilder: "Build DAG"
DAGBuilder->>ParallelConstructor: "Create parallel sentinels"
ParallelConstructor->>DAGBuilder: "Return parallel start/end nodes"
DAGBuilder->>EdgeConstructor: "Wire edges"
EdgeConstructor->>DAGBuilder: "Return wired DAG"
DAGBuilder->>Executor: "Return completed DAG"
Executor->>NodeOrchestrator: "Execute parallel sentinel start"
NodeOrchestrator->>ParallelOrchestrator: "Initialize parallel scope"
ParallelOrchestrator->>ParallelExpander: "Expand parallel branches"
ParallelExpander->>ParallelOrchestrator: "Return entry nodes"
ParallelOrchestrator->>NodeOrchestrator: "Return scope with pending nodes"
NodeOrchestrator->>Executor: "Return ready nodes"
loop For each parallel branch
Executor->>NodeOrchestrator: "Execute branch node"
NodeOrchestrator->>BlockExecutor: "Execute block"
BlockExecutor->>NodeOrchestrator: "Return block output"
NodeOrchestrator->>ParallelOrchestrator: "Handle branch completion"
ParallelOrchestrator->>NodeOrchestrator: "Return completion status"
NodeOrchestrator->>Executor: "Return node result"
end
Executor->>NodeOrchestrator: "Execute parallel sentinel end"
NodeOrchestrator->>ParallelOrchestrator: "Aggregate parallel results"
ParallelOrchestrator->>NodeOrchestrator: "Return aggregated results"
NodeOrchestrator->>Executor: "Return final output"
Executor->>User: "Return workflow result"
|
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
Contributor
There was a problem hiding this comment.
Additional Comments (1)
-
apps/sim/executor/utils/subflow-utils.ts, line 70-73 (link)style: TSDoc comment uses example notation instead of proper
@exampletagNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
13 files reviewed, 3 comments
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.
Summary
Parallel sentinel node to make sure DAG explosion connects to the following subflow correctly. Also prevents copilot from adding nested subflows.
Refactor to only have runtime explosion + parallel template node:
At DAG build time, only a single template node (branch-0) is created for each block inside a parallel, along with parallel_sentinel_start and parallel_sentinel_end nodes that wrap the parallel's entry/exit points.
At runtime, when parallel_sentinel_start executes, it resolves the actual branch count (from count or collection size), then the ParallelExpander clones the template to create all N branch nodes, wires internal edges by replicating the template's edge pattern, and connects sentinel_start → all entry branches and all terminal branches → sentinel_end.
The parallel_sentinel_end waits for all branches to complete, aggregates their results, and then allows the workflow to continue to the next block.
Fixes #2590
Type of Change
Testing
Tested manually
Checklist