fix(executor): condition inside parallel#3094
Merged
icecrasher321 merged 2 commits intostagingfrom Jan 31, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Collaborator
Author
|
@cursor review |
Contributor
Greptile OverviewGreptile SummaryFixed condition blocks to work correctly inside parallel branches by handling virtual block IDs with subscript notation (e.g., Key Changes:
How it works:
This ensures condition expressions evaluate using the correct data from their specific parallel branch rather than mixing data across branches. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Executor
participant ConditionHandler
participant collectBlockData
participant subflowUtils
participant executeTool
Note over Executor,executeTool: Condition Block Inside Parallel Branch
Executor->>ConditionHandler: execute(ctx, block: "cond₍0₎", inputs)
Note over ConditionHandler: Extract base ID from virtual ID
ConditionHandler->>subflowUtils: extractBaseBlockId("cond₍0₎")
subflowUtils-->>ConditionHandler: "cond"
ConditionHandler->>subflowUtils: extractBranchIndex("cond₍0₎")
subflowUtils-->>ConditionHandler: 0
Note over ConditionHandler: Find connection using base ID
ConditionHandler->>ConditionHandler: workflow.connections.find(conn.target === "cond")
ConditionHandler->>ConditionHandler: sourceConnection.source = "agent"
Note over ConditionHandler: Build virtual source ID for same branch
ConditionHandler->>subflowUtils: buildBranchNodeId("agent", 0)
subflowUtils-->>ConditionHandler: "agent₍0₎"
ConditionHandler->>ConditionHandler: Check blockStates.has("agent₍0₎")
ConditionHandler->>ConditionHandler: sourceBlockId = "agent₍0₎"
Note over ConditionHandler: Build evaluation context from branch data
ConditionHandler->>ConditionHandler: buildEvaluationContext(ctx, "agent₍0₎")
Note over ConditionHandler: Evaluate condition with branch context
ConditionHandler->>collectBlockData: collectBlockData(ctx, "cond₍0₎")
Note over collectBlockData: Map branch data to base IDs
collectBlockData->>subflowUtils: isBranchNodeId("cond₍0₎")
subflowUtils-->>collectBlockData: true
collectBlockData->>subflowUtils: extractBranchIndex("cond₍0₎")
subflowUtils-->>collectBlockData: 0
loop For each blockState
collectBlockData->>collectBlockData: blockData["agent₍0₎"] = state.output
collectBlockData->>subflowUtils: isBranchNodeId("agent₍0₎") && branchIndex === 0
subflowUtils-->>collectBlockData: true
collectBlockData->>subflowUtils: extractBaseBlockId("agent₍0₎")
subflowUtils-->>collectBlockData: "agent"
collectBlockData->>collectBlockData: blockData["agent"] = state.output
end
collectBlockData-->>ConditionHandler: {blockData, blockNameMapping, blockOutputSchemas}
ConditionHandler->>executeTool: function_execute(code, blockData, ...)
executeTool-->>ConditionHandler: {success: true, output: {result: true}}
Note over ConditionHandler: Find target using base ID
ConditionHandler->>ConditionHandler: workflow.connections.find(conn.source === "cond")
ConditionHandler-->>Executor: {conditionResult: true, selectedPath, selectedOption}
|
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
Condition blocks inside parallels.
Type of Change
Testing
Tested manually
Checklist