fix: match root planner by exact name in kickoff dedupe#113
Merged
poteto merged 2 commits intoJun 6, 2026
Conversation
findActiveRootPlanner adopted any active cloud agent whose name merely
started with the kickoff slug (`name.startsWith(rootSlug)`). Because the
kickoff command names every root planner exactly `${rootSlug}-root`, a
slug that is a prefix of another goal's slug would wrongly adopt the
unrelated planner: kicking off goal `auth` while `auth-ui-root` is
active matched `"auth-ui-root".startsWith("auth")`, silently attaching a
fresh run to the wrong goal's planner instead of starting a new one.
Match the deterministic canonical name `${rootSlug}-root` exactly. Adds
a regression test asserting a prefix-only slug overlap does not adopt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
|
thanks! |
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
orchestrate kickoffis meant to be idempotent: if a recent root planner for the same goal is already running, it adopts that agent instead of spawning a duplicate. But the dedupe infindActiveRootPlanneradopts an active planner belonging to a different goal when one slug is a prefix of another.Kicking off goal
authwhile a planner for goalauth-ui(agent namedauth-ui-root) is active printsadopting <auth-ui agent>and attaches the new run to the wrong goal's planner. The intendedauthrun never starts, and the operator silently lands in an unrelated orchestration.Root cause
The kickoff action names every root planner deterministically as
`${rootSlug}-root`(cli/task.ts), but the dedupe scan matched with a bare prefix check:"auth-ui-root".startsWith("auth")istrue, so a slug that is a prefix of another goal's slug collides. Non-root task agents use a different scheme (`${rootSlug}/${name}`), so only root planners are affected — but any two goals where one slug prefixes the other will cross-adopt.Fix
Match the canonical planner name exactly. Since the name is fully deterministic, exact equality is both correct and the tightest possible check:
Surgical, one-line behavioral change plus a clarifying comment. No other call sites or naming paths are touched.
Test
Added a regression test to
__tests__/kickoff-dedupe.test.ts: an activerefactor-ui-rootplanner must not be adopted when kicking off slugrefactor(prefix overlap), assertingfindActiveRootPlanner(...)returnsnull.startsWithcheck, the new test fails —findActiveRootPlannerreturns the unrelatedbc-refactor-uiagent instead ofnull.bun test→ 208 pass / 0 fail;tsc --noEmitclean.Repro
Note
Low Risk
Small behavioral fix in kickoff idempotency with a targeted regression test; no auth or data-path changes.
Overview
Fixes kickoff dedupe so
orchestrate kickoffonly adopts a running root planner for the same goal, not a different goal whose slug happens to prefix yours.findActiveRootPlannernow matches the canonical agent name`${rootSlug}-root`with equality instead ofname.startsWith(rootSlug). That stops cases like kicking offauthfrom silently adopting an activeauth-ui-rootplanner and skipping the intended run.A regression test asserts that an active
refactor-ui-rootplanner is not adopted when looking up slugrefactor.Reviewed by Cursor Bugbot for commit 8b2194b. Bugbot is set up for automated code reviews on this repo. Configure here.