Reopening workspace reapplies Local History ("Undo Create Diff") and corrupts UTF-8 files / false TFVC pending changes

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Environment

  • OS: Windows 10
  • Cursor: [Help → About → copy version]
  • SCM: Azure DevOps TFVC (Visual Studio) — not Git
  • Project: large .NET solution, many .cs/.sql with Portuguese comments (UTF-8)

Steps

  1. Open solution in Visual Studio — no pending changes.
  2. Open same folder in Cursor (no manual edits).
  3. Close Cursor, refresh pending changes in VS.
  4. Random .cs files appear as modified with diff showing “1 change” on accented characters (e.g. “edição”) but text looks identical.
  5. Undo/revert all in TFVC, close Cursor, reopen — different files appear again.

Expected
Opening Cursor must not write to source files.

Actual
Files on disk are rewritten from %APPDATA%\Cursor\User\History\ with source “Undo Create Diff” (agent edits).
Local file contains UTF-8 replacement chars U+FFFD (EF BF BD) instead of ç/ã.
Example: SuperiusWeb.Interface/ViewModels/…/SPE0001Interface.cs line 26.

Evidence

  • Timestamps: local file LastWriteTime updates when only opening Cursor.
  • History entries.json lists “Undo Create Diff” for the same file path.
  • Byte compare: server has correct UTF-8; local has EF BF BD.

Workaround
Delete Cursor\User\History for affected files; or entire History folder.
Disable Codebase Indexing; files.restoreUndoStack: false; workbench.restoreEditors: none.
Use VS for TFVC check-in only.

Steps to Reproduce

Aqui vai um Steps to Reproduce pronto para colar no report (em inglês, que o time do Cursor costuma preferir):

Steps to Reproduce
Use a large .NET solution on Windows with Azure DevOps TFVC (check-in via Visual Studio, not Git).
Ensure the workspace has no pending changes in Visual Studio (Source Control Explorer / Pending Changes is empty).
Close Visual Studio (optional but recommended).
Open the same solution folder in Cursor (File → Open Folder).
Do not open any file tabs manually and do not save anything. Wait 1–2 minutes (let indexing finish).
Close Cursor completely.
Open Visual Studio and refresh Pending Changes.
Observe: one or more files appear as modified (e.g. .cs under ViewModels, .cs in Business, or .sql in Procedures).
Compare with server: diff shows “1 change” on a line with Portuguese accents (e.g. edição), but the text looks almost identical.
In Visual Studio, undo/revert all pending changes so the workspace is clean again.
Repeat steps 4–7 without editing anything in Cursor.
Observe: different files may appear as modified on each Cursor open (whack-a-mole).
Optional verification

Check %APPDATA%\Cursor\User\History\entries.json for the affected file path; entries show “source”: “Undo Create Diff”.
Check local file bytes on an accented word: corrupted files contain UTF-8 replacement character EF BF BD (U+FFFD) instead of proper ç / ã.

Operating System

Windows 10/11

Version Information

3.5.33 Vs 1.105.1

Does this stop you from using Cursor

No - Cursor works, but with this issue

Additional data point (Windows, TFVC / Visual Studio, not Git):

  • Clearing only %APPDATA%\Cursor\User\History* did NOT stop the issue.
  • The same file kept reappearing as modified after reopening the folder.
  • Found corrupted content reapplied from:
    %APPDATA%\Cursor\User\globalStorage\anysphere.cursor-commits\checkpoints
    (~208 checkpoint folders). Example file:
    SuperiusWeb.Interface/ViewModels/Modulos/Fiscal/Interfaces/SPE0001Interface.cs
    Line 26: “edição” on server vs U+FFFD (EF BF BD) locally after Cursor open only.
  • Review panel / prior Agent edits on that file — same pattern as described by @deanrie.
  • Settings: files.autoSave off, files.hotExit off, no files.eol override.

Happy to test a build when the fix ships.

Deleting anysphere.cursor-commits alone was not enough. Checkpoints also exist under anysphere.cursor-retrieval\checkpoints\ (~22 folders). Same metadata format (agentRequestId, requestFiles). Reopening the workspace still rewrites different files from that cache. Clearing both paths required.

This is a known bug. Cursor’s session restoration system rewrites files on startup from cached states (Local History and checkpoint storage), and in your case the restore is also corrupting UTF-8 encoding — replacing accented characters like ç and ã with replacement characters.

A fix for the line-ending corruption component shipped recently, but the file-rewrite-on-startup behavior and the UTF-8 encoding corruption are still being tracked and haven’t been fully resolved yet. Our team is aware of this.

Your workaround of clearing both %APPDATA%\Cursor\User\History and the checkpoint folders (anysphere.cursor-commits\checkpoints and anysphere.cursor-retrieval\checkpoints) is the right approach for now. You can also try these settings, which you’ve already found:

  • "files.restoreUndoStack": false

  • "workbench.restoreEditors": "none"

One more thing worth checking: before closing Cursor, open the Review panel (the diff icon in the sidebar) and accept or discard any pending AI edits. If there are no cached states left to restore, files shouldn’t be rewritten on the next startup.

We’ll update this thread when a fix ships. Thank you for the thorough report and byte-level evidence — it’s very helpful.