t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Externally created Git worktrees are treated as “Local”

Open paulomanrique opened this issue 7 months ago • 5 comments

Before submitting

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

Area

apps/desktop

Steps to reproduce

  1. create a new thread;

  2. ask the model to create a new worktree (or have it on AGENTS.md as steps to start a new task like I do)

  3. check T3 Code indicator pointing as "local"

  4. check the "Open button" loading the original repo folder, instead of the worktree.

Expected behavior

The worktree should be recognized as a Worktree, regardless of how it was created

Actual behavior

T3 Code does not recognize the new Worktree and it thinks it's on the original repo folder.

Impact

Minor bug or occasional failure

Version or commit

No response

Environment

No response

Logs or stack traces


Screenshots, recordings, or supporting files

ss.png

Workaround

No response

paulomanrique avatar Apr 03 '26 15:04 paulomanrique

I encontered this too. In the session I pointed it to the correct directory, and I hope it will go well from there.

rshouker avatar Jul 19 '26 06:07 rshouker

+1, this also breaks trust in the footer indicator more generally. Concrete case: the agent created a worktree + branch feat/age-permis-conditions from origin/dev mid-thread, and the composer footer still shows "Local checkout · dev" for the rest of the conversation. As a user I can never tell with certainty which branch/worktree the thread is actually operating on — the indicator looks authoritative but reflects the initial binding, not reality. Looking forward to #3754.

iamtoled avatar Aug 06 '26 07:08 iamtoled

Tested on 1dfb572871 with git worktree add. Selecting the external worktree started the agent there, and t3_worktree_list returned its correct path. Creating a worktree alone kept the existing thread at its original directory, matching pwd. Which provider and commands moved your session into the worktree, and does this still occur on the latest version?

juliusmarminge avatar Oct 21 '26 10:10 juliusmarminge

Thanks for testing, your result matches mine. Re-tested today on 0.0.46-nightly.20261021.3457 with Claude (Opus 5.5):

  • git worktree add -b repro-a ../repro-a-wt HEAD + cd ../repro-a-wt: t3_worktree_status returns attached: false, and the next shell command is back at the project root. So in my original case the agent was working in the worktree via cd/absolute paths while the thread stayed bound to the root checkout. The footer was technically right; that part isn't a bug.
  • The supported path, t3_worktree_handoff with a continuationPrompt, does rebind the thread, but the Claude turn then fails with "The provider event stream closed unexpectedly", the continuation stays Queued, and "Waiting on background task mcp__t3-code__t3_worktree_handoff" can't be stopped. That's #15136 / #15993 (fix in #15203, still open).

So with Claude there's currently no working way for an agent to move its own thread into a worktree, which is why agents fall back to git worktree add + cd and end up in the #1714 situation. From my side this can be closed in favor of #15136.

iamtoled avatar Oct 21 '26 10:10 iamtoled

[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of Theo

Thanks for the report. Issue #15136 already tracks this problem, so we close this issue to keep all detail in one place. Please follow #15136 and add your version and steps there if they differ. Please do not open a new issue for the same problem.

t3dotgg avatar Oct 21 '26 11:10 t3dotgg