Skip to content

Commit 36197f5

Browse files
authored
fix(win32): add 50ms tolerance for NTFS mtime fuzziness in FileTime assert (anomalyco#14907)
1 parent 3d379c2 commit 36197f5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/opencode/src/file/time.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export namespace FileTime {
6161
const time = get(sessionID, filepath)
6262
if (!time) throw new Error(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
6363
const mtime = Filesystem.stat(filepath)?.mtime
64-
if (mtime && mtime.getTime() > time.getTime()) {
64+
// Allow a 50ms tolerance for Windows NTFS timestamp fuzziness / async flushing
65+
if (mtime && mtime.getTime() > time.getTime() + 50) {
6566
throw new Error(
6667
`File ${filepath} has been modified since it was last read.\nLast modification: ${mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
6768
)

0 commit comments

Comments
 (0)