Skip to content

Make the closing plugin rescan best-effort - #11117

Open
Mario-Mohar wants to merge 3 commits into
omacom:quattrofrom
Mario-Mohar:plugin-rescan-best-effort
Open

Mario-Mohar wants to merge 3 commits into
omacom:quattrofrom
Mario-Mohar:plugin-rescan-best-effort

Conversation

@Mario-Mohar

Copy link
Copy Markdown

Fixes #11115.

The problem

All four plugin commands run under set -euo pipefail and end by telling the shell to reload:

omarchy-shell shell rescanPlugins >/dev/null

omarchy-shell wraps every call in timeout ${OMARCHY_SHELL_IPC_TIMEOUT:-2s} and exits 1 on expiry. The reload this line triggers is exactly the thing that can take longer than two seconds, so the command aborts on its own last request. >/dev/null only covers stdout, so omarchy-shell is not responding still reaches the terminal.

Measured on a machine with 9 git managed plugins: a rescan with nothing to reload takes 0.05 s, one right after a real plugin update takes 1.65 s, and a second one arriving while the first is still rebuilding hits the 2 s limit. The rescan itself always completes. Only the client gives up.

What that costs depends on what follows the call:

command line what an abort costs
omarchy-plugin-update 131 exit 1 after every plugin was fast forwarded correctly
omarchy-plugin-remove 117 exit 1 after the plugin was removed
omarchy-plugin-add 149 the enable decision never runs; plugin installed but disabled, and no "enable it later with" line
omarchy-plugin-clone 149 discovery, enable, notification and the closing message never run

The exit code is not only cosmetic. #10021 and #10326 both want plugin updates to run from omarchy update, unattended. A step that exits 1 after doing its job would report the whole system update as failed.

The add and clone rows may also be the real mechanism behind #9304, which reports a plugin landing installed but disabled and attributes it to the later enablePlugin call. With --enable --yes both paths produce the same output, so it is worth checking which one fires there. This PR does not close that issue.

The change

omarchy-shell -q shell rescanPlugins

-q is described in omarchy-shell's own help as "Quiet best-effort mode. Suppress output and return success even when the shell, target, method, or arguments are unavailable", and it is already how ten other commands make best-effort IPC calls (omarchy-osd, omarchy-reminder, omarchy-theme-bg-set, omarchy-update-status among them). None of the six plugin commands used it. It also covers stdout, so the >/dev/null goes with it.

The call is still made. Only its failure stops being fatal.

Testing

New test/shell.d/plugin-rescan-test.sh. Its omarchy-shell stub reproduces the real one: without -q it prints omarchy-shell is not responding and exits 1, with -q it exits 0 silently. Six assertions covering all four commands, plus one that counts the logged rescans so best effort cannot quietly become no effort.

Each of the four fixes was reverted on its own to confirm the test fails without it, and fails on the matching assertion:

only omarchy-plugin-update reverted -> exit=1  not ok - plugin update survives a rescan that times out
only omarchy-plugin-remove reverted -> exit=1  not ok - plugin remove survives a rescan that times out
only omarchy-plugin-add    reverted -> exit=1  not ok - plugin add survives a rescan that times out
only omarchy-plugin-clone  reverted -> exit=1  not ok - plugin clone survives a rescan that times out

./test/all before and after this change fails the same 6 of its test files, none of them plugin related: config, locate, runtime-smoke, screenshot-sanity, snapper, unowned-system-paths. They want an omarchy-pkgs checkout or a live compositor, neither of which this machine has. The file count goes from 236 to 237 with the new test.

Also verified against the running desktop: omarchy plugin update with two real plugins behind their origin exits 0 and stays quiet, where before it printed the error and exited 1.

The four plugin commands run under `set -e` and end by asking the shell to
rescan. `omarchy-shell` exits 1 when its 2s IPC timeout expires, and that is
exactly what happens when the reload the command itself just triggered takes
longer than two seconds. So the command dies on that line.

For update and remove the work is already done at that point, so they report
failure for a run that succeeded. For add and clone the abort lands before the
plugin is enabled, leaving it installed but disabled with nothing printed about
how to enable it.

`omarchy-shell -q` exists for this and is already how ten other commands make
best-effort IPC calls. It also suppresses stdout, so the `>/dev/null` goes with
it. The call is still made, only its failure stops being fatal.
spencerbull added a commit that referenced this pull request Sep 22, 2026
A bare `omarchy-shell shell rescanPlugins` exits 1 when no shell answers on the caller's tree, and omarchy-migrate runs migrations under `set -e`, so an update run from a TTY or over ssh, or one whose shell had gone down while the package replaced its QML, died at "omarchy-shell is not running" before its post-update hooks, shell restart and reboot prompt, and re-failed the same way every time until a shell could be asked. The rescan is now best-effort, like `omarchy-bar put` already is and like #11117 makes the plugin commands' closing rescan: the update restarts the shell once the migrations are through, and a session without one has no bar to place on. An unknown widget on a live shell still leaves the migration pending.
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@Mario-Mohar

Copy link
Copy Markdown
Author

Quick check-in on this one. It still merges cleanly on current quattro, and its tests and the other plugin tests pass there. The same goes for #11118.

Since it went up, #12853 applied the same -q rescan to the Elsewhen migration, and @lancefaul ran into the unguarded rescan in omarchy plugin add on their own in #9304. So the same pattern has come up twice more in the meantime.

@spencerbull, since #12853 already builds on this, would you be up for a look? Happy to rebase, split or change anything if that makes it easier to review.

@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 at 73fdb0f. I reproduced the bug and confirmed the fix on a disposable Omarchy worker; I found nothing to change.

Reproduction. I wrote my own, separate from the PR's test. It runs the real omarchy-shell (not a stub) against a socket that answers everything at once but takes 3s to answer rescanPlugins, the way a shell busy reloading does, then runs omarchy-plugin-update --yes on a git plugin one commit behind its origin:

  • current quattro (821ae58): the plugin is fast-forwarded, then the command prints omarchy-shell is not responding and exits 1.
  • this head, and this head merged into current quattro: same update, same rescan request received by the shell, exit 0 and no error.
  • either of those with only the omarchy-plugin-update line reverted: exit 1 again.

Tests on the worker. plugin-rescan-test.sh and the other eight plugin test files in test/shell.d/ pass on the head and on the merge with quattro. ./test/cli passes on the head. On quattro, with or without this change, one test fails: vscode generated theme references current theme file. That failure is already on quattro and has nothing to do with this PR.

Read, not run. These are the only four unguarded rescanPlugins calls on quattro; omarchy-shell-config and the Elsewhen migration already use -q. -q also hides a shell that is not running at all, which I followed through each command: add, when not told to enable, falls through to the "Enable it later" line; --enable and clone still fail at their discovery loop if the plugin never shows up, and clone's EXIT trap removes the half-made clone exactly as before. No error is hidden that the command needed. Four one-line changes for four call sites is proportionate. #11118 touches omarchy-plugin-remove too, but in a different place (the enable/disable IPC budget); the two complement each other rather than compete.

Second opinion: none. The configured reviewer, Codex Medium, did not review this one: omabot's daily review budget was used up when this ran. Everything above is one model's review (Claude Opus 5.5) plus the worker results.

Next: this is verified, but it does not get ready until the second opinion has reviewed it. After that, it waits only on a maintainer.

@ki11e6

ki11e6 commented Oct 3, 2026

Copy link
Copy Markdown

Hit this on omarchy 4.0.4-1 with omarchy plugin add https://github.com/SmoothPixels/lock-designs.git --enable: Added … then omarchy-shell is not responding. The journal shows the shell reloading plugins at that moment (Local plugin changed, reloading), so the abort is at the unguarded rescanPlugins on line 149, as described here. One difference from #9304: this plugin declares "clonedFrom": "omarchy.lock", so the shell switched it in by itself and it ended up enabled. A plugin without clonedFrom would have been left disabled.

omarchybot and others added 2 commits November 16, 2026 23:26
quattro's omarchy-plugin-update now asks the shell to reloadPlugins rather than rescanPlugins (omacom#18198), so the conflict resolves to the same best-effort call on the new method: omarchy-shell -q shell reloadPlugins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the merge with quattro, omarchy-plugin-update asks for reloadPlugins, so the test's exact count of four rescanPlugins calls fails, and its update case no longer reaches the failure it stubs. Rather than rework it, drop it: quattro's AGENTS.md asks that a small change get no new test file, that tests not exercise their own stub, and that tests stay in proportion to the change. The fix itself is the same -q flag on four calls, the pattern ten other commands already use for best-effort IPC.

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

Reviewed again at 9acc5c0. Since the last review, quattro changed the line this PR edits in omarchy-plugin-update, so the PR stopped merging. I brought it across and pushed two commits to the branch:

  • 51b6fc7 merges quattro. Add new plugins without reloading the ones already running #18198 moved update's closing call from rescanPlugins to reloadPlugins, which rebuilds the plugins from fresh code. So the conflict resolves to omarchy-shell -q shell reloadPlugins: still best effort, but on the call quattro now makes. The other three lines merged unchanged.
  • 9acc5c0 drops test/shell.d/plugin-rescan-test.sh. It failed after the merge, because it counts exactly four rescanPlugins calls and update now sends reloadPlugins. Rather than adapt it, I removed it. quattro's AGENTS.md asks that a few changed lines get no new test file and that a test not exercise its own stub, and here the stub supplies the -q behaviour under test. shell-ipc-test.sh already covers -q against the real omarchy-shell. If you would rather keep a test, extending plugin-add-test.sh is where it would fit.

The net change against quattro is now the four one-line -q edits.

Reproduction, on a disposable Omarchy worker. I ran the real bin/omarchy-shell from each tree against a socket that answers at once except for rescanPlugins and reloadPlugins, which it answers after 3s. The default 2s timeout applied. Each tree ran omarchy-plugin-update --yes on a git plugin one commit behind its origin, then omarchy-plugin-add <repo> --yes and omarchy-plugin-remove --yes:

  • current quattro (3b36b9e): all three commands do their work, then print omarchy-shell is not responding and exit 1 after about 2s. Add never prints its "Enable it later with" line.
  • this head: all three exit 0 with no error, add prints its enable line, and the shell receives the same reload and rescan requests.
  • this head with the four lines restored from quattro: exit 1 again, as on quattro.

Tests on the worker. On this head, all nine plugin* test files, menu-plugin-test.sh, shell-ipc-test.sh and ./test/cli pass.

Second opinion. Codex Medium and muse-wonder (thinking high) reviewed the merged tree. Both found no defect: they agreed the merge resolution keeps quattro's reload semantics and that dropping the stub test fits the house rules. That is agreement, and its independence is not guaranteed. Each added a point of its own:

  • Codex Medium. On quattro, rescanPlugins returns once it has started an async scan. So the 3s reply above shows how the commands react to a late answer, not that a scan itself takes that long. A real shell answers late when its event loop is busy: update's own reloadPlugins unloads panels, services and widgets before it replies, and a reload set off by the file watcher can be running when the call arrives. @ki11e6's report above, with the journal showing Local plugin changed, reloading at the moment of the error, is that case on a real install.
  • muse-wonder. If the shell is not running at all, add --enable and clone no longer stop at the rescan with "not running". They fall through to their discovery loop and fail there, more slowly and with a less precise message. Clone's EXIT trap still removes the clone, so the outcome is the same; only the error is worse. I left this as is; it is not a reason to hold the fix.

Description. The PR body still describes the deleted test and says update uses rescanPlugins. @Mario-Mohar, it is worth updating so it matches the diff.

Next: GitHub is holding this fork's CI runs until a maintainer approves them, so CI has not run on this head yet. Once it has run green, this waits only on a maintainer. #11118 complements this PR rather than competing with it.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Makes the closing shell request best-effort in all four plugin commands.

  • Plugin commands continue when the shell refresh request fails.

No actionable issues found. Review was based on code inspection; no tests were run.

Reviews (1) · Last reviewed commit: "Drop the stub-driven rescan test" · 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.

omarchy plugin update exits 1 after a successful update: set -e aborts on the unguarded rescanPlugins when its 2s IPC timeout expires

3 participants