Agent Review fails in Git worktree with multi-root workspace

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Environment:

  • OS: macOS
  • Workspace: Multi-root workspace (.code-workspace)

Directory Structure Background:
I have a project management directory that contains multiple independent Git repositories
(backend, frontend, docs, etc.). The parent directory is also a Git repo to centrally
manage shared configuration files (IDE settings, CI configs, documentation).

project-root/ ← Git repo A (for shared configs)
├── .cursor/ ← Shared IDE settings
├── .vscode/
├── backend/ ← Git repo B (main codebase)
│ └── .git/worktrees/
├── frontend/ ← Git repo C
└── worktrees/
└── feature-branch/ ← Worktree of Git repo B

I use Git worktrees under worktrees/ for parallel feature development on backend/.

Problem:
When committing in a Git worktree, Agent Review fails with:
Failed to gather Agent Review context.
Caused by: Error when executing ‘git’: fatal: Not a valid commit name

Root Cause:
Agent Review appears to run git from the workspace root (project-root/)
instead of the worktree’s actual Git context.

The commit hash exists in the worktree’s repo (Git repo B) but not in
the parent directory’s repo (Git repo A), causing the lookup to fail.

Workaround:
Disable “Auto-run on commit” for Agent Review.

Steps to Reproduce

  1. Open a multi-root workspace containing nested Git repos
  2. Create a worktree from one of the sub-repos
  3. Open the worktree folder in the workspace
  4. Make changes and commit
  5. Agent Review automatically triggers and fails

Expected Behavior

Agent Review should detect the correct Git directory for the worktree
(by following the .git file pointer or using git rev-parse --git-dir).

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.0-pre.23.patch.0
VSCode Version: 1.105.1
Commit: c22665d06699c8ce0d3c9d347414c7501505cf70
Date: 2025-12-22T01:54:01.106Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.2.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

This is a known issue: Agent Review currently detects the Git directory incorrectly when using a worktree in multi-repo or multi-root workspace setups. The git command is being run in the context of the wrong repository.

The team is aware and is working on a fix.

Your workaround (disabling “Auto-run on commit”) is the best option for now. As an alternative, you can run Agent Review manually from a workspace that only has one repository.

I’ll add your report to help raise the priority of the fix. Thanks for the repro steps!

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