Repository navigation
Give the plugin commands an IPC budget that fits a reload - #11118
Mario-Mohar wants to merge 1 commit into
Conversation
`omarchy-plugin-enable`, `-disable` and `-remove` each depend on a single IPC call, made in a command substitution under `set -e`. They are normally run right after something started a plugin reload: add and clone call them a step after their own rescan, and saving a file under ~/.config/omarchy/plugins/ starts the same reload through inotify. Rebuilding every plugin instance blocks the shell's IPC for seconds, which is longer than the 2s default budget. The call expires inside that window and the command reports a shell that is not responding, when the shell is merely busy with the very work the command is waiting on. For enable that is the difference between a plugin being activated and being left installed but disabled. Raise the default budget to 15s in these three commands. A shell that is genuinely not running still fails at once, because that is a connection error rather than a timeout, and an explicitly set OMARCHY_SHELL_IPC_TIMEOUT is left alone.
|
Filed the |
|
Reviewed at af0ec3e. The bug is real, it still exists on current Reproduced on a worker built from the Omarchy ISO, against its running shell. I installed a plugin whose bar widget blocks the event loop for 5 s when it is created, enabled it, triggered On every failing run the enable did take effect once the shell came back. The command still exits 1, and under Tests, on the worker: Size: proportionate. It adds one default in each of the three commands whose answer matters, and a test. #11117 handles the closing Reviewed by: Claude Opus 5.5 only. No second opinion ran: the configured reviewer, Codex Medium, had used up its daily review budget. That is why this is labelled |
|
Another data point for this, from a 2017 Pixelbook (Core i5-7Y57, 4.5 W): So besides the larger budget here, |
Fixes #9304.
The problem
omarchy-plugin-enable,-disableand-removeeach hang on a single IPC call, made in a command substitution underset -euo pipefail:result=$(omarchy-shell shell enablePlugin "$id" "$placement")omarchy-shellwraps every call intimeout ${OMARCHY_SHELL_IPC_TIMEOUT:-2s}and exits 1 when it expires, so the substitution fails andset -eends the command right there withomarchy-shell is not responding.These commands are normally run inside the exact window where that happens.
omarchy-plugin-addandomarchy-plugin-clonecall enable a step after their ownrescanPlugins, and saving a file under~/.config/omarchy/plugins/starts the same reload through inotify. Rebuilding every plugin instance blocks the shell's IPC for longer than two seconds, so the call expires and the command reports an unreachable shell, when the shell is busy with the very work the command is waiting on.#9304 reports the user-visible half of this:
omarchy plugin add --enableleaves the plugin installed but disabled, and runningomarchy plugin enable <id>a few seconds later works every time.Reproducing it
does.not.existis used deliberately: no outcome changes anything, so the only variable is which error comes back. Run against a live shell while a real plugin update is reloading:Same command, same moment. Without the change the shell never gets asked; with it, the question is answered correctly.
The window is real but timing dependent. It opens only when the shell has plugin code to reload: a rescan with nothing to load answers in 0.05 s, one right after a real plugin update takes 1.65 s, and one arriving while another is still rebuilding took 7.32 s on this machine with 9 git managed plugins.
The change
in those three commands, with a comment explaining why they are the ones that need it.
Three things this deliberately does not do:
-q. A failed enable is a real failure, and swallowing it would leaveresultempty and producefail "". Only a genuinely best-effort call may be quieted, which is what Make the closing plugin rescan best-effort #11117 does for the closing rescan.qsreports a missing connection as a connection error, not a timeout, soomarchy-shellstill fails at once on its "is not running" path. The budget only applies to a shell that is up and busy.OMARCHY_SHELL_IPC_TIMEOUT. Someone who set one keeps it.15 s comes from the 7.32 s worst case measured here, doubled. #9304 reports a slower reload still with 15 third-party plugins installed.
Testing
New
test/shell.d/plugin-ipc-budget-test.sh. Itsomarchy-shellstub keeps the part under test: the caller's budget wraps the call through a realtimeout, and expiry becomesis not respondingon exit 1. A stub shell that takes 3 s to answer is longer than the old 2 s default and shorter than the new budget, so the same call fails or succeeds purely on the budget. Four assertions: enable and disable both ride out the busy shell, remove asks for the raised budget, and an explicitly set budget is left alone.Each of the three changes was reverted on its own to confirm the test fails without it:
./test/allfails the same 6 of its test files before and after, none of them plugin related:config,locate,runtime-smoke,screenshot-sanity,snapper,unowned-system-paths. They want anomarchy-pkgscheckout or a live compositor, neither of which this machine has.Relation to #11117
Same root cause, opposite remedy, and they are independent. #11117 quiets the closing
rescanPluginsin add, clone, remove and update, where the call is genuinely best effort and its failure should not be fatal. This one gives the calls whose result actually matters enough time to arrive. Both touchbin/omarchy-plugin-remove, in different places; whichever lands second may need a trivial rebase.Unrelated thing noticed while testing
omarchy-shell shell setPluginEnabled <unknown-id> falseanswersok, whereenablePlugincorrectly answersunknown. Soomarchy plugin disable <typo>printsDisabled <typo>and exits 0 without doing anything. That is shell side and out of scope here; I can file it separately if it is not already known.