Repository navigation
Parallel worktree creation hits the fixed 5-minute git timeout and leaves orphan worktrees that block retry #15541
Description
Activity
Note
Grok responding on behalf of Julius.
Triage
Thanks for the traces and for digging into the leftover checkouts, @areidyOTH. I checked this against current
main, which has the same worktree code as nightly73799330, including #15326. The timeout and the leftover worktrees are real. Two details differ from the report: the semaphore isn't what let all seven adds run at once, and Retry only fails the way you describe when the launch named the branch.What I found
The 5-minute limit is fixed, and nothing caps these adds.
GitVcsDriver.createWorktreealways passesWORKTREE_ADD_TIMEOUT_MS(300_000) torunGitCommand, which matches the trace:runGitCommandis interrupted at300001ms. No setting changes that limit.gitProcessesis a global semaphore of 8, but only commands with a timeout of 30 seconds or less take a slot. Longer or unlimited timeouts skip it on purpose so long checkouts don't starve short commands like status (#11405).git worktree adduses 300 seconds, so it never takes a slot. All seven adds ran together because nothing limits them, not because the limit is 8.A timed-out add is missed by the cleanup from #15326.
onWorktreeClaimedruns only afterexecuteGitreturns, and the launch service removes a worktree only after that callback has stored its path. A timeout ends insideexecuteGit, so the path is never stored andgit worktree removenever runs, even though git has usually registered the worktree by then. Your trees were complete because they were killed near the end of a roughly 5-minute checkout. A kill earlier in the checkout could leave a partial tree that's orphaned the same way.Retry reuses a worktree only if the thread recorded one.
retryPreparationswitches toexisting_worktreeonly when bothworktreePathandbranchare set. Otherwise it runs the original strategy again.- If the launch named the branch, as your HTTP launches did (
t3/…), the retry runsgit worktree add -bwith the same branch and a path derived from it. Both already exist, so the retry fails. I confirmed that from the code, not in the app. - If the launch didn't name a branch, the server picks a new
t3code/<8 hex>name on each attempt, so Retry creates a second worktree and the first orphan stays behind.
Your
--existing-worktreerelaunch worked because that strategy never runsgit worktree add.Related
#11735 also leaves a worktree behind, but there the failure happens after
git worktree addhas returned, so the path is recorded and the #15326 cleanup can remove it. #11099 asks to attach a thread to an existing branch, which wouldn't stop concurrent adds from timing out.Likely fix area
- Concurrency: one option is to limit or queue
git worktree addper repository, separate from the short-command semaphore. Another is to time out on lack of checkout progress instead of total runtime. - Timeout cleanup: either adopt a finished checkout that matches the requested branch and ref, or remove the worktree and branch git already registered.
- Retry: handle an existing branch and worktree when the failed attempt never recorded a path.
A maintainer will decide on the fix direction.
- If the launch named the branch, as your HTTP launches did (
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.via-triageFiled through npx t3 triageFiled through npx t3 triage
on Oct 4, 2026
What happened
Seven new-worktree threads were launched together against one project. Six of them failed with "Workspace preparation failed during provision worktree: Git command failed in GitVcsDriver.createWorktree (…): Git command timed out." The user saw them as failed threads. Only one of the seven threads started.
Diagnosis
git worktree add -b <branch> <path> <ref>against the same repository at the same time (traces show starts between 06:58:07 and 06:59:04 UTC).fuseblk(NTFS) mount, and worktrees are created on ext4 under~/.t3/worktrees.WORKTREE_ADD_TIMEOUT_MS = 300_000(apps/server/src/vcs/GitVcsDriverCore.ts:50;runGitCommandwas interrupted at 300000 ms). The seventh succeeded at 293 s.gitProcesses = Semaphore.makeUnsafe(8)lets all seven worktree adds run concurrently, so starting more launches makes every one of them slower. The timeout is per command and can't be configured.t3/…branches exist, and each is complete and clean (git ls-files= 122,629 files,git status --porcelainempty). T3 marks the thread as failed but leaves the worktree and branch behind with no thread attached.git worktree add -b <same branch> <same path>, and both the branch and the path already exist. (This comes from readingcreateWorktree; not tested.)Possible directions:
worktree addper repository.GIT_PROGRESS_DELAY=0).Steps to reproduce
git worktree listlater shows every worktree created successfully.Version
0.0.46-nightly.20261004.2644 (desktop AppImage, commit 7379933)
Environment
Linux x64 6.x/7.0.0-38-generic, Node v26.8.2, git 2.53.0, claude 2.1.289; repo on fuseblk (NTFS), worktrees on ext4
Evidence
Related issues
#11735 (worktree creation fails at configureBaseRef and leaves an orphan worktree and branch): it also leaves an orphan, but there the cause is a locked
.git/config, not a timeout under concurrency. #11099 (attach to an existing branch) would also cover the retry case.Fix applied or workaround
The user's own orchestration recreated the worktrees one at a time and relaunched the six threads with
--existing-worktreeon the leftover paths. No T3 changes were made.Filed by
Claude Code (claude-opus-5-5) via
t3 triage