Multi agent mode loose worktree and Apply / Undo Apply

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When using multiple agents, set to create and use their own worktree, half of the agents quickly forget that they are working in their own worktree, and the “apply” “undo apply” buttons dissapear, and no way of getting them back or returning to working in worktree. So now the different agents immediately start overwriting each others code and it all quickly turns into a big mess, and I’ve now wasted ALOT of tokens, since I ran multiple agents.
How can I avoid this, or is the feature broken/not ready to be used yet?

Steps to Reproduce

Just run 4-5 agents and try to work with them, happens over and over once you apply one of them, soon, or without even that, one or more of the agents jump out of worktree and just edit main as usual.

Expected Behavior

The different agents always stay in the own worktree no matter what, until you merge to main on purpose.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.35 (system setup)
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z
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.26200

For AI issues: which model did you use?

sonnet 4.5, gemini 3 pro, gemini 3 flash, composer1, chatgpt 5.2 codex. Doesn’t matter what model, it’s the IDE/cursor that causes it, all of them loose the worktree at random.

Does this stop you from using Cursor

No - Cursor works, but with this issue

3 Likes

Had the same issue today. Started a new agent, picked Worktree, issued few prompts and at some point noticed its already making changes to files in main folder conflicting with other agent.

Hey, thanks for the detailed report. This is a known issue: agents in a worktree can lose context and switch back to main. I also see @Ingvar is confirming the same thing.

The team is working on a fix, and we have a few active tickets around worktree functionality. Related reports:

To help with debugging, can you share:

  1. The Request ID for a specific case where the agent lost the worktree (chat context menu, then Copy Request ID)
  2. The exact prompt that triggered the switch
  3. Whether you used any @ mentions for files from the main directory

Item 3 is especially important. There’s a known bug where @ mentions in a worktree can cause edits to happen in main instead of the worktree.

Hi.
I will look, but I had so many wasted chats that clittered my history deleted some of them, will check, but Im flying today so have to be tomorrow or something.
/Per

1 Like

Following!