AI code changes immediately revert on specific files

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

AI-generated code changes are immediately reverted on specific files in Cursor IDE. When the AI model attempts to make changes, they briefly appear and then disappear instantly. Instead of the intended fixes, unrelated formatting changes (additional indents) appear elsewhere in the same file.

This behavior only affects certain files consistently - the same files always exhibit this reverting behavior, while other files in the same project accept and retain AI changes normally. The issue was discovered while using Agent Review’s “fix in chat” feature, but may be unrelated to Agent Review itself and could potentially affect any AI chat code modifications. This issue occurs across different AI models.

The AI model attempted multiple approaches and eventually succeeded by using a Python script executed via terminal to directly read/modify/write the file. However, the successful changes were only visible through git diff, not in the IDE editor.

Steps to Reproduce

  • Use AI chat to modify code (observed via Agent Review’s “fix in chat”, but likely reproducible through other AI chat interactions)
  • AI suggests and applies code changes
  • On affected files: changes appear momentarily then immediately disappear
  • On affected files: unrelated indent changes appear in different parts of the file
  • On unaffected files: changes work normally and persist as expected
  • The same files consistently show this reverting behavior across multiple attempts
  • AI may eventually succeed using alternative methods (e.g., Python script via terminal)
  • Check git diff - changes may be present on disk but not visible in IDE

Expected Behavior

  • AI-suggested changes should persist in all files equally
  • No unrelated formatting changes should occur
  • All files should behave consistently when receiving AI-generated modifications
  • Changes should remain visible and saved unless explicitly reverted by the user
  • Changes made to files should be immediately visible in the IDE editor

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.35
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z
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.0.0

For AI issues: which model did you use?

claude-4.5-opus-high, gpt-5.1-codex-max-xhigh

For AI issues: add Request ID with privacy disabled

8ef48165-2928-406d-8147-54f353db6faa

Additional Information

  • Critical detail: Only specific files exhibit this behavior - it’s not random. The same files consistently revert AI changes while others work fine
  • The reverting happens immediately after the AI applies changes
  • Unrelated formatting changes (indents) appear in the affected files instead of the intended modifications
  • The issue was observed during Agent Review usage but is likely not Agent Review-specific
  • The issue persists across different AI models, indicating it’s not model-specific
  • The AI model reported that search_replace and write tools kept reporting success but changes weren’t persisting. What finally worked was running a Python script via terminal that:
    Read the file content directly from disk
    Performed the string replacement in memory
    Wrote the modified content back to disk
  • Even after successful modification via Python script, changes were only observable through git diff, not in the IDE editor

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey, thanks for the report.

These symptoms (changes instantly reverting plus extra indentation showing up) usually point to one of two causes:

  1. Cloud sync - OneDrive, Dropbox, or Google Drive may be overwriting files with older versions faster than Cursor can save them. We recently solved a similar case (File keeps reverting and losing all my work) and the cause was OneDrive.

  2. Formatting extensions - if Format On Save is enabled plus Prettier, Black, or ESLint, they can conflict with AI edits.

Can you check:

  • Is iCloud Drive or any other sync running for these files?
  • Which formatting extensions are installed? (Prettier, ESLint, etc.)
  • Is Settings > Format On Save enabled?
  • What file types are affected? (Python, JS, something else?)

For a quick extension check, try running cursor --disable-extensions, open the problem file, and repeat the AI edit. If the issue goes away, the cause is an extension.

Thank you for the quick response and suggestions.

I’ve investigated both potential causes:

1. Cloud Sync: Not applicable in this case - the Python code resides in a Docker container (not as a mounted volume), so there’s no OneDrive/Dropbox/iCloud involvement.

2. Formatting Extensions: I’ve disabled all formatters, linters, and auto-save features, but the issue persists. The problem occurs even with these completely deactivated.

Could this be a file synchronization issue between Cursor and the Docker container’s filesystem, especially since it only affects certain files and persists even with all extensions disabled?

I can now reproduce the issue, and it appears that Agent Review is indeed the cause.

Steps to reproduce:

  1. Click on a potential issue in the Agent Review window (this opens the file in an Agent Review Tab)

  2. Click “fix in chat” while the Agent Review Tab remains open (note: the file is also open in a regular editor tab)

  3. Observe that all AI attempts to modify the file fail - changes appear briefly then revert

After clicking “fix in chat”, close the Agent Review Tab before sending the prompt in the AI chat. When I do this, the AI changes persist normally.

Thanks for the detailed repro case in your last post. It’s super helpful that you found the exact steps and a workaround.

Confirmed, this is a bug caused by a conflict between an open Agent Review Tab and the “fix in chat” feature. When the same file is open in both the Review Tab and a normal tab, AI edits from chat get reverted. Your workaround is correct. Closing the Review Tab before sending the prompt fixes the issue.

I shared this with the team, along with your reproduction steps.