Skip to content

Route cloned services through enabled plugin ids - #7587

Closed
TotoB12 wants to merge 1 commit into
omacom:quattrofrom
TotoB12:fix-cloned-service-routing
Closed

TotoB12 wants to merge 1 commit into
omacom:quattrofrom
TotoB12:fix-cloned-service-routing

Conversation

@TotoB12

@TotoB12 TotoB12 commented Aug 20, 2026 •

Copy link
Copy Markdown

Fixes #7355.

Cloning a service plugin now routes its service lookup to the enabled clone. This keeps cloned media widgets and the audio panel connected to the active media service.
omarchy-7587-media-clone-bar
Tested with test/shell.d/plugin-registry-contract-test.sh.

@TotoB12
TotoB12 marked this pull request as ready for review August 20, 2026 08:41
Copilot AI balanced review requested due to automatic review settings August 20, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hsyl20

hsyl20 commented Sep 2, 2026

Copy link
Copy Markdown

LGTM. It would be great to have this merged.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 9427f136. Nothing found that should block this; it is waiting on a maintainer.

This branch was opened on 2026-08-20 and quattro has moved 220 commits since its merge base (94554969), so the review was redone against the branch as it would land today rather than against the tree it was written on.

What was checked:

  • It still merges. git merge-tree against current origin/quattro is clean, and a local merge leaves firstPartyServiceFor at shell/shell.qml:279-282 exactly as the diff writes it.
  • What landed on quattro underneath it. Exactly one commit has touched shell/shell.qml since the merge base: d3d23fdd (Honor keepLoaded for services during plugin hot-reload #9485, keepLoaded services surviving hot-reload), which rewrote _syncServices and unloadPluginServices. It does not conflict semantically. Kept instances stay stored under their own id, and _syncServices keeps evaluating installation, service eligibility and enabled state against that exact stored id — this change only maps a stable source id onto it at lookup time, so it neither changes lifecycle ownership nor creates a second service. shell/services/PluginRegistry.qml, where resolveEnabledId lives, is unchanged since the merge base.
  • The change itself. All five callers of firstPartyServiceFor (Dnd.qml:8, NightLight.qml:7, StayAwake.qml:7, panels/audio/Panel.qml:20, services/media/BarWidget.qml:10) are safe: resolveEnabledId returns the id unchanged when no clone is enabled, Util.canonicalWidgetId is currently pure string normalisation, and falsy input yields "", which matches no service — the same null the old path gave. Passing an already-resolved clone id is idempotent, because omarchy-plugin-clone only accepts first-party sources so nothing is cloned from a local id. The raw serviceFor is left alone, which is right: the one other caller, item.service = shell.serviceFor(panelEntry.pluginId), gets its id from the enabled installed-plugin enumeration and is therefore already the clone id.
  • Whether it finishes Cloning a service + bar-widget plugin leaves the widget dead: firstPartyServiceFor() has no clonedFrom routing #7355. As the issue describes it, yes. ensureService and the panel assignment are the remaining exact-id paths and both want the exact id.

Tests ran on a disposable VM built from the Omarchy ISO, against the merged tree rather than the branch alone, through the compositor-backed wrapper: plugin-registry-contract-test.sh, plugins-test.sh, runtime-smoke-test.sh, bar-widget-contract-test.sh, indicator-contract-test.sh, plugin-clone-test.sh, plugin-enable-test.sh — 46 assertions, all passing. The new assertion was then proved to bite by mutation: reverting firstPartyServiceFor to the bare return serviceFor(pluginId) on a copy of the merged tree makes it fail with not ok - first-party service lookup routes cloned source ids.

Codex at xhigh reasoning reviewed it as a second opinion and found no high or medium defect in the runtime change. Where it agreed with conclusions already reached here, note that its independence is not currently guaranteed — it can read this session's own working notes. Two things it raised that were not already reasoned about:

  • The new assertion is weaker than it looks (low). It greps for pluginRegistry.resolveEnabledId(pluginId) anywhere inside the extracted function body, so an implementation that calls the resolver and then returns serviceFor(pluginId) — dropping the resolved id on the floor — would still pass. It does catch the real regression, as the mutation above shows; it just does not pin the data flow. Not pushed as a change, since it is a question about how tight the test should be rather than a defect.
  • A house-style objection that does not hold. It read grep ... || fail followed by an unconditional pass as violating AGENTS.md's rule against relying on an exit in one branch to make following statements unreachable. Rejected: that is the established assertion idiom across 153 of the 227 files in test/shell.d/, including plugin-clone-test.sh:82-83 and 62-64, and the rule is about control flow in scripts rather than about the test suite's assert || fail / pass pairs.

Nothing was pushed to the branch, and no fix was needed.

Related: closes #7355, which is still open. #9760 also touches PluginRegistry.qml and shell.qml, but in listPlugins and the enablement listing — adjacent, not competing. #7253, #6971 and #6915 are the bar-kind mounting failures the issue distinguishes this from, and are untouched by it.

Whether this lands is the maintainer's call and this review does not make it: no approval, no merge, no change of state on the pull request.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-checked at 9427f136 after GitHub started reporting this as conflicting with quattro. The conflict is because quattro already carries this fix, so there is nothing left for this pull request to add. It is waiting on a maintainer, with a recommendation to close it.

What was checked, against quattro at de63134b:

  • The same change is already there. shell/shell.qml:881-883 on quattro reads return serviceFor(shell.pluginRegistry.resolveEnabledId(pluginId)) — the change this pull request makes, with the registry reached through shell. It landed in 203e1639 ("Revoke stale plugin facade capabilities"), merged with Restrict third-party plugin access to authentication services #9618 on 2026-09-02, the same day this was last reviewed. That commit also routes the plugin facade's service proxies and a cloned widget's own-service lookup through resolveEnabledId, so every caller this was aimed at — Dnd.qml, NightLight.qml, StayAwake.qml, lock/Service.qml, panels/audio/Panel.qml and services/media/BarWidget.qml — now reaches an enabled clone.
  • The test is covered more tightly than here. test/shell.d/plugin-auth-boundary-test.sh:148-152 asserts the resolved id is what gets passed to serviceFor, which is the data flow the assertion in this pull request did not pin, and runtime-smoke-test.sh exercises a cloned media widget reaching its own service and a replacement bar's media proxy reaching the enabled clone.
  • Porting it would add nothing. The one difference is the pluginRegistry ? null fallback, and the registry is always instantiated in shell.qml, so resolving the conflict would only duplicate what is there.

Nothing was run on a worker for this pass: the change is already on quattro under its own tests, so there was nothing of this branch's left to prove. Nothing was pushed.

Codex at medium effort reviewed it as a second opinion, checking each caller and the tests on quattro, and reached the same conclusion: fully superseded, no path this covers that quattro misses. Its independence from this review is not guaranteed.

#7355, which this closes, looks fixed on quattro by #9618 as the issue describes it — both the cloned media widget and the audio panel resolve to the enabled clone — so it can likely be closed alongside this one. Thanks to @TotoB12 for tracking down the routing gap; the fix that landed is the same one.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @TotoB12. The same change is already on quattro: 203e163, merged with #9618, routes the service lookup through resolveEnabledId for every caller this was aimed at, under a tighter test, so there is nothing left for this to add.

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

@omarchybot omarchybot closed this Sep 28, 2026
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.

Cloning a service + bar-widget plugin leaves the widget dead: firstPartyServiceFor() has no clonedFrom routing

4 participants