[PR #6744] fix(file): resolve 1ms timestamp race in sequential file edits (#8624) #12079

Open
opened 2026-02-16 18:17:00 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6744

State: open
Merged: No


Issue #8624

Issue Fixed in this PR:

Sequential file edits fail with "File modified since it was last read" showing 1-10ms timestamp differences, even with no external modifications.

Root cause: FileTime.read() stores new Date() instead of the file's actual mtime. After writes, filesystem mtime updates can lag slightly (especially Windows NTFS, and WSL2), causing false positives in assert().

Fix:

  • FileTime.read() now accepts optional mtime parameter
  • All write operations pass actual file mtime after writes
  • Added 10ms tolerance in assert() for edge cases
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6744 **State:** open **Merged:** No --- Issue #8624 Issue Fixed in this PR: Sequential file edits fail with "File modified since it was last read" showing 1-10ms timestamp differences, even with no external modifications. Root cause: `FileTime.read()` stores `new Date()` instead of the file's actual mtime. After writes, filesystem mtime updates can lag slightly (especially Windows NTFS, and WSL2), causing false positives in `assert()`. Fix: - `FileTime.read()` now accepts optional `mtime` parameter - All write operations pass actual file mtime after writes - Added 10ms tolerance in `assert()` for edge cases
yindo added the pull-request label 2026-02-16 18:17:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12079