Hey, this is a known issue. Undoing or rejecting agent changes can sometimes delete the whole file instead of rolling back.
Main thread with details: Rejecting suggested changes can delete the entire file
A fix is already out. Please update Cursor to the latest version (Help > Check for Updates).
If your file is already gone, here are a few ways to restore it:
- Checkpoints: Open the chat where the agent made changes, find the message right before the deletion, then click Restore Checkpoint.
- Git:
git checkout -- <file_name> - Timeline: In Explorer (bottom-left), pick the last working version of the file.
Let me know if it happens again after updating.