Agent-created git worktree is treated as out-of-workspace: every file edit asks for approval, and approval does not persist

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In a multi-root workspace over WSL, the Agent created its own git worktrees with git worktree add in sibling directories that are not folders of the
.code-workspace file. After that, External-File Protection asks me to approve every single file edit in those worktrees (blockReason: outOfWorkspace).
Accepting an edit does not allow the folder for the rest of the chat. The next edit to the same worktree prompts again.

I did not create the worktrees. The Agent did, so it could work off origin/master while my main checkout stayed on another branch. Cursor already has
a native /worktree flow whose edits follow normal auto-run rules. A worktree the Agent creates itself gets none of that, so a long task turns into a
stream of identical approval cards.

This started being enforced mid-session. The same worktree paths were edited for days with no prompts. After the WSL remote connection dropped and
reconnected (socket close 1006, about 10 minutes down), the very next edit was blocked.

Steps to Reproduce

  1. Open a multi-root .code-workspace in Cursor over WSL (Remote).
  2. In Agent mode, ask the agent to implement a change on a clean branch while the repo checkout is on a different branch.
  3. The agent runs something like git worktree add -b ../- origin/master, creating a checkout next to the repo but outside the
    workspace folder list.
  4. Let the agent edit files in that worktree with the file-edit tool.
  5. Approve one edit when the out-of-workspace card appears.
  6. Watch the next edit in the same directory prompt again.

Expected Behavior

Once the Agent has created a worktree as part of the task, later edits in that worktree during the same chat should not each require approval.
Accepting one edit should allow that folder for the session, or the Agent should use the native /worktree checkout, which already does not add this
extra prompt.

Actual behavior

Every edit is blocked with outOfWorkspace. Example: an edit to studiov2-eng-2115/src/showroom/startShowroomMocks.test.ts was still waiting on approval
after earlier edits in that same worktree had been accepted. The Agent has no signal that git worktree add outside the workspace will cause this, so
it keeps editing there.

Operating System

Windows 10/11

Version Information

Version: 3.22.12 (user setup)
VS Code Extension API: 1.128.0
Commit: 3a92974361033b2051526321308c2740fe5912c0
Date: 2026-09-26T04:55:12.125Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 42.10.0
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
xterm.js: 6.1.0-beta.291
OS: Windows_NT x64 10.0.26200

For AI issues: add Request ID with privacy disabled

90b46ced-a612-4343-a77b-8deeb45de0e3

Additional Information

Environment

• Cursor 3.22.12, layout unifiedAgent
• Windows, WSL2, Ubuntu 24.04 (wsl+Ubuntu-24.04)
• Multi-root workspace file; worktrees are siblings of the listed folders, not entries in folders
• Agent mode, model Claude Opus 4.5 / Opus 5.5 (300k)
• Request ID: 90b46ced-a612-4343-a77b-8deeb45de0e3
• Composer ID: 01a7ec9b-a448-400f-a3f5-4ce9846a2adb
• Worktree created by the agent on 2026-09-24 with git worktree add -q -b th/eng-2115-fundraising-history ../studiov2-eng-2115 origin/master (same
pattern later for apiv2-eng-2115)
• First blocked edit: 2026-09-29 10:15 local, immediately after the WSL reconnect at 10:15:04

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey @thibauld,

The quickest fix is to start these tasks with /worktree, e.g. /worktree branch=origin/master <your task>. It works in multi-root workspaces as long as every folder is a git repo, and edits in those checkouts don’t trigger the approval prompts. Use /apply-worktree to bring changes back and /delete-worktree to clean up.

For the worktrees you already have, add them with File > Add Folder to Workspace…, then start a new chat.

Right now, approving one of these cards only covers that single file, which is why it keeps asking. We’ve let the team know.