Repository navigation
Keep first-party services alive during local plugin reloads - #7605
oorestisime wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Preserves first-party services during local plugin reloads while retaining full teardown for explicit rescans.
Changes:
- Adds local versus full reload handling.
- Retains first-party service instances.
- Adds regression coverage for teardown behavior.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
shell/shell.qml |
Separates local and explicit plugin reload lifecycles. |
test/shell.d/plugin-reload-test.sh |
Tests first-party retention and full teardown. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (keepFirstParty && manifest && manifest.__isFirstParty) { | ||
| retained[existingId] = inst | ||
| continue |
There was a problem hiding this comment.
Thanks for flagging this — I checked the concern against the Qt version Quattro is running and tested the suggested alternative before changing the patch.
Qt 6.11's QQmlEngine::clearComponentCache() contract says it drops unreferenced components and explicitly does not drop components that are still referenced: https://doc.qt.io/qt-6/qqmlengine.html#clearComponentCache. trimComponentCache() documents an extant instance (or an object instantiated by it) as keeping that component in use as well: https://doc.qt.io/qt-6/qqmlengine.html#trimComponentCache.
Here the retained first-party service instance keeps its component and dependencies referenced, and _syncServices() does not instantiate a replacement because that service remains in _services. The unloaded third-party services/panels/widgets are unreferenced and remain eligible for eviction. In other words, on Qt 6.11 the existing cache call already provides the scoped behavior suggested here.
I also tested skipping the cache call in a minimal Quickshell fixture: after destroying a dynamically created component, editing its QML, and recreating the same URL, the second instance still returned the old value. So suppressing cache eviction would make the local-plugin watcher remount stale third-party code, defeating the live reload this PR preserves.
The type-identity warning applies if the same cleared QML code is instantiated again while an old instance remains. This path neither evicts nor recreates the retained first-party service component. The shell root and other long-lived QML objects also already survive the pre-existing cache call, so retaining the service does not introduce the first live object across this boundary.
If there is a concrete component path that Qt fails to retain through the live service's dependency references, I agree that path would need separate handling, but skipping the cache globally for local reloads is not safe for plugin development.
|
CLosing this since it fell behind.Many PRs on this subject |
Fixes #7106.
Alternative to #7572; overlaps the lock-preservation part of #7169.
Problem
A practical trigger is phone vibe coding through T3 Code: the computer idle-locks while the user continues editing an Omarchy plugin from their phone. Saving plugin changes updates
~/.config/omarchy/plugins/, whose watcher starts a full plugin reload even though only local plugin code changed.reloadPlugins()currently destroys every plugin service, including the package-ownedomarchy.lockservice and its liveWlSessionLock. Destroying that service while it ownsext-session-lockstrands the compositor lock. The replacement service can then race while recreating lock surfaces and make Quickshell abort with:This was observed in two
SIGABRTcoredumps. One crash coincided exactly with a local plugin manifest edit; the stack reachedWlSessionLock::updateSurfaces()from the QML reload lifecycle.Fix
Treat automatic local-plugin changes differently from an explicit full rescan:
reloadLocalPlugins()retains package-owned first-party service instances, includingomarchy.lock, idle, notifications, polkit, and media.rescanPluginscalls keep the existing full-reload behavior and unload every service.The first-party boundary is intentional: files changed by the local plugin watcher cannot modify package-owned plugin sources, so retaining those instances cannot leave the edited third-party plugin stale.
Unlike #7572, this does not defer the edit until the session unlocks. Phone-driven/T3 Code plugin development remains live while the lock infrastructure stays intact, and no polling is introduced.
Testing
test/shell.d/plugin-reload-test.shcovering first-party retention, third-party teardown, lock-service identity, and explicit full rescans.git diff --checkand QML parsing pass../test/all: all relevant tests pass. The three packaging-coverage files fail because this machine does not have the separateomarchy-pkgscheckout (config-test.sh,snapper-test.sh, andunowned-system-paths-test.sh); this is unrelated to the patch.