Skip to content

Honor keepLoaded for services during plugin hot-reload - #9485

Merged
dhh merged 4 commits into
omacom:quattrofrom
barmstrong:fix/keep-loaded-services
Sep 2, 2026
Merged

dhh merged 4 commits into
omacom:quattrofrom
barmstrong:fix/keep-loaded-services

Conversation

@barmstrong

Copy link
Copy Markdown
Contributor

omarchy.lock already declares keepLoaded: true, but that flag was only consulted for summoned panels. reloadPlugins() still called unloadPluginServices(), which destroy()ed every service — including the lock client.

If an installed plugin file changes while the session is locked (a bar widget hot-reload is enough), the shell tears down WlSessionLock. Hyprland keeps the session locked and shows the crashed-lockscreen fallback ("Oopsie daisy, it looks like you locked your screen but the lockscreen app died").

This keeps keepLoaded services mounted across plugin hot-reload. Disabled or removed services are still dropped by _syncServices().

Test plan

  • bash test/shell.d/plugins-test.sh — lock/idle/polkit/notifications stay keepLoaded, and unloadPluginServices consults that flag
  • bash test/shell.d/runtime-smoke-test.sh — after shell rescanPlugins, lock lastEventAt is unchanged and is not lock-stranded

./test/all was run; CLI passed. The four shell files that failed here are preexisting environment gaps (omarchy-pkgs checkout missing, about-window animation), not this change.

Plugin reload destroyed every service, including omarchy.lock, which drops the ext-session-lock client while Hyprland still holds the lock and surfaces the crashed-lockscreen fallback.
@barmstrong

Copy link
Copy Markdown
Contributor Author

This is caused by having an agent work on a plugin, and then your lockscreen comes on, and the agent finishes making some changes to the plugin files, it apparently crashes/kills the lockscreen app and you get this nasty "blue screen of death" and almost feels like you've bricked your laptop.
image

I haven't extensively tested this fix, but this is what the agents came up with - so hoping it solves it! Surprised no one else has encountered this, since it happened a few times.

dhh and others added 3 commits September 1, 2026 14:25
A fresh lock service also reports an empty lastEventAt, so comparing it
across the rescan passed whether or not the instance survived. A fixture
keepLoaded service whose in-memory marker is set before the rescan and
read back after can only pass when the same instance is still mounted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The _syncServices cleanup only asked whether the plugin was still
installed and enabled, so a kept service whose plugin dropped its
service kind or entry point kept running as a zombie until shell
restart. Apply the same eligibility checks used at creation, and hand
kept instances the refreshed manifest after a rescan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…load on restart

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dhh

dhh commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Reviewed, and the fix is right — keeping keepLoaded services mounted is exactly what the lock client needs. I pushed three commits to tighten it up:

  • The smoke-test assertion was vacuous: a freshly recreated lock service also reports an empty lastEventAt, so the before/after comparison passed even with the shell.qml change reverted (verified by running the suite both ways). It now uses a fixture keepLoaded service whose in-memory marker can only survive the rescan if the instance does.
  • _syncServices() only checked installed + enabled when dropping, so a kept service whose plugin stopped declaring a service kind kept running as a zombie until shell restart. It now applies the same eligibility checks used at creation, and kept instances get the refreshed manifest after a rescan.
  • Covered omarchy.media in the keepLoaded expectations and noted in the README that code changes to a kept service only land on shell restart.

Full smoke, plugins, and CLI suites pass, and both new assertions fail when their respective fix is reverted.

— 🤖 Claude, posting on behalf of @dhh

@Rohansguliani

Copy link
Copy Markdown

Independent reproduction on Omarchy 4.0.2, Quickshell 0.3.1, and Hyprland 0.56.2:

  1. The session was securely locked.
  2. omarchy-shell shell rescanPlugins ran while locked.
  3. The journal immediately recorded lock-stranded: recovering, followed by lock-requested and lock-pending: screen-stabilizing, but never returned to secure=true.
  4. Hyprland displayed its crashed-lockscreen failsafe. There was no coincident OOM, GPU reset, segfault, or coredump.

I checked out the maintainer-updated head at bd1464c7 on the affected machine. plugins-test.sh passes, and runtime-smoke-test.sh confirms the keepLoaded fixture service retains its in-memory marker across rescanPlugins and is still removed when it stops declaring a service kind.

This matches the failure exactly and the updated implementation covers it without special-casing omarchy.lock.

@dhh
dhh merged commit d3d23fd into omacom:quattro Sep 2, 2026
Irfrit pushed a commit to Irfrit/omarchy that referenced this pull request Sep 6, 2026
* Honor keepLoaded for services during plugin hot-reload

Plugin reload destroyed every service, including omarchy.lock, which drops the ext-session-lock client while Hyprland still holds the lock and surfaces the crashed-lockscreen fallback.

* Prove keepLoaded service survival with a fixture service

A fresh lock service also reports an empty lastEventAt, so comparing it
across the rescan passed whether or not the instance survived. A fixture
keepLoaded service whose in-memory marker is set before the rescan and
read back after can only pass when the same instance is still mounted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop kept services whose plugin no longer declares a service

The _syncServices cleanup only asked whether the plugin was still
installed and enabled, so a kept service whose plugin dropped its
service kind or entry point kept running as a zombie until shell
restart. Apply the same eligibility checks used at creation, and hand
kept instances the refreshed manifest after a rescan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Cover omarchy.media in keepLoaded expectations; note kept services reload on restart

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
VaheOfficial pushed a commit to VaheOfficial/DedMarchy that referenced this pull request Sep 9, 2026
* Honor keepLoaded for services during plugin hot-reload

Plugin reload destroyed every service, including omarchy.lock, which drops the ext-session-lock client while Hyprland still holds the lock and surfaces the crashed-lockscreen fallback.

* Prove keepLoaded service survival with a fixture service

A fresh lock service also reports an empty lastEventAt, so comparing it
across the rescan passed whether or not the instance survived. A fixture
keepLoaded service whose in-memory marker is set before the rescan and
read back after can only pass when the same instance is still mounted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop kept services whose plugin no longer declares a service

The _syncServices cleanup only asked whether the plugin was still
installed and enabled, so a kept service whose plugin dropped its
service kind or entry point kept running as a zombie until shell
restart. Apply the same eligibility checks used at creation, and hand
kept instances the refreshed manifest after a rescan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Cover omarchy.media in keepLoaded expectations; note kept services reload on restart

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit d3d23fd)
VaheOfficial pushed a commit to VaheOfficial/DedMarchy that referenced this pull request Sep 9, 2026
Exercise production JavaScript from omacom#9485 and omacom#9618 together with a synchronous Qt test double. Cover keepLoaded identity, detached authentication retention, refreshed manifests, cleanup eligibility, sticky classification, and clone lookups without the unrelated video-wallpaper services alias. Native QObject, PAM, and Wayland validation remains separate.
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
* Honor keepLoaded for services during plugin hot-reload

Plugin reload destroyed every service, including omarchy.lock, which drops the ext-session-lock client while Hyprland still holds the lock and surfaces the crashed-lockscreen fallback.

* Prove keepLoaded service survival with a fixture service

A fresh lock service also reports an empty lastEventAt, so comparing it
across the rescan passed whether or not the instance survived. A fixture
keepLoaded service whose in-memory marker is set before the rescan and
read back after can only pass when the same instance is still mounted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop kept services whose plugin no longer declares a service

The _syncServices cleanup only asked whether the plugin was still
installed and enabled, so a kept service whose plugin dropped its
service kind or entry point kept running as a zombie until shell
restart. Apply the same eligibility checks used at creation, and hand
kept instances the refreshed manifest after a rescan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Cover omarchy.media in keepLoaded expectations; note kept services reload on restart

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants