Agent wiped other chats' uncommitted work with repo-wide git restore

Where does the bug appear (feature/product)?

Grok Build (formerly Cursor)

Describe the Bug

Severity: High — irreversible / partially unrecoverable loss of uncommitted local changes.

In a multi-chat Cursor workflow (same git worktree), the user asked the Agent to revert ONLY the current chat window’s modifications.

The Agent instead:

  1. Ran git restore --worktree --staged -- . (repo-wide discard of ALL tracked dirty files)
  2. Bulk-deleted untracked files with Remove-Item -Recurse -Force (source/tests/Changes)
  3. Also ran git restore --worktree --staged -- packages services in sibling workspace_service

Uncommitted work from OTHER chat windows was wiped. Local History / snapshots / transcript recovery was only partial; some desktop files remain missing.

This is a product/agent-safety issue: ambiguous “revert this chat” maps too easily to catastrophic shell/git commands with no mandatory confirm + backup gate.

Steps to Reproduce

  1. Have uncommitted tracked/untracked changes in a repo from Chat A.
  2. In Chat B, make additional edits in the same worktree.
  3. In Chat B, ask something like: revert all modifications from the current conversation window only.
  4. Observe the Agent running repo-wide git restore --worktree --staged -- . and/or bulk deletes without confirming a path list or creating a safety stash/copy.
  5. Chat A’s uncommitted work is gone; git status may show a clean tree.

Expected Behavior

  1. “Revert this conversation’s changes” should be path-scoped to files that chat created/edited.
  2. Before any discard, Agent should confirm exact commands + path list with the user.
  3. Before discard, Agent should create recoverable safety nets (e.g. git stash push -u, patch snapshots, copy untracked files).
  4. Other chats’ dirty worktree state must not be wiped as a side effect.
  5. Prefer reversible actions over a “clean” tree.

Operating System

Windows 10/11

Version Information

OS: Windows 10/11 (build 26200)
Product: Cursor IDE / Agent Chat (forum label: Grok Build formerly Cursor)
Please use About Cursor → Copy on my machine if exact build string is required; this report focuses on Agent Shell+git destructive behavior.

For AI issues: which model did you use?

Cursor Agent (Composer / Auto routing in IDE Agent chat)

For AI issues: add Request ID with privacy disabled

Request ID: NOT ATTACHED YET — please ask me if needed; I can Copy Request ID from the incident chat.
Local transcript id (for correlation on my side): c8aa4b0d-f041-4a6c-ac07-c3053e1a8160
Follow-up preference/mitigation chat id: cc8ed225-d9bc-429e-9f45-584e2a25ee3e
Note: Privacy Mode may limit what support can see; I can enable Share Data and provide a fresh Request ID if required.

Additional Information

Local mitigation already applied by user request (project alwaysApply rule): .cursor/rules/no-dangerous-git.mdc

  • Dangerous git is not blanket-banned; Agent must confirm every time.
  • After confirmation, create recoverable safety nets before execute.

Hard lesson from the incident: “revert this chat / this window” != wipe the whole working tree.

Ask to Cursor engineering:

  1. Treat ambiguous revert requests as high-risk: require explicit path confirmation (UI or hard policy) before git restore/clean/bulk deletes.
  2. Prefer automatic safety nets (stash -u / patch snapshot / copy untracked) before destructive git/fs ops from the Agent.
  3. Investigate the incident chat Request ID once provided.

Does this stop you from using Grok

No - Grok works, but with this issue

Hey @sonj_tse,

I’ve passed this to the team with your chat ID, so no Request ID is needed.

For files that are still missing, run git fsck --lost-found in each affected repo. Any file content that was staged with git add before the restore is still stored in .git, and this writes it out to .git/lost-found/other/. The files are named by hash, so you’ll need to open them to see which is which. Untracked files that were never staged aren’t in git, so this won’t bring those back.