Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Have two Git repositories,
aandb, each with default branchmainand a branchreleasethat is ahead ofmain. - Add
aas a project and addbto it under Settings → Projects → Repositories. Check outreleasein both. - In a thread of
a(project checkout, onrelease), have the agent calldelegate_taskwithisolation: "worktree". - In the child's workspace, compare the start of each worktree:
git -C <task folder>/a log -1andgit -C <task folder>/b log -1.
Expected behavior
b starts from release. docs/user/multi-repo-projects.md says:
Each repository starts from the thread's base branch where it has a branch of that name, and from its own default branch otherwise.
Actual behavior
a starts from the parent's commit on release, but b starts from main. Nothing in the delegate_task result or the child's context says so, so a child working across both repositories can build on mismatched code without noticing.
I saw this in a project with one main repository and four added ones. One added repository had a local branch with the same name as the branch checked out in the main repository, and that branch was also checked out there. Its child worktree was still created from its default branch (the reflog says Created from master).
The cause, from reading main at 2514a5c:
OrchestratorMcpService.tsresolves the parent'sHEADand sends only the SHA:workspaceStrategy = { type: "worktree", baseRef: base.commitSha, startFromOrigin: false }.ThreadLaunchService.tspasses that on asbaseBranch: input.workspaceStrategy.baseRef.repositoryStartinTaskFolders.tslooks forrefs/heads/<wanted>orrefs/remotes/origin/<wanted>in each other repository. A SHA ofais never a branch name inb, so it always falls back to the default branch.
So the same-name rule cannot apply to a delegated child, whichever branch the parent is on.
From the same code (read, not reproduced): repositoryStart gets repository.path, the project's own copy of b. If the parent is itself a worktree thread with commits in its worktree of b, the child gets the parent's commit of a but not the parent's commits of b.
Possible directions:
- Keep the parent's branch name next to the SHA, so the documented rule works. When the parent has its own worktree of
b, start from that worktree'sHEAD, asaalready does. - Return each repository's path and base ref in the
delegate_taskresult, so a fallback to the default branch is visible.
Impact
Minor bug or occasional failure
Version or commit
0.1.12-nightly.20261124.5209. The same code is on main @ 2514a5c.
Environment
macOS 27.2.1 (arm64), T3 Code desktop (Nightly). Parent thread on Claude, child on Codex. The base is chosen by the server, so the provider should not matter.
Workaround
Use t3_thread_launch with a branch name as baseRef, which the same-name rule can match. That thread is not a child and does not wake the caller. Otherwise, check every repository's base before the child starts work.
Related issues
- fix(server): delegate_task worktree isolation works in a project folder holding several repos #42261 covers a plain project folder (base
HEAD). This one is about a project that is itself a Git repository. That PR also notes thatdelegate_taskcannot choose repositories. - Discussion delegate_task: choose the base of an isolation "worktree" child, like t3_thread_launch baseRef/startFromOrigin #32917 asks to choose the base of a child, and discussion delegate_task: run the child in another project or worktree on the same environment #17415 asks for
workspaceStrategyondelegate_task. This issue is about the default base for the added repositories. - [Bug]: delegate_task cannot start a child in another local project, and t3_thread_launch ignores a local delegatedFrom #30329 is about children in another registered project.
Investigated and drafted by Claude Opus 5.5 in T3 Code. Filed at the account owner's request.
Activity