[BUG] Rewind with code restore deletes a renamed file on case-insensitive macOS
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Rewinding with code restore deleted a file that no checkpoint ever wrote under its current name.
Checkpoints track the path a file was created with by the Write tool. Renames done with mv in Bash are not tracked. When the tracked path does not exist at a checkpoint, the snapshot records it as absent (backupFileName: null). Restoring that checkpoint deletes the tracked path. On a case-insensitive filesystem, deleting A-note.md removes a-note.md, so a file that only matches by case is lost.
What Should Happen?
Expected: a-note.md stays, because no checkpoint wrote that name.
Actual: a-note.md is deleted, silently.
Error Messages/Logs
No error is shown. The file is gone after the restore.
Steps to Reproduce
On macOS with the default case-insensitive APFS:
- Ask Claude to create
A-note.md. It uses the Write tool. - Next message: ask it to rename the file to
A_note.md. It runsmvin Bash. - Next message: ask it to rename the file to
a-note.md. It runsmvin Bash. - Rewind to the message from step 3 and choose to restore code.
a-note.mdno longer exists.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.292
Platform
Anthropic API
Operating System
macOS 26.7.1
Terminal/Shell
iTerm2
Additional Information
This happened once in a real session. The steps above mirror it, and the session's file-history snapshots show the tracked path with backupFileName: null at the rewound message.
Suggestion: before deleting during a restore, compare the on-disk file's canonical path with the tracked path, and skip or warn when only the case matches.