Repository navigation
fix(orchestrate): find handed-off planner descendants - #645
Open
Ehsan-hash wants to merge 2 commits into
Open
Ehsan-hash wants to merge 2 commits into
Ehsan-hash wants to merge 2 commits into
Conversation
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.
Fixes #641.
Why
crawlfinds running children beneath handed-off planners, butkill-treeskips those branches and can report that nothing is running. Agent-specific scopes also lose the parent link through a finished planner.What changed
Scope
Only running agents become cancellation targets. Existing CLI confirmation and direct parent-only filtering remain intact.
Blast Radius
This changes discovery and scoped selection for
kill-tree. The SDK cancellation call and authentication checks are unchanged.Verification
npx --yes bun@1.4.2 test: 211 tests pass in the orchestrate scripts directory. The regression fails on the original source.crawlandkill-tree --no-fetchpreviews use synthetic Git refs. Whole-tree and scoped previews find the child and still require-y. No live cloud cancellation was performed.AI assistance: Codex implementation and independent review.
Note
Medium Risk
Changes which agents kill-tree discovers and cancels; behavior is narrower in some scopes but broader under handed-off planners, with no change to SDK auth or cancellation APIs.
Overview
Fixes kill-tree agent discovery so it matches crawl: running workers under handed-off subplanners are included, and scoped
--agent-idselection still reaches those descendants when the planner link is no longer a direct parent.collectRunningAgentsInTreenow descends intohanded-offsubplanner branches (not onlyrunning), records parent links while walking, and attaches optionalancestorAgentIdson each victim with cycle protection.filterVictimsToSubtreekeeps the existing direct parent-child walk but also selects victims whose resolved ancestors include the scope root—so scoping by a finished planner or its upstream parent still targets nested running agents.Adds tree-traversal tests with a temporary Git remote fixture covering nested branches, completed tasks, unknown agents, and cyclic parent metadata.
Reviewed by Cursor Bugbot for commit 14f8155. Bugbot is set up for automated code reviews on this repo. Configure here.