Repository navigation
Conversation
Reloading any user plugin destroyed omarchy.lock, left Hyprland's ext-session-lock failsafe up, then treated sessionLock.secure as a healthy lock and never drew a surface. Same-process beginLock() also qFatal's in Quickshell. Keep the live lock client across reloads, and recover orphans by restarting the shell so a new process can relock.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves recovery from “wedged”/orphaned session-lock states and makes plugin reload safer when the lock service currently owns the session lock.
Changes:
- Extend lock status semantics to distinguish “secure/requested” from a lock surface actually being mounted (
sessionLocked). - Update lock recovery logic to treat “secure without surface” as an orphaned lock and recover via
omarchy-restart-shell(new-process relock). - Add/extend tests covering wedged-lock restart recovery and plugin reload behavior around the lock service.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/shell.d/restart-shell-test.sh | Adds a wedged-lock test case and updates lock-status stubs to include sessionLocked. |
| test/shell.d/plugin-reload-lock-test.sh | New regression test asserting plugin reload won’t unload the lock service or clear QML cache while it owns the lock. |
| test/shell.d/lock-stranded-recovery-test.sh | Updates expectations to differentiate sessionLock.locked vs sessionLock.secure and validate restart-based recovery. |
| shell/shell.qml | Preserves omarchy.lock during plugin unload if it owns the lock; avoids clearing component cache while lock client is mounted. |
| shell/plugins/lock/Service.qml | Refines “owned vs secured” semantics, adds restart-based stranded/orphan recovery, and caps lock-attach retries. |
| bin/omarchy-restart-shell | Uses sessionLocked to decide when restart is unsafe and to drive relock polling logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| run_node_test <<'JS' | ||
| const fs = require('fs') |
There was a problem hiding this comment.
run_node_test in test/shell.d/base-test.sh already prepends const path = require('path') (and root) to every snippet, which is why the other lock tests also use path.join without a local import. This file matches that contract.
| function recoverStrandedLock() { | ||
| if (!strandedLock || locked || !passwordPamConfigured) return | ||
|
|
||
| if (!passwordPamConfigured) return | ||
| if (sessionLock.locked) return | ||
| if (strandedRestartAttempted || restartShellProc.running) return | ||
|
|
||
| // Same-process beginLock() cannot retake the lock: Quickshell's | ||
| // SessionLockManager::active stays set after the previous WlSessionLock | ||
| // is destroyed, so lock() fails and updateSurfaces() aborts. A new | ||
| // process plus omarchy-restart-shell's relock path is the recovery. | ||
| strandedRestartAttempted = true | ||
| strandedLock = false | ||
| pendingSessionLockTimer.stop() | ||
| sessionLockStabilizeTimer.stop() | ||
| logEvent("lock-stranded: recovering") | ||
| beginLock() | ||
| restartShellProc.running = true | ||
| } |
There was a problem hiding this comment.
Applied. recoverStrandedLock() again requires strandedLock and only beginLock()s. The restart path is now a separate restartForOrphanedLock() that requires lockSurfaceOrphaned (secure && !locked).
|
Tested this branch ( Context: I hit #6888 for real yesterday while investigating #6628, so I was keen to see this land. What worksThe
The loopSetup: Hyprland nested inside my session (Wayland backend) with Each cycle takes ~3.5 s. End state is a locked compositor with nothing running — strictly worse than the 10 Hz stall, which at least kept a process alive to recover from. Why
Two supporting details:
Suggested directionRestarting is only required for the genuine in-process orphan — the stale Caveat on my setupIn the nested compositor the recovered shells reported Happy to re-test any revision the same way — the nested setup makes this safe to iterate on without risking a lockout. Environment: hyprland 0.56.2-1, quickshell-git 0.3.0.r20.g28771c7-1, omarchy-dev 4.0.0.r1761.g7be59e1-1, kernel 7.1.8-arch1-3. Filed by Claude Opus 5 via Claude Code. |
|
Supporting data point: this PR's target scenario just showed up in the wild, with a log that matches the diagnosis in the description almost line for line. quickshell-mirror/quickshell#959 ("Hyprlock crash on wakeup", filed today, reporter on Omarchy Quattro 4.0.0-1). Decoding the attached Their backtrace lands exactly where you predicted: So: a user plugin ( Two notes for whoever picks this up:
Happy to re-test any revision against both triggers (plugin reload, and lock client killed outright) in the nested-Hyprland setup. Filed by Claude Opus 5 via Claude Code. |
Unconditional restart looped: a fresh shell saw the same compositor LOCK and killed itself again until the crash handler gave up. Stock recovery already works when SessionLockManager is clean, so beginLock() there. Restart only when secure && !locked, the stale in-process case that qFatal's on sessionLock.locked = true.
|
Thanks @ChristopherClure — the restart loop is real and the suggested split is the right one.
That should stop the kill-9 / crash-handler loop: every relaunch is a new process that can take the lock instead of killing itself again. Pushed in 9112a85. Happy to have you re-run both triggers (plugin reload while locked, and lock client killed outright) in the nested compositor if you still have that setup. |
|
Retracting my restart-loop report. @v-t-r-gg — I'm sorry, you rewrote this based on a finding I can't support. My test harness was incapable of testing this code path, and I misread the evidence. The control that exposed itI re-ran Stock fails identically: 5 × Nested Hyprland (Wayland backend) cannot take over a stranded What I misreadGoing back to my original Those shells were dying of the Wayland protocol error (the #6628 crash), not because Where that leaves the PR
I'm not going to claim a working test setup for this path until I have one that can demonstrably recover a stranded lock with stock code first. Apologies for the churn. Filed by Claude Opus 5 via Claude Code. |
|
Thanks for the correction, and no harm done. We will keep Agreed that the nested compositor cannot speak to this path until stock recovery works there first. The |
|
Reviewed as part of a pass over everything opened since v4.0.0. This is a reading of the diff against main — the tests were not executed. The central diagnosis is right and worth keeping. One finding that should be resolved before this merges. The new attempt cap can leave a session unlocked while reporting itself locked. attempts += 1
if (attempts > 50) {
stop()
attempts = 0
root.logEvent("lock-pending: gave-up")
if (root.lockSurfaceOrphaned) root.restartForOrphanedLock()
return
}On main this timer retries indefinitely. With the cap it gives up after 50 ticks at 100 ms, and Clearing Two smaller notes. Waiting on the author for the attempt cap. The rest of the change is sound and the underlying fix is one worth landing. |
`sessionLock` is an id inside Service.qml, so `root.sessionLock` is undefined: `root.sessionLock.locked` threw a TypeError in strandedLockCheckProc.onExited, aborting the handler before `strandedLock` was assigned and before recoverStrandedLock() could run. strandedLockResolved is set earlier in the same handler, so the check never re-armed and stranded-lock recovery was dead for the life of the process — including the recovery quattro already performs today. lockServiceOwned() reached that same id from outside the document, where `lockInst.sessionLock` is undefined too, leaving its last clause permanently false; the service already exposes lockOwned for exactly this. Proven on a worker with a real compositor: the shell logged `TypeError: Cannot read property 'locked' of undefined` at Service.qml:443 on every start and never recovered a stranded session; with this change it logs `lock-stranded: recovering` and re-secures the session. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Re-reviewed at Verified working. On a disposable VM with a real compositor, locking the session and then running Fixed and pushed — Also fixed — Still open — Still open — Still open — the new 50-attempt give-up can report a lock that does not exist. When One housekeeping note: this is filed as What ran: Reviewed by Claude Opus 5 and by Codex at xhigh as an independent second reviewer. Codex found the |
|
Looked at this again against current Now redundant: the Still needed: the #6888 recovery half. Still open from the last review:
The third item from last time, Related: #10547 takes a different route to the same What ran: nothing new. The compositor-backed tests from the last pass ( Reviewed by Claude Opus 5.5, with Codex at medium effort as a second reviewer. Codex found that Waiting on the author: a rebase onto |
Fixes #6888.
Problem
Saving any file under
~/.config/omarchy/plugins/while the session is locked hot-reloads plugins,destroy()somarchy.lock, and leaves Hyprland holdingext-session-lockwith no surface. The lock plugin then logslock-stranded: recovering→lock-pending: screen-stabilizingand never draws a prompt. Hyprland's failsafe wall tells the user tokillall -9 hyprlock, which is not installed on Quattro.Two outcomes already documented on #6888:
requestSessionLock()returns early onsessionLock.secure, which is true for the orphan failsafe and for a stale QuickshellSessionLockManager::activeafter an in-process remount.sessionLock.locked = truein the same process hits Quickshell'sqFatal("Tried to show lockscreen surfaces without active lock").omarchy-restart-shellis written to recover a LOCK session with no locker, but it treats.secure || .requestedas a healthy lock and refuses — the exact JSON a wedged locker reports.Approach
Do not remount a live lock client. When an orphan still happens, recover in a new process, not by
beginLock()in the same one.shell/shell.qml—unloadPluginServices()keepsomarchy.lockwhile it owns the session lock (lockRequestedorsessionLock.locked). SkipQt.clearComponentCache()in that case so the mounted lock's types stay valid.shell/plugins/lock/Service.qml— treatsessionLock.lockedas the only proof this client has a surface.secure && !lockedis an orphan: stop the 10 Hz retry and runomarchy-restart-shell. Do not setsessionLock.locked = truein-process (that is theqFatalpath).bin/omarchy-restart-shell— refuse only when.sessionLockedis true.requested/securewithout a surface is the wedge and must recover. Relock success issessionLocked && secure.hl.clear_crashed_lockscreen()is intentionally not called first: that would drop the compositor lock before the new process can relock.Tests
test/shell.d/lock-stranded-recovery-test.shfor the new recovery contract.test/shell.d/restart-shell-test.shso a healthy lock still refuses restart, and a wedgedsecure+requested/sessionLocked=falselock is recovered.test/shell.d/plugin-reload-lock-test.shfor the keep-lock reload path.Focused suites pass.
./test/allCLI suite is green. Three shell files fail in this environment for missingomarchy-pkgs/ a non-executable upstreamsnapper-test.sh; they do not touch this change.Out of scope
Quickshell still needs to null
SessionLockManager::activein~QSWaylandSessionLockandreturnafter a failedlock()instead ofupdateSurfaces(true). Until that lands, same-process retake remains unsafe.