Repository navigation
Conversation
forkTaskJoin() built its JOIN via generateJoinTask() without passing joinOn, so the task shipped with joinOn: []. The server evaluates the join with joinOn.stream().allMatch(...), and allMatch() short-circuits to true on an empty stream, so the JOIN reached COMPLETED on its first evaluation without waiting for any fork branch. Downstream tasks then ran while the branches were still in progress. Derive joinOn from the generated fork branches, taking the last task reference of each branch, so the JOIN blocks until every branch has finished. Reading it back off the ForkJoinTaskDef keeps it correct if forkTask() later emits more than one branch. factory.test.ts asserted joinOn: [] and so locked in the broken behaviour; it now expects the branch's last task reference. Added cases for a multi-task branch and for an empty fork task list. Fixes conductor-oss#135
|
Closing this, since I cannot move it forward from a fork. Noting the CI for anyone who finds this later: the red checks are not the change. The failing jobs are the ones that need repository secrets, the The bug in #135 is still live on |
Fixes #135.
Problem
forkTaskJoin()builds its JOIN throughgenerateJoinTask()without passingjoinOn, so the generated task carriesjoinOn: []:The server evaluates a JOIN with
joinOn.stream().allMatch(...), andallMatch()short-circuits totrueon an empty stream. So the JOIN reachesCOMPLETEDthe first time it is evaluated, without waiting for any fork branch. The branches keep running, but the workflow moves on past the join, which is the one thing a JOIN exists to prevent.As reported in #135, against Conductor OSS 3.32.0-rc.9 with a 10s WAIT branch:
Fix
Derive
joinOnfrom the fork branches that were just generated, taking the last task reference of each branch:Reading the branches back off the
ForkJoinTaskDefrather than off the flatforkTasksargument means this stays correct ifforkTask()later emits more than one branch (the multi-branch limitation tracked in #94) - no second fix needed there.An empty fork task list still yields
joinOn: [], since there is nothing to wait for.Tests
factory.test.tsassertedjoinOn: []and therefore locked in the broken behaviour; it now expects the branch's last task reference. Two cases added: a multi-task branch, and an empty fork task list.Verified both directions:
Should return a tuple with both fork and joinandShould join on the last task of each fork branchfail (Expected ["forkTaskJoin"],Received []).npm run test:unit-> 1568 passed. The single failure insrc/agents/__tests__/skill.test.ts(read_skill_file worker) reproduces on a clean checkout ofmainand is unrelated to this change.npx eslintclean on both touched files.Diff is +26/-5 across two files.