Repository navigation
Conversation
Automated AI review
Verified: the change removes the reload triggers behind #11929. In live
Verified: writing QML files, Open PRs #12189 and #10705 edit the same
|
| PR | Adds | If combined with this PR's --exclude |
|---|---|---|
| #12189 | --include "(manifest\\.json$|\\.manifest\\.json$|\\.(qml|js)$)" plus an allowlist in localPluginIdForPath |
inotifywait exits 1 with include and exclude regexp cannot both be specified.; onExited restarts it every second and no events arrive, so hot reload stops |
| #10705 | a second --exclude (.git, __pycache__, node_modules) |
only the last --exclude applies; the warning goes to stderr, which the shell discards |
Impact: whichever PR merges second can silently disable hot reload (#12189) or drop one of the two filters (#10705) if the conflict is resolved by keeping both lines.
Suggested change: coordinate on a single filter. #12189's allowlist also stops the __pycache__ reloads on its own, so if it lands, this PR's --exclude would need to go.
Suffix patterns in --exclude leave stale paths after a directory rename
libinotifytools applies --exclude before inotifywait updates its watch names for renames. When a directory is renamed away from an excluded name (*.tmp, *.bak, *~), the filtered MOVED_FROM never updates the name, and later events inside that directory are reported under the old path:
mv acme.helper/assets.tmp acme.helper/assets
new file acme.helper/assets/b.svg
base: acme.helper/assets/b.svg
head: acme.helper/assets.tmp/b.svg (stale name, still reloads: id comes from the first segment)
mv .delta.tmp delta (top-level hidden staging name)
edit delta/Widget.qml
base: delta/Widget.qml -> reload
head: .delta.tmp/Widget.qml -> dropped by the existing hidden-entry check, no reload
Impact: a plugin moved into place from a hidden .tmp, .bak or ~ staging directory stops hot-reloading until the watcher restarts. Omarchy's own staging and backup names (.add.tmp.<pid>, .clone.XXXXXX, .<id>.bak.<timestamp>) do not match the patterns, so only manual or third-party flows are affected.
Suggested change: keep only names that are never renamed into place in --exclude, for example (/__pycache__(/|$)|/\.git/) (argv form; not run through inotifywait), and leave the suffix patterns to the JS filter in localPluginIdForPath. In the same runs, the JS filter alone suppressed the artefacts just as well: 21 triggers against 21 in the bytecode and editor run, and 8 against 6 in the rename run, where the 2 extra are the real delta/Widget.qml edits that the head drops.
Unanchored __pycache__ match suppresses plugins whose id contains it
__pycache__ is matched as an unanchored substring in both the regex and relative.indexOf("__pycache__"). bin/omarchy-plugin-validate accepts ids with underscores, so a plugin id such as acme.__pycache__widget is valid. In sandbox runs, edits to that plugin's manifest.json and Widget.qml printed nothing on the head, while the base mapped each to the plugin id.
Impact: such a plugin gets no hot reloads at all. Installs are still picked up, because omarchy plugin add runs an explicit rescan.
Suggested change: match __pycache__ only as a whole path component in both places, for example the regex above (argv form; not run through inotifywait) plus ("/" + relative + "/").indexOf("/__pycache__/") !== -1 in the JS check.
Optional test improvement: the JS filter carries real load. On inotify-tools 4.25.9.0, recursive mode skips the --exclude regex for directory CREATE/MOVED_TO events, so each new __pycache__ directory is still printed and only the new localPluginIdForPath line drops it. The four existing localPluginIdForPath assertions in test/shell.d/fixtures/plugin-registry/shell.qml do not cover any of the new paths, and plugins-test.sh (cited in the PR) validates manifests and a few shell.qml patterns, none of which touch the watcher. Cases such as __pycache__/x.cpython-314.pyc, the temp name __pycache__/x.cpython-314.pyc.1234, a bare .../__pycache__ directory path, Widget.qml~, .Widget.qml.swp, plus a positive helper/x.py, would catch a later removal of that line.
Review information
Test scope: source review of the head against CPython 3.14.7 (importlib._bootstrap_external) and inotify-tools 4.25.9.0 source. Live inotifywait and Python runs used synthetic plugin trees in an isolated sandbox, head and base argv side by side. localPluginIdForPath was evaluated in Node from the source text, not in Quickshell. plugins-test.sh passes on head and base; plugin-registry-contract-test.sh needs a compositor and was not run. No running shell or real third-party plugin, so the full reload storm was not reproduced end to end. The related PRs were checked only by textual merge and inotifywait option behaviour, not reviewed.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
inotifywait applies --exclude before it updates a watch's name on rename, so a directory moved out of an excluded name such as .delta.tmp keeps being reported under the old path; the hidden-entry check then drops every later edit and the plugin never reloads. Keep only names that are never renamed into place in --exclude and leave the editor-temp suffixes to localPluginIdForPath. Match __pycache__ as a whole path component in both places, so a valid plugin id like acme.__pycache__widget is not ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and verified on a disposable Omarchy VM running the shell from this branch. I pushed one fix on top (3689230), described below. Reproduction. I made a plugin directory whose Python package imports five modules (plus one Fix pushed (3689230), acting on two points from the community review above, both reproduced on the VM:
Tests. I ran Second opinion: Codex Medium. I asked it to choose among this PR, #12189 and #10705 without giving it my answer, and it chose this one: #12189's allowlist stops hot reload for helper scripts and assets a plugin uses, and #10705 slows every reload to 1s. It also reviewed the fixed head and found the regex valid and the bytecode cases covered. It raised two conditional cases, which I did not act on: a helper that points What it waits on. CI has not run on the new head, and the maintainer has to decide which of the three competing PRs lands. #12189 and #10705 change the same |
|
| // __pycache__/*.pyc would otherwise cause a reload storm: reload restarts | ||
| // the helper, the helper imports the next module, the import writes the | ||
| // next .pyc, repeat. Editor temp files get the same treatment. | ||
| if (("/" + relative + "/").indexOf("/__pycache__/") !== -1) return "" |
There was a problem hiding this comment.
Valid plugin changes are ignored
A third-party plugin can have the valid ID and directory name __pycache__. The scanner accepts its manifest.json, but this check rejects every path inside that directory. The plugin can load at startup, yet later source edits never trigger localPluginChanged, so the running shell does not reload it.
Knowledge Base Used: Shell UI and desktop interactions
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/helper/__pycache__/x.cpython-314.pyc"), "", "python bytecode is ignored") | ||
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/helper/__pycache__/x.cpython-314.pyc.1234"), "", "python bytecode temp files are ignored") | ||
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/helper/__pycache__"), "", "python bytecode dirs are ignored") | ||
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/BarWidget.qml~"), "", "editor backups are ignored") | ||
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/.BarWidget.qml.swp"), "", "editor swap files are ignored") | ||
| root.assertEqual(registry.localPluginIdForPath(cloneBase + "/helper/x.py"), "dhh.clock", "plugin helper sources are watched") | ||
| root.assertEqual(registry.localPluginIdForPath(registry.pluginsDir + "/acme.__pycache__widget/BarWidget.qml"), "acme.__pycache__widget", "plugin ids containing __pycache__ are watched") |
There was a problem hiding this comment.
Watcher filter remains untested
These assertions call only localPluginIdForPath; they do not test the new inotifywait --exclude filter, which runs before that function. A watcher-level regression could therefore pass this fixture while bytecode writes still cause reloads or real source edits stop triggering them.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
#15093 has merged into This one is not made redundant by that merge, so it stays open. Read against
It now conflicts with What was checked: both diffs read against Next: waiting on the maintainer to decide whether the editor-temp filtering is wanted on top of #15093, or whether #12189's allow-list should settle it instead. |
Fixes #11929.
The local plugin watcher forwarded every write under the plugin dir to localPluginChanged, including pycache/*.pyc written by the plugin's own Python helper. Reload restarts the helper, the helper imports the next module, the import writes the next .pyc: 20 reloads/sec, ~95% GUI-thread CPU, ~100 defunct children.
Verified with a live inotifywait smoke test (.pyc suppressed, real .qml still fires); plugins-test passes.