Before submitting#
Area#
apps/web
Steps to reproduce#
- Keep "Delete worktrees with deleted threads" off (the default).
- Create a worktree outside T3 and leave a change uncommitted:
git init -b main myproj && cd myproj
echo hello > README.md && git add . && git commit -m init
git worktree add ../myproj-feature -b feature-x
echo wip >> ../myproj-feature/README.md
- Add
myproj as a project, start a thread, and pick feature-x in the branch picker. The thread now points at myproj-feature.
- Delete the thread and confirm "Delete the worktree too?".
Expected behavior#
T3 offers to delete only worktrees it created. Automatic cleanup already does this: it skips anything "outside the managed worktree folder" (storageCleanup.ts).
Actual behavior#
myproj-feature is force-removed, along with its uncommitted change. getOrphanedWorktreePathForThread only checks whether another thread uses the path, and useThreadActions.ts then removes it with force: true.
This hits hardest with a bare repository and one worktree per branch, where any existing branch you pick is one of your own worktrees. Unlike #37769, which asks for a dirty check, this is about ownership.
Reproduced in the T3 Code desktop app (v0.1.13, Linux). With automatic cleanup on, the worktree was kept and no prompt appeared.
Impact#
Major degradation or frequent failure (data loss)
Version or commit#
v0.1.13 (code links: main at 23fad9519a)
Environment#
Linux, T3 Code desktop
Workaround#
Turn on "Delete worktrees with deleted threads", or click Cancel on "Delete the worktree too?" for any worktree you created yourself.
A fix for this was proposed in #48219, but when the reported steps were run in the real app the problem did not appear.
What was run on
7b7ca65f9a, the commit before this change:Created a git project with README.md, added a sibling feature-x worktree with an uncommitted wip line, started a thread selecting feature-x, opened Thread actions > Delete, confirmed deletion, and observed the worktree-delete prompt and filesystem state on both commits.
How: Web app via the repository e2e runner, fresh T3CODE_DEV_SEED=0 database per checkout, Replay (dev) provider, same viewport.
Could you share the exact steps, what you see, and the version and platform you are on? The pull request is closed for now; the fix is picked up again once the problem can be shown.