Agent worktree is removed before merge-back, then Git spawn reports misleading ENOENT

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Title: Agent worktree is removed before merge-back, then Git spawn reports misleading ENOENT

Cursor version: 3.11.25
Platform: macOS
System Git is installed and runs normally.

An agent created a Cursor-managed worktree and committed successfully to a feature branch.
Before I asked it to merge back to main, the worktree directory had already disappeared.

When I asked the agent to prepare and then perform the merge, it could no longer run Shell/Git and reported:

spawn /usr/bin/git ENOENT
worktree could not be mounted

This is not a missing Git installation. I reproduced that spawning an existing Git binary from a nonexistent working directory produces the same ENOENT /
“spawn /usr/bin/git” error.

Expected:

  1. A Cursor-managed worktree should remain available until merge/closeout is completed, or be recoverable before merge.
  2. If the working directory is missing or unmounted, Cursor should report that condition rather than saying Git is unavailable.
  3. Merge-back should not depend on a stale agent-worktree directory when the branch ref remains available.

Please investigate why the worktree was removed before the user requested merge-back.

Steps to Reproduce

“The downstream failure is deterministic once the worktree/cwd disappears. The unexpected Cursor-managed worktree removal was observed once and is not yet confirmed as reliably reproducible.”

Operating System

MacOS

Version Information

Version: 3.11.25
VS Code Extension API: 1.125.0
Commit: fc2563ec93d793fc275eef734405a4fdf8b47b20
Date: 2026-07-15T01:27:41.754Z
Layout: Agent Window
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.5.0

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey @lawrenceg!

Thanks for the report. This looks a lot like Cursor removes active worktree directories and then closes/crashes unexpectedly, which spawned a bug report that is still open on our side. Could you have a look?

@kevinn also shared some tweaks that might help