You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: New worktree threads wait ~0.5 s for the index refresh's second to end, even in small repos #41624
Use a small repository (here 1,525 tracked files, 11 MB) with new threads in worktree mode.
Start a new worktree thread.
Read the refreshNewWorktreeIndex span in server.trace.ndjson.
Expected behavior
In a small checkout, the agent starts as soon as the worktree exists. Re-reading racily clean entries costs a few tens of milliseconds per status, which is less than the wait that avoids it.
Actual behavior
refreshNewWorktreeIndex took a median of 553 ms (range 43 to 1,002 ms, 17 launches, T3 0.1.10, macOS, Git 2.56.0), and the agent waits for it. Each update-index --refresh pass took only 36 to 86 ms. In 15 of the 17 launches the time went to the sleep in step 3: the first refresh finished in the checkout's own second, so T3 waited for the next second and refreshed again.
What the wait buys in this repo: git --no-optional-locks status took 30 to 40 ms in a fresh worktree with racily clean entries and 10 ms after the refresh in a later second.
PR #21341 already says a 1,000-file checkout always waits, and the sleep is still on main (GitVcsDriverCore.ts, refreshNewWorktreeIndex). For repos like t3code (28k files), the first refresh takes 1.3 to 1.8 s, so it never waits.
Suggested fix
Skip the second refresh when the first pass was fast, for example under 100 to 200 ms. A fast first pass means the checkout is small, so the racily clean entries cost little on each later status, and correctness does not change. Large checkouts keep today's behavior.
Impact: Minor bug or occasional failure Version: 0.1.10 (the code is unchanged on main as of Nov 23 2026)
Activity