[PR #9450] fix: use actual file mtime instead of Date.now() in FileTime tracking #13114

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

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

State: open
Merged: No


Fixes #7005
Fixes #11436

Store actual file mtime instead of Date.now()

Currently. Date.now() is stored as file mtime, instead of the actual file mtime.

Issue becomes immediately apparent on Windows due to how Windows updates file timestamps, resulting in ~1ms difference, causing flaky fails in apply_patch.test.ts

Fix

  • Change FileTime.read() to store actual file mtime instead of Date.now()
  • This fixes timing jitter issues where mtime could be ahead of Date.now()
  • Make FileTime.read() async and add await to all callers
  • Fix apply_patch logic to not read mtime of deleted/moved files
  • Add 25ms delay before test cleanup to allow file handles to release
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9450 **State:** open **Merged:** No --- Fixes #7005 Fixes #11436 ## Store actual file mtime instead of Date.now() Currently. `Date.now()` is stored as file mtime, instead of the actual file mtime. Issue becomes immediately apparent on Windows due to how Windows updates file timestamps, resulting in ~1ms difference, causing flaky fails in `apply_patch.test.ts` ## Fix - Change `FileTime.read()` to store actual file mtime instead of `Date.now()` - This fixes timing jitter issues where mtime could be ahead of `Date.now()` - Make `FileTime.read()` `async` and add `await` to all callers - Fix apply_patch logic to not read mtime of deleted/moved files - Add 25ms delay before test cleanup to allow file handles to release
yindo added the pull-request label 2026-02-16 18:17:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13114