Repository navigation
fix: a folder's own "modified" event is no change; __pycache__ restarts nothing (#463) - #472
Merged
Merged
Conversation
…ts nothing (#463) On Windows ReadDirectoryChangesW reports a folder as modified when an entry is added to or removed from it, beside the entry's own event. Python creating `__pycache__` in `shared` therefore restarted every dev server with `restart_on = ["shared"]`, although `__pycache__` itself never counts. The watcher now drops a modification event whose path is a directory (a rename keeps its own kind and still counts); what changed in the folder comes with its own path. Bug-Class: an event about a container taken as a change of its contents, bypassing the filter on the contents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pid read after the change during a restart could already be the restarted process; up() then waited 60 s for one that never came (seen on macos-15). One start, then one run per restart: counted in the daemon log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede
force-pushed
the
fix/restart-on-generated-dirs
branch
from
November 6, 2026 12:38
52e7686 to
ef3f975
Compare
This was referenced Nov 6, 2026
Merged
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.
What and why
Closes #463.
Cause. On Windows, ReadDirectoryChangesW (notify
FILE_ACTION_MODIFIED→Modify(Any)) reports a folder as modified when an entry is added to or removed from it, beside the entry's ownCreate/Removeevent. A probe against the real watcher showed it for every new__pycache__:Modify(Any) shared, thenCreate(Any) shared\__pycache__. The entry is filtered (generated directory), but the folder's own event is not, andrestart_on = ["shared"]covers it, so the first start of a Python service restarted every dev server naming the folder.Fix.
event_pathsdrops aModify(Any | Data | Metadata)event whose path is a directory (asked of the file system only after the path-only filter, so generated directories are still never opened). A rename (Modify(Name)), a created or removed folder, and a modified file still count. What changed in the folder comes with its own path;coversstill maps that to a folder pattern.Bug class: an event about a container taken as a change of its contents, bypassing the filter on the contents. The same code path also feeds
watch(candidates) and a lane's copy, so they are covered too. The remote lane's worktree watcher (remote.rs) only sets a "compare now" flag; a folder event there costs a comparison, no restart, so it is left as it is.Tests
a_folder_reported_as_modified_is_no_change_of_its_own: red before the fix, green after.only_a_creation_lists_a_directoryno longer expects a folder'sModify(Any)to count.restart_on_a_folder_restarts_for_each_file_in_it(integration,DEVSTACK_INTEGRATION=1) now also creates a new__pycache__in an existing package and expects no restart, and waits for the restart afterduring.txtitself. It passes with the fix. It also passes without the fix on this machine: the daemon in the test did not get the folder's event, although a standalone probe gets it every time. The unit test is the regression guard.cargo fmt,cargo clippy --workspace --all-targets -D warnings,cargo test -p devstack-daemon: green (Windows 11).🤖 Generated with Claude Code