Skip to content

fix(shell): keep scoped APIs on cloned menu plugins (#12944) - #12996

Closed
kvnloo wants to merge 1 commit into
omacom:quattrofrom
kvnloo:fix/12944-cloned-menu-shell-api
Closed

kvnloo wants to merge 1 commit into
omacom:quattrofrom
kvnloo:fix/12944-cloned-menu-shell-api

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #12944. Refs #12989.

What

After prunePluginApis destroys a third-party scoped pluginShell facade, syncPluginApis now re-injects a fresh API into already-loaded keepLoaded panel/menu Loader items (reinjectLoadedPanelShellApis), matching how _syncServices refreshes kept service instances.

Why still needed

Cloned menus are keepLoaded: true, so Loader.onLoaded only runs once. A startup reconcile (or capability-profile change) can revoke the scoped facade while the Loader item survives; shell (and therefore appLibrary) stays null and installed apps disappear from menu/search. First-party omarchy.menu is unaffected. Adjacent #12937 covers keepLoaded services, not panels/menus.

Tests

  • bash ./test/shell.d/cloned-menu-shell-api-test.sh (pass)
  • bash ./test/shell.d/plugin-auth-boundary-test.sh (pass; runtime fixture skipped without Wayland)

Tip: d3cfd53b997f8bdcf776b8db68bf0d735e7a065d (upstream/quattro)

After prunePluginApis destroys a third-party pluginShell facade, re-inject
a fresh API into keepLoaded panel/menu Loader items so apps stay searchable.
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

No actionable issue found in the source-reviewed change at eb4716f8.

Verified (source inspection): syncPluginApis() now refreshes loaded panel/menu APIs after pruning stale facades. It uses the same scoped factories as initial loading and skips missing, unloaded or disabled plugins.

Enabled, already-loaded menu after facade revocation:
Before: prune stale API → loaded item receives no replacement
After:  prune stale API → reassign scoped API to loaded item

For menu plugins, the replacement facade includes the application-library API used to build app rows. This addresses the missing reinjection path described in #12944 and #12989; end-to-end menu recovery was not tested.


Review information

Test scope: Source inspection only. No native startup/menu reproduction or repository test run; the added test checks code-text wiring rather than app-row behavior.

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 and synthesis, independent technical reviews by Opus 5.5 High and GPT 6 Sol Xhigh, and a fresh Astra Medium editorial check.

@sanjyay

sanjyay commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Tested in the Omarchy VM running Omarchy 4.0.4-1 with Quickshell 0.3.1 and Hyprland 0.56.2:

  • Ran bash test/shell.d/cloned-menu-shell-api-test.sh: passed cleanly.
  • Ran bash test/shell.d/plugin-auth-boundary-test.sh under live Wayland compositor: all 13 checks passed including the runtime authentication boundary check.
  • Ran all plugin and menu test suites (test/shell.d/plugin-*.sh and test/shell.d/menu-*.sh): all passed cleanly with no regressions.
  • Verified that reinjectLoadedPanelShellApis() re-injects fresh scoped facades (item.shell, manifest, barWidgetRegistry, pluginRegistry, service) into already-loaded keepLoaded panel/menu loader items after prunePluginApis() revokes stale facades during startup reconciliation or capability changes, preventing null/destroyed shell references in third-party or cloned menus.

Everything works as expected with no issues.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this against current quattro. The bug it fixes is real but is already fixed there, so this change is no longer needed.

What I ran, on a disposable Omarchy VM with the shell loaded from each tree: a third-party keepLoaded menu plugin that logs whether its injected shell survives, and a clone of omarchy.menu instrumented the same way, after a shell restart and after a cold boot.

Codex Medium reviewed it as a second opinion and found why #13439 fixes it, which I then checked in the source. Before #13439 the panel delegate read its manifest through modelData, and that round trip turns kinds into a list Array.isArray rejects. manifestHasKind() then reported no menu kind, so the facade was created under a no-menu profile without an app library. prunePluginApis() computes the expected profile from the registry's own manifest, where kinds is a real array, so the profiles never matched and the facade was revoked. #13439 reads the manifest straight from installedPlugins, so the profile matches and nothing is revoked. This change worked around it by re-injecting after every prune. On quattro that means rewriting five properties on every loaded panel on every syncPluginApis(), including each bar-widget registry change, to fix something that no longer happens.

Codex also pointed out that cloned-menu-shell-api-test.sh checks for the presence of the new code rather than whether the facade survives, so it would fail against current quattro even though the behaviour there is correct. It agreed with my conclusion. The two reviews are not guaranteed to be independent.

cloned-menu-shell-api-test.sh passed on the VM. plugin-auth-boundary-test.sh could not run its checks because the VM has no node, so that suite was not run.

This now waits on the maintainer, and I'd suggest closing it as already fixed by #13439. #12944 and #12989 describe the same bug, and #13439 fixes it for both.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @kvnloo. Closing because #13439 already fixes this on quattro.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloned menu plugin loses its scoped shell API during shell startup - installed apps vanish from menu and search

4 participants