Repository navigation
Conversation
[Medium impact] The changes affect Omarchy desktop shells during package updates and calls to missing shell actions. The PR needs fixes before merging: recovery can restart shells during another transaction, and a restart can leave another desktop session without its shell. Findings
SummaryThis PR pauses shell plugin loads around package replacement and restarts affected shells afterward.
|
| const body = functionBody(name) | ||
| assert(body.length > 0, `${name} is defined`) | ||
| assert( | ||
| /pluginsPaused/.test(body), | ||
| `${name} refuses to load plugin code while plugin loads are paused` |
There was a problem hiding this comment.
Tests check text, not behavior
These assertions only check whether function bodies contain pluginsPaused. They pass even if the check is unreachable or has the wrong effect. AGENTS.md explicitly says, “Don't restate the implementation,” including grepping source for newly added strings. Replace these source checks with behavior tests before merging. The same requirement applies to shell-config-watch-test.sh.
File Used: AGENTS.md (source)
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!
| A second pair of hooks protects the shell while `/usr/share/omarchy/shell/**` | ||
| is replaced. The pre-transaction hook runs `omarchy-shell-reload-guard pause`, | ||
| which asks each running shell to stop loading plugin QML. A shell that predates | ||
| that IPC method is stopped cleanly instead, unless the session is locked: | ||
| stopping a live lock client would strand the session behind Hyprland's | ||
| failsafe. The post-transaction hook restarts the shell in each session the | ||
| guard touched, so the new tree is loaded by a fresh engine rather than hot- | ||
| reloaded into the old one. |
There was a problem hiding this comment.
New paragraphs break formatting rules
The new paragraphs break lines within sentences. AGENTS.md requires full lines in Markdown, with breaks only at headings, list items, and other structural boundaries. Join each paragraph onto one line here and in the new paragraphs in omarchy-shell.md. This repository requirement must be satisfied before merging.
File Used: AGENTS.md (source)
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!
|
Thanks for this, @taxin-404. This pull request has been classified, not yet reviewed or tested: no code from it has run, and no labels were added. The classification is unsettled. Two models classified it separately, at head 0396409. Claude Opus 5.5 read it as a bug fix for #16126, where a running shell hot-loads the new plugin list mid-upgrade and shell-routed keybindings go dead until a restart. Codex Medium read it as an enhancement. The diff supports both readings: alongside the fix (reading the packaged Next step is the maintainer's: deciding whether this is a fix to verify, or new behaviour, and whether the missing-action notification should be split into its own pull request. Once that's settled it will be reviewed and run on a test machine like any other fix. |
0396409 to
b026ec4
Compare
|
Rebased onto current The only conflict was in if guard=$(command -v omarchy-shell-reload-guard); then
if sudo -n "$guard" paused >/dev/null 2>&1; then
sudo -n "$guard" resume >/dev/null 2>&1 ||
echo "Could not resume the shell after the update; restart it to load new plugins." >&2
fi
fi
end_update_authorization
Local runs of |
|
Pushed a follow-up. The re-run now leaves a single failing file, What changed:
The remaining I checked how this test handled the identical situation before. When I'm therefore keeping the |
|
Pushed another round resolving the localized Greptile findings from this review. Fixed:
Leaving for a maintainer call:
|
|
Latest head is 3c2c7bc. Greptile's "related tests are split" finding is resolved: the shell.json watch checks moved into Local runs: |
The default shell.json lives in /usr/share/omarchy and changes only when a package update replaces it. Watching it made a running shell apply the new plugin list during the transaction, so the old engine lazily loaded new plugin QML that referenced types it did not have (omacom#16126). Keep live reload for the user's own shell.json; the update restarts the shell after the package transaction.
The omarchy source now provides PreTransaction/PostTransaction hooks that pause shell plugin loads and restart the shell around package updates. Install them from both the stable and dev packages so they are not inert, and include them in the synthetic source tree that tests/passwordless-package-files.sh builds. Both installs are conditional on the pinned source shipping the hooks. Check for both files, not just the pause hook, so a source with half the pair cannot install a pause hook whose resume never arrives. omarchy-dev currently pins 79dcccfe5, and stable pins v4.0.6; neither contains the source change yet, so an unconditional install would fail the build. The hooks become active when those pins advance. The packaging test now covers a source that ships the hooks and one that predates them, and still asserts the two packages share no path. The companion source change is omacom/omarchy#16900. Verification: tests/passwordless-package-files.sh passes for x86_64 and aarch64.
An upgrade replaces the plugin tree while the old shell still watches it, and the old engine can lazily compile new plugin QML that references types it does not have (omacom#16126). Expose shell pausePlugins and refuse plugin loads from every path that can create them: reloads, registry syncs, services, panels, widgets, and summons. Already-loaded panels keep working; a summon that would mount a new one is declined until the update restarts the shell.
The omarchy package replaces /usr/share/omarchy/shell while the old shell is running. A PreTransaction hook now asks each running shell to pause plugin loads; shells that predate that IPC are stopped cleanly, unless the session is locked, where stopping the lock client would strand the user. A PostTransaction hook restarts the shell in every session the guard touched, so the new tree is loaded by a fresh engine. Hooks are read before the transaction, so this cannot protect the upgrade that installs it; the update's existing shell restart covers that first transition.
A shell left on the old package during an update does not know the newly installed plugin, so the IPC call fails with 'Target not found.' or 'Function not found.' and the keybinding silently does nothing. A non-quiet call now raises one desktop notification per target and method every five minutes; quiet probes, argument errors, and a stopped shell stay silent. The notification is sent in the background and never changes the IPC result.
A failed pacman transaction never runs PostTransaction hooks, so resume the paused shell from the update command's exit path through its existing sudo authorization. A restart refused while the session is locked keeps its state for a later attempt instead of losing track of the paused shell. Only pause a shell whose own OMARCHY_PATH names the tree it runs from, so another Quickshell config that happens to live at shell/shell.qml is left alone, and give the guard's user commands a fixed PATH.
bin-style-test rejects a raw `command -v` in bin/, and the update's cleanup probed the guard through sudo, which broke the single-authorization invariant update-hook-security-test enforces. Use `omarchy-cmd-present` instead, probe the (world-readable) guard state without privilege, and keep the state directory listable so an unprivileged probe can read it.
bin/omarchy-shell ships in the default package set, so the helpers it uses are runtime invariants: call omarchy-notification-send directly instead of guarding it with omarchy-cmd-present.
Address the Greptile findings that are real and localized: - Treat the lock probe's undetermined exit 2 as locked, so a shell that might own the lock screen is never stopped on an unresponsive probe. - Read the guard's records with cut so an empty WAYLAND_DISPLAY or HYPRLAND_INSTANCE_SIGNATURE field does not shift action away and leave a still-running paused shell paused after the transaction. - Require a positive OMARCHY_PATH match before pausing, so a foreign Quickshell config that also lives at shell/shell.qml is left alone. - Write the missing-action stamp only into a directory this user owns, and never through a planted symlink in the shared /tmp fallback. - Freeze the bar while plugin loads are paused, so a shell.json edit or omarchy-bar use mid-transaction cannot instantiate bar QML from the tree being replaced.
AGENTS.md asks a test for an existing command to extend that command's file rather than add a new *-test.sh. The missing-action notification checks are about omarchy-shell, which shell-ipc-test.sh already covers, so they move there and shell-missing-target-test.sh goes away.
AGENTS.md asks a test for an existing area to extend that area's file rather than add a new *-test.sh. The shell.json watch checks move into config-test.sh, and the plugin-pause checks join plugins-test.sh, so shell-config-watch-test.sh and shell-plugin-pause-test.sh go away.
Two review findings on the reload guard: - `quickshell list` ran from the ALPM hook as root, so it read root's home and could create root-owned cache/log files outside the session. Run it through `as_user` like every other call into the session, and resolve the owning user and home from the runtime directory's uid. - State was written only after the shell had been paused or stopped. If the write failed, PostTransaction had nothing to resume and the shell stayed paused forever. Write the record before the action, skip the action when the record cannot be written, and remove the record again when the action fails or is intentionally skipped (locked session). The same state record is rewritten as `stopped` before a kill so resume restarts a stopped shell instead of treating it as a running paused one.
A failed transaction never reaches its PostTransaction hook, so the shell stayed paused. `omarchy update` already recovered in its EXIT trap, but `omarchy-refresh-pacman` runs its own transaction and had no recovery, and `omarchy-channel-set` goes through it. Move the recovery into `bin/omarchy-update-pacman`, the shared transaction path, and keep the command's exit status. The `paused` probe is unprivileged because the state directory is world-readable; resume runs under the authorization the helper already used.
3c2c7bc to
79b5059
Compare
|
Rebased onto current
|
| if omarchy-cmd-present omarchy-shell-reload-guard; then | ||
| if omarchy-shell-reload-guard paused >/dev/null 2>&1; then | ||
| sudo -n omarchy-shell-reload-guard resume >/dev/null 2>&1 || |
There was a problem hiding this comment.
Recovery releases another transaction's pause
While one update holds pacman's lock and replaces shell files, a second omarchy-refresh-pacman can fail because that lock is held. This recovery then calls the global resume, which restarts every recorded shell and removes its pause state while the first transaction is still running. The shell can load files that are still being replaced.
Tie recovery to the transaction that created the pause, and do not resume while another transaction is active. The same global recovery in omarchy-update needs that protection.
Knowledge Base Used: Update orchestration and system maintenance
| if as_user "$uid" "$runtime_dir" "$home" "$user" env \ | ||
| OMARCHY_PATH="$omarchy_path" \ | ||
| WAYLAND_DISPLAY="$display" \ | ||
| HYPRLAND_INSTANCE_SIGNATURE="$signature" \ | ||
| "$restart_bin" >/dev/null 2>&1; then |
There was a problem hiding this comment.
Restart stops other desktop sessions
If one user has two Hyprland sessions running the same shell config, this call to omarchy-restart-shell kills both shells through --any-display but launches a replacement only in the first compositor. The second record then loses its saved PID and is deleted without restarting that session. This can also kill the second session's lock screen without checking it.
Restart only the recorded session, and check its lock before stopping its shell.
|
Correction to my previous comment: I said The full VM run is 428/429 test files otherwise green ( |
|
Reclassified the current head, The classification remains unsettled. The missing-action notifications still introduce behavior for calls outside package updates alongside the transaction guard. This waits on the maintainer to decide the scope of that combined change before verification proceeds. No labels were added. |
Problem
Upgrading while the old shell is running hot-loads new plugin QML into the old engine. The running shell watches the package-owned
config/omarchy/shell.json; the upgrade replaces that file with a list that addsomarchy.elsewhenanddock, and the old engine applies it mid-transaction. Those plugins compile QML that references rc1-onlyShellIpc, so the shell reportsShellIpc is not a typeand keybindings stay dead until a restart.#16880 fixes a separate Qt QML cache-coherence race and explicitly leaves transient errors in a running engine during replacement out of scope. This change closes that window; the two are complementary.
Change
config/omarchy/shell.jsononce at startup. Only~/.config/omarchy/shell.jsonkeeps live reloading.shell pausePlugins: a running shell stops mounting new plugin components and answersok, letting a guard distinguish a shell that supports pausing from an old one. Every plugin load path honors the pause.quickshell listas root read root's home and could leave root-owned cache/log files outside the session.bin/omarchy-update-pacman, the shared transaction path foromarchy updateandomarchy-refresh-pacman(and soomarchy-channel-set). Pacman does not run PostTransaction hooks when a transaction fails, so the helper probes the root-owned, world-readable state as the caller and resumes under the authorization it already used.omarchy updatekeeps its EXIT-trap recovery as a second safety net. A restart refused while locked keeps its state for a later restart or transaction.omarchy-shellinstead of leaving a keybinding silently dead. Quiet probes stay silent and the IPC result is unchanged.The hooks are inert without the packaging install in omacom/omarchy-pkgs#1755.
Limitation
Pacman reads hooks before a transaction, so this cannot protect the upgrade that installs them. The shell restart at the end of
omarchy updatecovers that first transition.omarchy-channel-set's final package swap still calls pacman directly (it may run against a tree that predates this helper). If that swap fails, the pause survives until the next transaction throughomarchy-update-pacman, which the failure message tells the user to rerun.Verification
All of these pass on the branch:
Also
bash -n,git diff --check, and shellcheck 0.11 on the touched scripts (no new findings; the one remainingSC2010inbin/omarchy-shellis pre-existing upstream code).config-test.shpasses locally whenOMARCHY_PKGS_PATHpoints at the omarchy-pkgs branch from #1755. In CI it checks outomarchy-pkgsmaster, which does not ship the two hook files yet, so the requiredtestjob stays red until #1755 merges:That is the one expected failure in the full VM suite (428 of 429 test files pass).