Repository navigation
fix(swarm): keep coordinator cancellation terminal - #4244
Merged
ruvnet merged 1 commit intoOct 17, 2026
Merged
Conversation
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
ruvnet
added a commit
to Tong-bit-art/ruflo
that referenced
this pull request
Oct 17, 2026
…lict unified-coordinator.ts conflicted in three spots: ruvnet#4244 (already on main) replaced the "capture task.status in a wasTerminal var, mutate unconditionally" pattern with an upfront `!isTaskSettled(task)` guard that skips the whole handler body for an already-settled task (fixing a double-processing bug the old pattern had: duplicate metric increments and duplicate emitted events for a late/duplicate message). This PR's `wasTerminal` captures were reading task.status at a point where main's guard already guarantees non-terminal, so they were always false/true trivially. Resolution: keep main's guard/fencing behavior as-is, drop the now-redundant `wasTerminal` variable, and make the `releaseDomainAgent` calls unconditional within the already-guarded block — preserving this PR's domain-pool-release fix without reintroducing the double-processing bug ruvnet#4244 fixed. Verified: full @claude-flow/swarm test suite (26 files, 321 tests) passes, including coordinator.cancellation.test.ts and domain-pool-agent-release.test.ts from both lineages. Co-Authored-By: RuFlo <ruv@ruv.net>
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.
Problem and change
UnifiedSwarmCoordinator.cancelTask()sent atask_failnotification to its assigned agent's bus subscription. That subscription interpreted the notification as a worker failure report and retried the task after cancellation returned. With no retries remaining, cancellation instead became a failure and incremented failure counters. Cancelling the old task again could also release an agent already assigned to new work.Set the cancellation state before yielding to the bus, make cancellation of settled tasks idempotent, and ignore completion/failure reports for cancelled, completed, or failed tasks. This preserves the cancelled verdict and prevents duplicate completion accounting.
Validation
1882006a02487590c8c66a7eec8d7504f6af33c3, the eight-case regression suite has 6 failures / 2 passes. Candidate: 8/8 pass.git diff --checkpasses.This fixes the canonical coordinator's cancellation lifecycle. Existing wait-timeout behavior remains unchanged: a wait timeout does not stop a worker, and late reports can still clean up that assignment. No new dependency or public method is introduced.