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
- Clone a repository whose default branch is
development, so the clone hasrefs/remotes/origin/HEAD -> refs/remotes/origin/development. - On the remote, make
mainthe default branch and deletedevelopment. - In the clone, run
git fetch --prune. Git does not updateorigin/HEADon fetch, so it is now a dangling symref pointing at the deleted branch. - Start a thread in New worktree mode without picking a base branch, for example through the MCP tools or
t3 thread startas an agent would.
Git-only reproduction of the repository state:
git init -q --bare -b development remote.git
git clone -q remote.git seed && cd seed && git commit -q --allow-empty -m one && git push -q origin development development:main && cd ..
git clone -q remote.git clone
git -C remote.git symbolic-ref HEAD refs/heads/main && git -C seed push -q origin --delete development
git -C clone fetch -q --prune
git -C clone symbolic-ref refs/remotes/origin/HEAD # still refs/remotes/origin/development
git -C clone rev-parse --verify -q origin/HEAD || echo danglingExpected behavior
The worktree is created from the remote's actual default branch (main). If the stored default can't be resolved, T3 falls back to the remote's real HEAD or asks for a base, instead of failing.
Actual behavior
Every such thread fails before the agent starts:
Workspace preparation failed during provision worktree: Git command failed in GitVcsDriver.createWorktree.createBranch (/home/agent/Projects/Thalvi): git branch failed (ref_not_found)
GitVcsDriver.resolveDefaultBranchName (and listRefs' defaultRef) read git symbolic-ref refs/remotes/origin/HEAD. That succeeds for a dangling symref and returns development, which is then used as the worktree base without checking that refs/remotes/origin/development exists (remoteBranchExists is there, but not used on this path).
Related: retrying such a failed thread ran the agent in the project root without a worktree (worktreePath null, the checkout switched to the thread's branch), so a retry can collide with other threads in the same checkout.
Impact
Minor bug or occasional failure
Version or commit
0.1.10-nightly.20261112.4606 (server, headless systemd user service)
Environment
Ubuntu 26.04, git 2.53.0, T3 server as a background service; threads started by a linked environment's agents.
Logs or stack traces
See actual behavior. Workarounds: `git remote set-head origin --auto` per clone, or `git config remote.origin.followRemoteHEAD always` (git ≥ 2.48), so every fetch updates `origin/HEAD`.
Related to #25719 / #35103, which fix the web branch picker's seeding while a project is still cloning. This report is the server-side path with a dangling `origin/HEAD` after the default branch changed, which #35103 doesn't touchScreenshots, recordings, or supporting files
No response
Workaround
Run git remote set-head origin --auto in the affected clone; new worktree threads work again right away. To keep it from recurring, set git config --global remote.origin.followRemoteHEAD always (git ≥ 2.48), so every git fetch updates origin/HEAD when the remote's default branch changes. A thread that already failed at workspace preparation should be started fresh rather than retried, because a retry runs without a worktree in the project root.
Activity