Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate. (Closest: Removing an external worktree leaves its T3 thread unable to start #38964, Mix git deps under gitignored deps/ get worktrees; mix deps.get replaces them and the thread can't be restored #40911; neither covers this.)
- I included enough detail to reproduce or investigate the problem.
Area
Server: worktree restore on turn start (restoreMissingWorktree → TaskFolders.restore)
Steps to reproduce
- Have a project whose root repo contains a second, gitignored git repository that T3 discovers as a project folder (here
DerivedData.noindex/site, a clone that a publish script keeps). - Start a worktree thread. T3 creates the root worktree and, inside it, a linked worktree of the nested repo at
<worktree>/DerivedData.noindex/site(its.gitis a file). - In that thread, run a project script that checks
[ -d "$OUT/.git" ]and, finding no.gitdirectory, doesrm -rf "$OUT"andgit clones the nested repo there instead. The folder is now a full clone, not a linked worktree. - Send another message in the thread.
Expected behavior
The turn starts. The thread's own worktree is intact. Failing that, the error should name the folder that's in the way and say what to do.
Actual behavior
Every new turn fails before the agent starts, with a banner and a red "Couldn't recreate thread workspace" message:
Could not recreate the worktree for branch 't3/…' at ~/.t3/worktrees//t3-….
The path it names is the thread's root worktree, which exists and is fine. The real reason is only in the server trace, from TaskFolders.restore:
TaskFolderError: ~/.t3/worktrees//t3-…/DerivedData.noindex/site holds a checkout that is not a worktree of /DerivedData.noindex/site. Move it away to restore the thread's worktree.
restoreMissingWorktree wraps that in WorktreeRecreateError with the thread's worktreePath (restoreMissingWorktree.ts#L231), and its message getter drops the cause, so the actionable detail from TaskFolders.ts#L1669 never reaches the UI.
Impact
The thread can't be resumed, and the message points at the wrong folder (one that plainly exists), so it reads as T3 losing the worktree. It happened to two threads in one project on the same day; in both, the agent had run the publish script in the thread's worktree. Two more of that project's worktrees were in the same state.
Version or commit
T3 Code (Beta) 0.1.12, commit ca81b7b
Environment
macOS 26.7.3, Apple silicon; Claude Code provider.
Logs or stack traces
TaskFolders.restore TaskFolderError: <worktree>/DerivedData.noindex/site holds a checkout that is not a worktree of <project>/DerivedData.noindex/site. Move it away to restore the thread's worktree.
restoreMissingWorktree WorktreeRecreateError: Could not recreate the worktree for branch 't3/…' at <worktree>.
orchestrationV2.providerTurnStart.start WorktreeRecreateError (same)
ProviderTurnStartService.start ProviderTurnStartError
Workaround
Delete the clone at <worktree>/DerivedData.noindex/site; going by the restore code, the next turn then recreates the nested worktree. On our side the script now keeps its clone outside the project. From reading TaskFolders.restore, listing the folder under ignoreRepositories in t3.json should also let the thread resume, since a clone there is dropped from the task folder; I haven't tried it.
Suggestions
The main problem is the message: it names the thread's root worktree, which exists, and drops the actionable cause.
- Show the cause's detail in the banner, or carry the failing checkout's path in
WorktreeRecreateErrorrather than the thread's root. - Possibly: for a discovered (not explicitly added) nested repo, let the turn start with a warning when its checkout was replaced, as is already done for
ignoreRepositoriesclones.
Activity
djinna commentedon Nov 30, 2026
Confirmed the workaround: after deleting the clone at
<worktree>/DerivedData.noindex/site, the next message in the affected thread went through, and T3 recreated the nested repo's linked worktree there (.gitis a file pointing at the main repo'sworktrees/entry again, no longer prunable).