fix(watcher): Linux swallows Create events (debounce replaces instead of merges) - #5
Closed
NestorCanales wants to merge 1 commit into
Closed
fix(watcher): Linux swallows Create events (debounce replaces instead of merges)#5NestorCanales wants to merge 1 commit into
NestorCanales wants to merge 1 commit into
Conversation
…wallowed On Linux, writing a new file emits CREATE then WRITE as separate inotify events within milliseconds. The per-path debouncer replaced the pending callback on each event, so the WRITE cancelled the CREATE and the handler reported a modification — OnCreate never fired for any newly created file (TestOnCreate failed deterministically on Linux; macOS's event coalescing masked the bug). No user impact today because engine.OnCreate and OnModify both index the file, but any future divergence would break Linux silently. The debouncer now accumulates fsnotify ops per path (OR) and classifies the merged set when the timer fires, with precedence Remove/Rename > Create > Write/Chmod. Single-event behavior is unchanged. Verified: watcher suite passes 3/3 on macOS and 3/3 on Linux arm64 (golang:1.26-bookworm container); previously 3/3 FAIL on Linux. Found during local-embeddings Phase 5 (first test run on Linux); report in Documentation/Bugs/fswatcher-create-event-swallowed-linux.md (PR #4). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
NestorCanales
added a commit
that referenced
this pull request
Jul 17, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Windows verification added (2026-07-17, native Windows x64 on the dev PC):
So the fix is now verified on all three OS families: macOS 3/3, Linux arm64 3/3, Windows x64 3/3 (each failing without it on Linux + Windows). Also: the full untagged 🤖 Generated with Claude Code |
NestorCanales
added a commit
that referenced
this pull request
Jul 27, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Consolidated into #2 (single reviewable branch per Bo's review-workflow preference) — all commits from this PR are now in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
On Linux, creating a file emits CREATE then WRITE as two rapid inotify events. The watcher's per-path debouncer replaced the pending event, so the CREATE was swallowed and new files were reported as modifications —
TestOnCreatefails 3/3 on Linux, passes on macOS (whose event coalescing masked this since day one).Found during the local-embeddings epic's Phase 5 Linux work — first time the suite ever ran on Linux. Full report:
Documentation/Bugs/fswatcher-create-event-swallowed-linux.md(lands in #4). Independent of the epic — based onmain, mergeable anytime.Impact
None user-visible today (
engine.OnCreate/OnModifyboth index the file), but any future create/modify divergence would silently break Linux.Fix
The debouncer accumulates fsnotify ops per path (OR) and classifies the merged set when the timer fires: Remove/Rename > Create > Write/Chmod. Single-event behavior identical to before.
Verification
go test ./...green🤖 Generated with Claude Code