Using another branch in the worktree sometimes doesn't work

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When using the worktree for a branch that isn’t the same as the currently checked out branch, sometimes wrong branch is used.

Steps to Reproduce

  1. Check out a develop branch
  2. Set worktree to another branch
  3. Ask the model “Please run git log to tell me what the latest commit is”
  4. See the latest commit is for the develop branch instead of the worktree. After a few attempts at recreating this issue, it should occur.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.49 (user setup)
VSCode Version: 1.105.1
Commit: 21a2ed198584d56a91c0b996d1a09c93f8538440
Date: 2025-12-05T07:49:06.016Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.22631

Does this stop you from using Cursor

No - Cursor works, but with this issue

Today I have this problem all day in Thailand. It has been down all day

Hey, thanks for the report. We need more data to reproduce the worktree issue (the wrong branch is being used).

Could you please share:

  • Local Agent or Cloud Agent?
  • Request IDs for runs where branch A is selected but the agent shows a commit from develop (chat menu top-right → Copy Request ID)
  • Command outputs:
    git worktree list
    From the worktree terminal: git rev-parse --abbrev-ref HEAD and git log -1 --oneline
  • Exact steps: where you select the worktree branch, what you run afterward
  • Repo structure: monorepo or multiple repos in the workspace, and whether it reproduces on a minimal example

Quick checks:

  • Open a terminal inside the worktree and verify that HEAD points to the expected branch
  • Fresh run from a clean state: restart Cursor and reselect the branch in the worktree selector

Docs: Parallel Agents | Cursor Docs

Share the info and I’ll pass it to the team.

  1. This is a local agent
  2. It only occurs when selecting multiple agents. The request ID for the first agent that works is 52284444-1738-422c-84f1-d668992d7f4a and the broken agent is fafdbabb-290a-45f5-9b5f-1cf7012028c0
  3. I’ve recreated it successfully using this minimal reproducible repository structure

git init
echo print(“foo”)>app.py
git add app.py
git commit -m “print foo”
git checkout -b print-bar
echo print(“bar”)>app.py
git add app.py
git commit -m “Print bar”
git checkout master

Afterwards, open the project in cursor, and run two models on the “print-foo” worktree. The second model will be running on the master branch. Ask the model “What does this python app print?”

  1. Git worktree logs

C:/Projects/cursortest 4e7d216 [master]
C:/Users/montgoh/.cursor/worktrees/cursortest/gvi 12fdbdd (detached HEAD)
C:/Users/montgoh/.cursor/worktrees/cursortest/rji 4e7d216 (detached HEAD)

  1. Recreated without terminal, asking it about the code directly to simplify the recreation steps.

i mean to say run two models on the “print-bar” worktree, as “print-foo” is on the master branch