# Multi agent mode loose worktree and Apply / Undo Apply

**URL:** <https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072>\
**Category:** Bug Reports\
**Tags:** worktrees, subagents, review\
**Created:** [January 16, 2026, 11:59am UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072 "2026-01-16T11:59:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Per\_Swede](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@Per\_Swede](https://forum.cursor.com/u/Per_Swede)\
**Post date:** [January 16, 2026, 11:59am UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/1 "2026-01-16T11:59:59Z")

</div>

### 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

---

<div class="post-metadata">

**Author:** ![Ingvar](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@Ingvar](https://forum.cursor.com/u/Ingvar)\
**Post date:** [January 16, 2026, 1:01pm UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/3 "2026-01-16T13:01:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [January 18, 2026, 7:18am UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/4 "2026-01-18T07:18:24Z")

</div>

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:

- [Worktrees are not working as expected](https://forum.cursor.com/t/worktrees-are-not-working-as-expected/149088)
- [🐛 Bug Report: Path Resolution Inconsistency in Git Worktree Mode](https://forum.cursor.com/t/bug-report-path-resolution-inconsistency-in-git-worktree-mode/149056)

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.

---

<div class="post-metadata">

**Author:** ![Per\_Swede](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@Per\_Swede](https://forum.cursor.com/u/Per_Swede)\
**Post date:** [January 19, 2026, 1:02pm UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/5 "2026-01-19T13:02:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![new](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@new](https://forum.cursor.com/u/new)\
**Post date:** [January 21, 2026, 2:16pm UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/6 "2026-01-21T14:16:19Z")

</div>

Following!

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [February 12, 2026, 2:16pm UTC](https://forum.cursor.com/t/multi-agent-mode-loose-worktree-and-apply-undo-apply/149072/7 "2026-02-12T14:16:56Z")

</div>

Closed on February 12, 2026, 2:16pm UTC

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
