Skip to content

Coalesce plugin reloads and exclude .git from inotify - #10705

Open
gw7523 wants to merge 3 commits into
omacom:quattrofrom
gw7523:fix/plugin-watch-debounce
Open

gw7523 wants to merge 3 commits into
omacom:quattrofrom
gw7523:fix/plugin-watch-debounce

Conversation

@gw7523

@gw7523 gw7523 commented Sep 7, 2026

Copy link
Copy Markdown

Fixes #10702

inotifywait -m -r on ~/.config/omarchy/plugins watches every plugin .git. Working-tree writes (git checkout, editor saves) still fire localPluginChanged, and localPluginReloadTimer reloads the whole graph every 150ms. An omamail checkout here produced a reload storm, then no bar (with #10703).

  • pass --exclude for .git / __pycache__ / node_modules
  • coalesce reloads to 1s
  • test/shell.d/plugin-watch-test.sh asserts both

--exclude filters events, not watches; skipping .git in the watch list would be a follow-up.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and tested on a disposable Omarchy VM (inotify-tools 4.25.9, quickshell 0.3.1). The fix works, and nothing in it needs changing before a maintainer decides.

What was checked. A local plugin under ~/.config/omarchy/plugins holding a 300-file git repository, run against current quattro (821ae58) and against quattro with this branch merged. The merge is clean, and the watcher and timer code are unchanged on quattro since this branched. A probe counted full plugin rescans:

quattro with this PR
8 git checkouts, 400ms apart 7 rescans 1
10 editor saves, 300ms apart 6 rescans 1
inotify watches held 292 284

The coalescing is what fixes #10702. localPluginIdForPath already dropped .git paths, so --exclude mostly cuts how many events QML has to parse. As the description says, it does not reduce the watches held. The shell crash in the issue did not reproduce on either tree, so this shows the reload storm ending, not the crash.

Tests. plugin-watch-test.sh, plugin-registry-contract-test.sh and runtime-smoke-test.sh pass on the worker against a live compositor, and plugin-watch-test.sh fails on quattro as it should. ./test/cli has one failure, vscode generated theme references current theme file, and it fails the same way on quattro. plugins-test.sh could not run because the worker has no node. This repository has no CI checks on this PR.

Second opinion. Codex Medium reviewed the same diff. It agreed the problem is real and the change is proportionate (independence is not guaranteed, since it can read this review's working notes). It also raised three non-blocking points, checked against the source:

  • --exclude filters file events, but inotifywait still reports newly created directories under excluded paths. I saw this for .git/objects/xx, and those are dropped by localPluginIdForPath. The same mechanism lets a new directory under node_modules or __pycache__ still trigger a reload, which is no worse than today.
  • A plugin that keeps its QML under a node_modules/ path will no longer hot-reload when those files change. That is unusual, but the manifest validator allows it.
  • In test/shell.d/plugin-watch-test.sh:12, grep -Fq '.git' already passes on quattro, because PluginRegistry.qml mentions /.git/ in localPluginIdForPath, and node_modules is not asserted. The test is a source-text check, so the reload counts above are the real evidence that coalescing works.

Nothing was pushed to this branch. It now waits on the maintainer.

@jandrusk

Copy link
Copy Markdown

Fixes #10702. Current quattro already skips /.git/ in localPluginIdForPath, but inotify still watches those trees and the reload timer is still 150ms — so --exclude + 1000ms coalesce still help (#11929 / #12601 reload storms, #7150 watcher leaks).

Ready for review from here; consider coordinating with #15023 / #13911 so we do not stack three partial reload fixes.

omarchybot and others added 2 commits November 16, 2026 23:06
quattro reworked localPluginReloadTimer to rescan when only new plugins appeared and fully reload only when a loaded plugin changed (omacom#18198). Keep that onTriggered and carry this branch's 1000ms interval onto it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It greps PluginRegistry.qml and shell.qml for the strings this branch adds, which AGENTS.md rules out for a config value change, and its .git check already passes on quattro because localPluginIdForPath mentions /.git/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch had stopped merging into quattro, so I merged quattro into it and pushed two commits (79916e1). The fix works on current quattro. The new head is waiting for CI, and for the maintainer to decide.

What I pushed.

  • 32604f7 merges quattro. Since this branched, quattro changed localPluginReloadTimer so that it only rescans when a new plugin shows up, and fully reloads only when a plugin that is already loaded changes (Add new plugins without reloading the ones already running #18198). I kept that handler and put this branch's 1000ms interval on it. The net change against quattro is now the --exclude argument and the interval.
  • 79916e1 removes test/shell.d/plugin-watch-test.sh. It only checked that the source contains the new strings. The Tests section of AGENTS.md asks for no such test, and no test at all for a config value change. Its .git check also passed on quattro without this change. The description still lists that file, so that line can come out.

What was checked. Everything ran on a disposable Omarchy VM (inotify-tools 4.26, quickshell 0.3.2), with the shell running from each tree in turn. The test plugin was a local plugin whose src/ holds a 300-file git repository. A rescan reads every plugin's manifest.json, so I counted rescans by counting opens of that file:

quattro this branch this branch, interval back at 150ms
8 git checkouts, 400ms apart 4 rescans 1 4
10 saves of 3 files, 300ms apart 5 1 4
one save 1 1 1

All of the improvement comes from the longer interval. localPluginIdForPath on quattro already drops .git and __pycache__ paths (#15093), so --exclude stops no reloads. It only means fewer events reach QML: 7,200 instead of 7,368 over the 8 checkouts. It also does not reduce how many inotify watches are held. These numbers show the reload storm from #10702 ending. They do not show the crash ending, which I did not reproduce.

Tests. Passed on the VM at this head: plugin-registry-contract-test.sh, plugin-watcher-reap-test.sh, plugin-add-test.sh, plugin-enable-test.sh, plugins-test.sh and ./test/cli. runtime-smoke-test.sh fails one check, keepLoaded fixture service IPC responds, and it fails the same way on quattro. CI has not run yet: the workflow runs for this push are waiting for a maintainer to approve them.

Second opinion. Codex Medium and muse-wonder (pi, thinking high) reviewed the merged head and the measurements, and neither found a blocking defect. Both agreed the timer merge and the regex are correct, and that removing the test was right. Their independence is not guaranteed, since they can read this review's working notes. They added two points about --exclude. I checked both against the source, and both are the maintainer's to weigh rather than defects to fix here:

  • Excluding node_modules goes beyond this bug. A plugin that keeps QML it loads under a node_modules/ path will no longer hot-reload when those files change.
  • The pattern matches anywhere in the path, so a plugin directory literally named __pycache__ is no longer watched. quattro's registry test (fixtures/plugin-registry/shell.qml:508) deliberately keeps such a directory watched. This is unlikely in practice.

Related pull requests. I compared the other open pull requests that touch the plugin watcher or the reload timer. Each fixes a different bug or a single trigger: #12189 (runtime-state writes), #12020 (bytecode, already covered on quattro), #13006 (pausing the watcher during omarchy plugin update), #11408 and #15688 (stale compiled QML), #14402 (log noise) and #8766 (symlinked plugins). This is the oldest change that coalesces bursts in general. The current head of #12189 filters in localPluginIdForPath rather than passing --include, so the two can both land: inotifywait refuses --include and --exclude together.

This waits on CI approval and then on the maintainer.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Filters plugin watcher events from .git, __pycache__, and node_modules, and increases the reload delay from 150 milliseconds to one second.

  • The plugin watcher filters noisy paths and waits before reloading.

Reviews (1) · Last reviewed commit: "Drop the source-grepping plugin watch te..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recursive plugin inotify + 150ms reload: git checkout / save storms take down the shell

3 participants