-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(executor): condition inside parallel #3094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cursor review |
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}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Summary
Condition blocks inside parallels.
Type of Change
Testing
Tested manually
Checklist