Repository navigation
delegate_task: run a child in an existing worktree of the project (isolation "existing_worktree") #31666
rianradeck
started this conversation in
Ideas
Replies: 1 comment
|
Yeah, I need this too. My case: an orchestrator thread reviews six PRs at once, one The internals already allow it: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem or use case
I keep one worktree per task under a fixed folder (
~/.agents/worktrees/<task>; with several repos,~/.agents/worktrees/<task>/<repo>). Every harness I use looks there. The worktree is created once from the remote integration branch, may already have setup done, and is removed after the branch is merged.From a T3 thread, I want to hand part of that task to a subagent that works in that same worktree. Today
delegate_taskoffers two choices:isolation: "shared": the child works in the parent's checkout. That checkout is usually not the task worktree.isolation: "worktree": T3 creates a new checkout from the parent's commit. It is not the task worktree, and it lives outside the folder the other tools use.The workaround is to name the worktree path in the task prompt with
isolation: "shared". The child is still bound to the parent's checkout, so T3's diff, branch label and cleanup follow the wrong folder. It also goes against the delegation guidance T3 gives agents ("never make a child's checkout in the shell or in the task").t3_thread_launchcan bind an existing worktree, but it creates a top-level thread: no lineage, no completion wake, notask_status.Existing capability this builds on
t3_thread_launchalready acceptsworkspaceStrategy: { type: "existing_worktree", worktreePath }and checks that the path is a worktree of the project (assertProjectWorktree).delegated_task.requestcommand already accepts the sameworkspaceStrategyunion, includingexisting_worktree. The orchestrator defers the child's start and passes the strategy toprepareRun, which already handles it.delegate_taskmaps onlyisolation: "worktree"to a strategy (feat(server): run delegated tasks in separate worktrees #19102), so the MCP tool cannot express the third case.Proposal
Add one value to
delegate_task'sisolation:"existing_worktree", with a requiredworktreePath. The server:worktreePathis a linked worktree of the child's project, the same checkt3_thread_launchuses. Otherwise it returnsinvalid_requestand creates no child.isolation: "shared".delegated_task.requestwithworkspaceStrategy: { type: "existing_worktree", worktreePath }.Defaults stay as they are. The lineage, wake, status, cancellation and mode-ceiling behavior stays the same as for other delegated tasks.
Scope
Questions for maintainers
isolationvalue the right shape, or shoulddelegate_taskaccept the sameworkspaceStrategyobject thatt3_thread_launchtakes?t3_thread_launch+existing_worktreedoes today?assertProjectWorktreeon the first request, skipped on receipt replay (asisolation: "worktree"does), enough?If the direction is fine, I can open a focused PR: contract, server check, tests and the
delegate_tasksection ofdocs/orchestration-v2/orchestrator-mcp-server.md.All reactions