fix(parallel): remove broken node-counting completion + resolver claim cross-block#4045
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates node orchestration and parallel scope initialization to no longer compute/pass an expected terminal-node count, and adjusts Reviewed by Cursor Bugbot for commit c4ee839. Configure here. |
Greptile SummaryThis PR removes the broken node-counting completion detection for parallel blocks (where Confidence Score: 5/5Safe to merge — the counting-based completion removal is architecturally correct and all 670 executor tests pass. Both fixes are well-scoped: removing the broken node-count aggregation path eliminates a class of misfires on conditional branches, and the OUTPUT_PROPERTIES early-return in the resolver correctly separates result-access from iteration-context resolution. No P0/P1 findings. New tests cover named-reference resolution from outside a parallel, cross-block paths, nested paths, and InvalidFieldError cases. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/sim/executor/orchestrators/parallel.ts | Removes completedCount/totalExpectedNodes from ParallelScope initialization; handleParallelBranchCompletion now returns void and only stores output — aggregation exclusively driven by sentinel-end. |
| apps/sim/executor/orchestrators/node.ts | Drops the allComplete guard around aggregateParallelResults in handleParallelNodeCompletion; initializeParallelScope calls no longer pass nodesInParallel. |
| apps/sim/executor/variables/resolvers/parallel.ts | Adds OUTPUT_PROPERTIES set {'result','results'} checked before KNOWN_PROPERTIES; resolveOutput reads block output stored by aggregateParallelResults; availableFields in InvalidFieldError updated to include 'result'. |
| apps/sim/executor/variables/resolvers/parallel.test.ts | Adds a full describe block for named parallel references covering result/results resolution from outside, nested paths, cross-block access, and InvalidFieldError for unknown properties. |
| apps/sim/executor/execution/state.ts | Removes completedCount and totalExpectedNodes from ParallelScope interface, consistent with the orchestrator changes. |
| apps/sim/executor/types.ts | Minor type cleanup related to the parallel scope changes. |
| apps/sim/executor/orchestrators/parallel.test.ts | Updates initializeParallelScope call to drop the nodesInParallel argument, keeping test consistent with the new signature. |
| apps/sim/executor/utils/iteration-context.test.ts | Adds cross-block test cases for the iteration context utilities. |
Sequence Diagram
sequenceDiagram
participant NE as NodeExecutionOrchestrator
participant PO as ParallelOrchestrator
participant PR as ParallelResolver
participant State as BlockState
Note over NE,State: Branch node completes
NE->>PO: handleParallelBranchCompletion(ctx, parallelId, nodeId, output)
PO->>PO: extractBranchIndex(nodeId)
PO->>PO: scope.branchOutputs.set(branchIndex, output)
Note right of PO: Returns void — no counting logic
Note over NE,State: Sentinel-end fires (sole aggregation trigger)
NE->>NE: handleParallelSentinel(ctx, node, 'end', parallelId)
NE->>PO: aggregateParallelResults(ctx, parallelId)
PO->>State: setBlockOutput(parallelId, { results })
PO-->>NE: { allBranchesComplete: true, results, totalBranches }
Note over PR,State: Cross-block resolution (new fix)
PR->>PR: OUTPUT_PROPERTIES.has('result'|'results') = true
PR->>PR: resolveOutput(targetParallelId, pathParts, ctx)
PR->>State: getBlockOutput(targetParallelId)
State-->>PR: { results: [...] }
PR-->>PR: return output.results
Reviews (2): Last reviewed commit: "fix resolver claim" | Re-trigger Greptile
|
bugbot run |
|
@greptile |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c4ee839. Configure here.
Summary
totalExpectedNodes = branchCount * allNodesInParallelto detect completion, which is wrong when branches have conditional paths (error edges, conditions)Type of Change
Testing
All 670 executor tests pass. Tested with parallel blocks containing error edges. Added tests for cross-block case.
Checklist