summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLuke Parker <[email protected]>2026-02-24 23:10:10 +1000
committerGitHub <[email protected]>2026-02-24 23:10:10 +1000
commit36197f5ff8d98e582b2ea9da3e851937102d2888 (patch)
tree9b0815b3e191201beaba05eef7b4abe4dd83a2b9
parent3d379c20c4973ef2b1c0305dbd1064ba0f1d8e3f (diff)
downloadopencode-36197f5ff8d98e582b2ea9da3e851937102d2888.tar.gz
opencode-36197f5ff8d98e582b2ea9da3e851937102d2888.zip
fix(win32): add 50ms tolerance for NTFS mtime fuzziness in FileTime assert (#14907)
-rw-r--r--packages/opencode/src/file/time.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/opencode/src/file/time.ts b/packages/opencode/src/file/time.ts
index c85781eb4..efb1c4376 100644
--- a/packages/opencode/src/file/time.ts
+++ b/packages/opencode/src/file/time.ts
@@ -61,7 +61,8 @@ export namespace FileTime {
const time = get(sessionID, filepath)
if (!time) throw new Error(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
const mtime = Filesystem.stat(filepath)?.mtime
- if (mtime && mtime.getTime() > time.getTime()) {
+ // Allow a 50ms tolerance for Windows NTFS timestamp fuzziness / async flushing
+ if (mtime && mtime.getTime() > time.getTime() + 50) {
throw new Error(
`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.`,
)