Repository navigation
fix: watch directories instead of files on Linux - #2155
Merged
backnotprop merged 1 commit intoOct 25, 2026
Merged
backnotprop merged 1 commit into
backnotprop merged 1 commit into
Conversation
backnotprop
added a commit
that referenced
this pull request
Oct 25, 2026
…owup fix: Linux folder watches keep working past the cap and unreadable folders (follow-up to #2155)
1 task
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.
Summary
Linux folder-browser subscriptions currently use chokidar to watch individual files, even though the UI only needs a notification to refresh the folder listing. On large repositories, this can consume the user's inotify allowance and affect other applications.
This changes Linux directory subscriptions to use one
fs.watchper directory instead of per file..jj/alongside.git/.When a subscription stops watching, Plannotator logs the reason and sends a final refresh notification. Automatic file refresh stops for that subscription; other subscriptions remain active. Exact-file and Git metadata watches are outside the directory-watch budget.
Closes #1439.
Verification
On a Linux fixture containing 100 files in two subdirectories, owned inotify watches dropped from 103 to 3. Increasing the fixture to 500 files still used 3 watches.
Passed:
bun run typecheckbun run build:piRuntime checks covered nested file creation, edits and deletion; directory recreation and moves; real permission denial; injected watch-capacity failure; and cleanup during startup. The capacity check confirmed that the affected subscription released its watches after reaching the limit.
Limitations and feedback
There's a limit of 512 directory watches shared across subscriptions in each registry. If a subscription reaches that limit, it releases its watches and stops refreshing automatically, while other subscriptions keep working. This protects resources, but large repositories may hit the limit. Feedback on the limit and this behavior would be helpful.
The full test suite did not pass in the container. Two Git authentication-helper tests failed on both unchanged
mainand this patch with the container's older Git, and both passed with the host's newer Git. Other tests needed PowerShell or network access that the container didn't have. The run also ended without a final test summary.Code review raised one possible timing problem: two overlapping folder scans might interfere with each other. Eight small create, rename, and recreate trials still picked up later file edits, so we haven't reproduced that problem or ruled it out. No change was added based only on that possibility.