Repository navigation
Conversation
|
No actionable regression identified in the single-updater source paths reviewed at Verified by source inspection: the update pass requests watcher suspension before processing plugins, discards buffered watcher events while suspended, stops the pending reload timer, and prevents automatic watcher restarts until resumed. A successful update still requests a full plugin reload.
These are source-traced paths, not observed desktop behavior. The added test checks stubbed IPC call ordering, not the real watcher or QML recreation. Scope limitation: suspension is best-effort. An older running shell or failed IPC can leave the watcher active. Overlapping updater processes are also not protected as a group: one can request a full reload while another is still writing. These are residual coverage limits, not new regressions or reproduced crashes. Review informationTest scope: source-only comparison of the updater, IPC wrapper, watcher/reload logic and added test. No tests or live Quickshell crash reproduction were run; the reported SIGSEGV fix remains unverified on a running desktop. Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra Medium initial inspection, independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments, followed by Astra source-based adjudication. |
8cc39c0 to
8cf1ce6
Compare
|
Updated at "8cf1ce64" on current "quattro". Thanks @tymurbogach for the #12859 crash report — the "inotify" burst plus the "QQmlObjectCreator::finalize" stack made the mutation/reload ownership problem very clear. I also found @othavi0's earlier #8583 while doing the related-issue audit. Their measurements show the same broader race in both update and remove paths, including hundreds of watcher events during recursive removal, so I linked that history instead of treating this as an isolated update bug. I tightened the update path in two places. First, watcher suspension is no longer best-effort. If a shell is reachable, "setLocalPluginWatch false" must succeed before the checkout can move. The regression forces that IPC call to fail and verifies the plugin "HEAD" stays unchanged and no rescan occurs. Second, concurrent updater processes are now serialized with a per-user "flock". One updater cannot resume the global watcher while another updater is still mutating. The regression starts two real updater processes, blocks the first during validation, and verifies the second cannot acquire watcher ownership until the first completes. Afterward it sees the checkout as already up to date, so there is only one "suspend → mutation → rescan → resume" cycle. I also split preparation from mutation: fetch/diff/confirmation happens while the watcher stays active; suspension only covers the short filesystem mutation window. The branch is one commit ahead / zero behind current "quattro". The focused regressions are constructed but not executed from this environment; live Quickshell update validation is still pending. |
Automated AI review
Follow-up at Verified: both scope limits from the earlier review are addressed for the updater itself. Two narrower gaps remain around the reachability probe and a failed suspend, and the new concurrency test does not detect removal of the lock.
Verified in isolated stub runs: the new regression test passes at this head (5 of 5 runs) and fails on the base and on the previously reviewed head. With stubbed shell IPC and two updaters on different plugins, this head keeps the second updater blocked while the first is mid-update. The previously reviewed head lets the second updater resume the watcher while the first is still writing. Reachability probe treats a starting or unresponsive shell as absent
Impact: a shell that has just started, including Quickshell relaunching itself after a crash, or one whose main thread is blocked for more than 2 s, gets no suspension and no explicit rescan. That case falls back to the pre-PR behavior for this update. The window is narrow, and it is not a new failure mode. Suggested change: treat only the wrapper's "not running" result as "no shell", and fail closed (or retry briefly) on "not ready" or "not responding". Distinct wrapper exit codes, or checking the ping's stderr, would allow that. Failed suspend request sends no compensating resume
Impact: if it happens, local plugin hot reload stays off until the shell restarts or a later update resumes it. No crash path was identified. Suggested change: mark the suspension as attempted and arm the EXIT trap before sending the request, so every exit after an attempt sends a best-effort resume. Optional test improvement: the overlapping-update case in Review informationTest scope: source comparison of the base, previously reviewed head and current head, plus the relevant Quickshell IPC and AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
The first updater has already merged when it blocks in validation, so a second updater reports "up to date" and never suspends whether or not the two are serialized: the case passed with the flock removed. Checking that the lock is held while the first updater is blocked makes it fail without one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed and reproduced. This fixes the crash in #12859. Reproduction. On a VM installed from the Omarchy ISO (Quickshell 0.3.1, Qt 6.11.2), with the real plugin from the report: hardwarchy installed at 2.3.1 and updated to 2.3.2. A plain
The last row shows that suspending the watcher in the updater is what fixes it; the 150 → 500 ms debounce does not. With the PR, the shell logged no watcher reload during the update, and the watcher fired again after it. Tests, run on that VM against Pushed 40f4b7b to this branch. The overlapping-update case passed even with the Left as they are, none blocking:
Second opinion: Codex Medium reviewed it over two rounds. It found the vacuous lock test independently of the earlier community review, and asked for the isolation run in the last table row. On this head it found nothing that blocks. It could read this review's working notes, so its agreement is not guaranteed to be independent.
|
|
| SHELL_AVAILABLE=0 | ||
| if omarchy-shell shell ping >/dev/null 2>&1; then | ||
| SHELL_AVAILABLE=1 | ||
| fi |
There was a problem hiding this comment.
ping failure does not prove the shell has stopped. omarchy-shell also fails when a live shell takes longer than its timeout to answer. This branch then skips suspension and allows the merge. If the shell recovers during the merge, its watcher can reload partially written plugins—the race this PR aims to fix.
Allow mutation without suspension only when the shell is confirmed absent. Abort on an unanswered live shell.
Knowledge Base Used: CLI command platform
| function setLocalPluginWatch(enabled: string): string { | ||
| var on = enabled === "true" || enabled === "1" || enabled === "on" | ||
| shell.pluginRegistry.setLocalPluginWatch(on) | ||
| if (!on) localPluginReloadTimer.stop() | ||
| return on ? "watching" : "suspended" |
There was a problem hiding this comment.
setLocalPluginWatch(false) stops new watch events, but it does not wait for a reload already in progress. A local edit during preparation can start reloadPlugins() before suspension. Its pending finishPluginReload, running scan, or asynchronous component load then continues while the updater merges files. This can still load an incomplete plugin tree and trigger the original crash.
The suspension call must wait for existing plugin reads and loads to finish, or refuse mutation until they finish.
Knowledge Base Used: Shell UI and desktop interactions
| suspend_local_plugin_watch | ||
| trap cleanup EXIT |
There was a problem hiding this comment.
Failed request leaves watch disabled
Cleanup is installed only after the suspension request succeeds. The shell can apply setLocalPluginWatch false, but its reply can time out or the updater can be interrupted before it records success. The updater then exits without restoring the watcher, leaving local plugin reloads disabled until the shell restarts.
Install cleanup before requesting suspension and record that restoration may be needed before sending the request.
| runtime_dir="${XDG_RUNTIME_DIR:-/tmp}" | ||
| lock_file="${OMARCHY_PLUGIN_UPDATE_LOCK:-$runtime_dir/omarchy-plugin-update-$UID.lock}" | ||
| exec 9>"$lock_file" || fail "cannot open update lock: $lock_file" |
There was a problem hiding this comment.
If XDG_RUNTIME_DIR is unset, the new lock uses a predictable file in /tmp. Another local user can create /tmp/omarchy-plugin-update-<victim UID>.lock without granting the victim write access. Opening the lock then fails, and the victim cannot remove the other user's file from sticky /tmp.
Use a private user-owned directory for the fallback.
How this was verified: The fallback opens an attacker-precreated shared-directory file for writing and aborts when that file denies write access.
| if (( UPDATED_ANY )) && (( SHELL_AVAILABLE )); then | ||
| omarchy-shell shell rescanPlugins >/dev/null || | ||
| echo "omarchy-plugin-update: warning: shell rescan failed; updated plugins will load on the next shell rescan" >&2 |
There was a problem hiding this comment.
Failed update loses pending reload
Suspension stops localPluginReloadTimer and discards watch events, but the final rescan runs only after a successful update. If a local edit has a pending reload and every planned merge fails or rolls back, that reload is canceled and never replaced. The shell keeps showing the old plugin code until another edit or a manual reload.
Request a rescan after every suspended mutation phase, including failed updates, so existing edits are not lost.
|
Reviewed again after this branch stopped merging cleanly with The conflict is in Reproduction, on a VM installed from the Omarchy ISO, with the shell linked to each tree. Each round puts the real Hardwarchy plugin back at 2.3.1, then runs the pair its update button runs,
The crash follows the explicit reload, not the watcher. Why I did not push a fix: removing the rescan would stop the crash on the button path. It would also mean a plain Related: #15434 changes the same Second opinion: Codex Medium read the merge resolution and the measurements. It agrees the resolution keeps both sides intact, that the PR does not fix the update-button crash on current Waiting on the maintainer to decide how the updater and the restart should coordinate. This PR then needs reworking to match. |
Summary
Fixes #12859.
"omarchy plugin update" mutates a third-party plugin checkout while "PluginRegistry" recursively watches the same tree with "inotifywait".
A fast-forward can therefore emit a burst of filesystem events while QML files are only partially updated. The shell may begin "reloadPlugins()" during that burst and recreate components from an inconsistent tree.
This revision makes the update mutation an explicitly owned critical section:
Ordinary local editing still uses a trailing reload debounce, now "500 ms".
Why the first revision was incomplete
The earlier version correctly stopped the watcher during one updater process, but two ownership gaps remained.
Watcher suspension was best-effort
The updater used:
omarchy-shell -q shell setLocalPluginWatch false >/dev/null || true
"-q" deliberately converts IPC failure into success.
That means a live older shell, missing method, timeout, or other suspension failure could leave the watcher active while the script continued modifying the tree.
This revision first checks whether a shell is reachable.
If it is, successful watcher suspension is now a prerequisite for mutation:
live shell
→ suspend succeeds
→ mutation allowed
versus:
live shell
→ suspension fails
→ abort before git HEAD moves
If no shell is running, there is no active shell watcher to suspend.
Concurrent updaters could fight over one global watcher
Two update processes could previously do:
A: suspend
B: suspend
A: merge
A: rescan
A: resume
B: still merging
At that point A has re-enabled observation while B is still mutating the plugin tree.
The updater now takes a per-user "flock" for the complete update session before fetching or modifying plugins.
A second updater cannot acquire watcher ownership or mutate a checkout until the first updater has completely finished.
Mutation lifecycle
The script now separates update preparation from filesystem mutation.
Preparation
For each target:
fetch
→ compare HEAD / FETCH_HEAD
→ show diff if interactive
→ obtain confirmation
The plugin watcher remains active during this potentially slow/user-interactive stage.
Approved plugin IDs are collected for the mutation phase.
If nothing needs to change, the script exits without touching watcher state.
Mutation
Only after preparation:
acquire/update-session ownership already held
→ probe shell
→ suspend watcher
→ fast-forward approved plugins
→ validate
→ rollback invalid updates
→ rescan once if anything changed
→ resume watcher
The "EXIT" cleanup path also attempts to restore the watcher if the updater exits unexpectedly after suspension.
Shell-side watcher behavior
While watcher observation is disabled:
Resuming watcher observation starts it again if necessary.
For normal edits outside "omarchy plugin update", the trailing reload debounce changes from "150 ms" to "500 ms" so short recursive write bursts have more time to settle.
Concurrent-update invariant
The required invariant is:
«At most one plugin updater may own the watcher/mutation lifecycle at a time.»
The new regression exercises two real updater processes.
The first updater:
acquires lock
→ suspends watcher
→ merges
→ blocks during validation
A second updater starts while the first is blocked.
The regression verifies that it cannot issue another watcher suspension or mutate the checkout.
After the first updater completes and releases ownership, the second proceeds, observes the already-updated checkout, and reports it as up to date.
Only one:
suspend → mutation → rescan → resume
cycle occurs.
Fail-closed regression
The test also models a reachable shell whose:
setLocalPluginWatch false
call fails.
It records the plugin's "HEAD" before the update and verifies:
This pins the actual safety boundary rather than only checking source wiring.
Related work
#12859
The direct reproduction for this PR.
Thanks @tymurbogach for capturing the Quickshell crash, the event burst, and the "QQmlObjectCreator::finalize" stack. That made it clear the failure belongs to the host reload lifecycle rather than the plugin being updated.
#8583
@othavi0 independently measured the same broader mutation/watcher overlap earlier, including:
#8583 was closed after Agent Bar added its own workaround, not because the host-level reload overlap disappeared. Its measurements are useful supporting evidence for the ownership model here.
This PR intentionally fixes the "plugin update" path required by #12859.
"plugin remove" has the same broader class of mutation/watcher interaction described in #8583 and should reuse this ownership primitive rather than growing a separate timing workaround.
"plugin add" is less severe because it stages in a hidden directory and exposes the completed tree with a single final move.
Regression coverage
"test/shell.d/plugin-update-watch-test.sh" now covers:
Normal update
ping
→ suspend
→ merge / validate
→ rescan
→ resume
Failed suspension
live shell
→ suspension fails
→ no mutation
→ no rescan
Concurrent update
updater A owns lock + watcher
updater B starts
→ B cannot suspend/mutate
A completes + resumes
→ B proceeds
→ sees plugin already up to date
The concurrency case uses two actual updater processes and the real "flock" primitive.
Verification status
Rebuilt as one commit on current "quattro":
head: 8cf1ce6
base: 28ceaae
ahead: 1
behind: 0
Final diff audit:
No unrelated file-mode changes.
The new regression tests were constructed against the production updater but have not been executed from this environment.
Final desktop acceptance remains:
Fixes #12859.