Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Environment
- macOS; Cursor
- A git repo (
~/code/mono) whose primary checkout is on branchmain - A linked git worktree on a feature branch (created via
git worktree add),
e.g.~/code/mono-wt-<slug>on branchfeature/x
Root-cause hypothesis
The “migration” step appears to carry the SOURCE root’s branch (main, from
the primary checkout) and run git checkout main at the destination, which
collides because main is already checked out in the primary. It should
instead respect the destination worktree’s already-checked-out branch, or skip
the migration checkout entirely for an existing valid worktree — which is what
the sibling move_agent_to_cloned_root already does (“skips the migration
git fetch / ff-merge”).
Impact
Moving an agent/chat into a per-ticket worktree is a core workflow; this makes
it impossible via both the MCP tool and the UI, forcing “degraded mode”
(absolute file paths + per-command working directory) for the whole session.
Steps to Reproduce
Repro (deterministic)
- Primary checkout
~/code/monois onmain. - Create a worktree:
git worktree add ../mono-wt-x -b feature/x. - From a chat rooted in the primary, move the chat’s root into the worktree,
via EITHER:- the agent MCP
move_agent_to_root(rootPath = the worktree), OR - the chat context menu → “Move to” → .
- the agent MCP
Actual
Both entry points fail with:
Failed to checkout migrated branch “main”: Command failed: git checkout main
fatal: ‘main’ is already used by worktree at ‘/Users/…/code/mono’
Expected Behavior
The move succeeds; the chat root becomes the worktree, which is already
checked out on its own branch — no git checkout should be needed.
Operating System
MacOS
Version Information
Version: 3.9.16
VS Code Extension API: 1.105.1
Commit: 042b3c1a4c53f2c3808067f519fbfc67b72cad80
Date: 2026-06-27T06:41:01.941Z
Layout: glass
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.4.0
For AI issues: which model did you use?
Opus 4.8
Does this stop you from using Cursor
No - Cursor works, but with this issue