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]: defaultThreadEnvMode: "worktree" — new threads reuse existing worktree instead of creating isolated ones #1830
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
Summary
When defaultThreadEnvMode is set to "worktree" in ~/.t3/userdata/settings.json, only the first thread in a project gets its own worktree. All subsequent new threads reuse the same worktree directory — no new branches or worktrees are created.
Analysis
Based on the source code, the flow should be:
✅ Sidebar reads defaultThreadEnvMode from settings → passes envMode: "worktree" to handleNewThread()
✅ Draft thread stores envMode: "worktree" in composerDraftStore
❌ On first message send, client should detect envMode: "worktree" + no worktreePath → build bootstrap.prepareWorktree in the thread.turn.start command — this does not appear to happen for threads after the first
✅ Server-side GitCore.createWorktree() exists and works (PR #1518)
The bootstrap construction in step 3 appears to be the gap — the prepareWorktree payload is never sent for new threads, so the server never creates additional worktrees.
Expected behavior
Each new thread should create an isolated git worktree with its own branch (e.g., t3code/), so that parallel threads don't step on each other's file changes.
Every thread's claude/system/init event shows the identical cwd.
Confirmed across multiple thread IDs.
No worktree creation events in logs:
Searching server.log and server-child.log for createWorktree, prepareWorktree, or worktree add returns zero results (beyond the startup config showing worktreesDir).
Ah figured out how to do this correctly in the UI — could not figure it out from the documentation.
Need to start new thread, select "main" branch and "New worktree." If any branch other than main is selected it will continue in the existing worktree.
Activity
aharlap commentedon Apr 8, 2026
Ah figured out how to do this correctly in the UI — could not figure it out from the documentation.
Need to start new thread, select "main" branch and "New worktree." If any branch other than main is selected it will continue in the existing worktree.
mackelito commentedon Apr 15, 2026
Hmm.. you should be able to set the behavior... I would prefere to have new from main set as default when I start a new conversation