Skip to content

[Bug]: Thread worktree keeps the PR branch checked out after the PR is opened, so the user can't check it out in their own clone #36415

Open

Description

@ryanzigler

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Start a thread in a new worktree. Its branch ends up as feature-x (renamed from t3/<id> or chosen by the user).
  2. Let the agent commit, push and open a PR for feature-x.
  3. In the user's main clone of the same repo, run git checkout feature-x.

Expected behavior

Once the PR is open, the user can check out feature-x in their own clone to review or keep working on it.

Actual behavior

fatal: 'feature-x' is already used by worktree at '~/.t3/worktrees/<project>/<thread-id>'

The thread's worktree keeps feature-x checked out until the user switches it away by hand. I haven't isolated whether the worktree holds the branch from creation or only from the PR onward. Either way, it still holds the branch after the PR is open.

The only workaround is git switch --detach in the thread's worktree, and it causes two more problems:

So right now the user has to choose between being able to check out their branch and having worktrees cleaned up.

Suggested fix

Impact

Major degradation: it happens on every thread whose branch the user later wants to check out locally.

Version or commit

T3 Code 0.1.10-nightly.20261113.4643 (9a35ab0), desktop

Environment

macOS, Claude agent, Bitbucket-hosted repo

Related

#17813, #33278, #33397

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions