Skip to content

Fix plugin bar loading and its silent failure - #7254

Open
koenhendriks wants to merge 11 commits into
omacom:quattrofrom
koenhendriks:fix-plugin-bar-loading
Open

koenhendriks wants to merge 11 commits into
omacom:quattrofrom
koenhendriks:fix-plugin-bar-loading

Conversation

@koenhendriks

@koenhendriks koenhendriks commented Aug 17, 2026 •

Copy link
Copy Markdown

Fixes #7253.

omarchy plugin clone omarchy.bar reports success and switches bar.id, then the bar disappears from every monitor with nothing printed and no fallback. Two defects, the second hiding the first.

1. A plugin bar's injected properties arrive too late

A bar entry point declares omarchyPath, barWidgetRegistry, and barConfig as required, and QML refuses to instantiate a component whose required properties are unset. shell.qml reaches a bar two ways:

  • defaultBarComponent passes them declaratively — the built-in bar is fine.
  • pluginBarLoader bound source: and injected them afterwards, in onLoaded: shell.configureBar(item, ...).

The second can never work: the Loader fails before onLoaded, and configureBar() opens with if (!target) return, making it a no-op. So no bar plugin could load — including a clone of the built-in bar, which is the documented way to customise one.

setSource supplies them at creation instead, with Qt.binding so they stay live afterwards the way defaultBarComponent's bindings do. That also fixes something that was quietly broken: a plugin bar previously got barConfig assigned once in onLoaded and never followed a shell.json reload. Only the properties Bar.qml declares are passed; configureBar() still fills in optional ones such as pluginRegistry on load.

Since active does not change when switching straight from one bar plugin to another, the source url drives the reload itself.

2. The Loader.Error handler reads errorString, which Loader does not have

var detail = errorString && errorString() ? errorString() : ""
console.warn("bar option " + ... + ":", detail)
shell.failedBarId = shell.activeBarId   // never reached

The ReferenceError aborts the handler before failedBarId is set, so the existing fallback to omarchy.bar never runs and the warning is never printed. That is why a broken bar option presents as a silently missing bar rather than an error. The warning now also names the url it tried to load, since the engine logs the component's own errors without saying which bar option asked for them.

Verification

On Omarchy 4.0.0-1, Hyprland 0.56.2, two monitors. Both runs start from a cold ~/.cache/quickshell/qmlcache — a warm cache serves a previously compiled Bar.qml and will happily mask this.

  • Before: omarchy plugin clone omarchy.bar + restart → hyprctl layers shows no omarchy-bar surface on either monitor; journal shows the three Required property … was not initialized warnings plus ReferenceError: errorString is not defined.
  • After: the same untouched clone loads and renders on both monitors, with no warnings beyond one unrelated portal message. Bar.qml is not modified, so the clone still declares all three as required.

./test/all shows the same 4 pre-existing failures with and without this change (they want a sibling omarchy-pkgs checkout, snapper config, and a pristine system; the fourth is an IPC-handler count that is off on this machine regardless of branch or active bar id).

Note on the history

The first two commits relaxed Bar.qml's required properties. Review pushed back on weakening the contract, which was fair, and the objection pointed at a better fix: relaxing Bar.qml only helps bars descended from a fixed Bar.qml, so an existing clone or a third-party bar that declares its injected properties required would still fail. The later commits revert that and fix the loader instead. Net diff is shell/shell.qml only.

Bar.qml declared omarchyPath, barWidgetRegistry, and barConfig as
required properties. QML refuses to instantiate a component whose
required properties are unset, and shell.qml's pluginBarLoader sets
`source` and injects afterwards in onLoaded via configureBar(), so the
component never got built and configureBar()'s `if (!target) return`
made it a no-op. Any bar plugin -- including the copy that
`omarchy plugin clone omarchy.bar` produces -- failed to load, leaving
the session with no bar at all.

Declare them plain with defaults, matching the plugin contract in
agents/skills/shell-dev.md ("accept the shell-injected properties") and
every other entry point: menu/Menu.qml and notifications/Service.qml
both do this, as do Bar.qml's own shell and manifest properties.

The built-in bar is unaffected: defaultBarComponent keeps passing all
three declaratively.
The Loader.Error handler read `errorString`, which is not defined on
Loader. The ReferenceError aborted the handler before
`shell.failedBarId = shell.activeBarId`, so the fallback to the built-in
bar never ran and a bar plugin that failed to load produced a session
with no bar and no explanation of why.

Drop the errorString reference. The engine has already logged the
component's own QML errors by the time this runs.
Copilot AI balanced review requested due to automatic review settings August 17, 2026 10:43

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 wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@koenhendriks
koenhendriks changed the base branch from master to quattro August 17, 2026 10:43
@koenhendriks
koenhendriks requested a balanced review from Copilot August 17, 2026 10:54

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (4)

shell/shell.qml:260

  • The comment and behavior assume Loader never provides an error string. To make this more robust across engine/Qt versions and keep useful diagnostics, consider feature-detecting and logging details only when available (e.g., check typeof errorString === \"function\" before calling), rather than permanently dropping the detail.
        // Loader exposes no errorString; the engine has already logged the
        // component's own QML errors by the time this runs. Reaching for one
        // threw a ReferenceError here, which aborted the handler before the
        // fallback below and left the session with no bar and no explanation.
        console.warn("bar option " + shell.activeBarId + " failed to load, falling back to " + shell.defaultBarId)

shell/plugins/bar/Bar.qml:17

  • Changing barWidgetRegistry and barConfig from required to optional null weakens the component contract and can turn a clear instantiation-time failure into later, harder-to-debug runtime errors when these values are used. Prefer keeping them required, or (if optional is intended) add an explicit early validation with a clear error message when they are missing.
  property var barWidgetRegistry: null

shell/plugins/bar/Bar.qml:22

  • Changing barWidgetRegistry and barConfig from required to optional null weakens the component contract and can turn a clear instantiation-time failure into later, harder-to-debug runtime errors when these values are used. Prefer keeping them required, or (if optional is intended) add an explicit early validation with a clear error message when they are missing.
  property var barConfig: null

shell/plugins/bar/Bar.qml:15

  • If OMARCHY_PATH is unset, Quickshell.env(...) may return an empty/undefined-like value depending on the host API; assigning that into a string property can lead to surprising results. Consider normalizing the default to a definite string (for example, falling back to an empty string) so downstream path concatenation/usage behaves consistently.
  property string omarchyPath: Quickshell.env("OMARCHY_PATH")

This reverts b05988c. Relaxing Bar.qml's required properties made a
cloned bar load, but it weakens the component contract and only helps
bars descended from a fixed Bar.qml: an existing clone, or any
third-party bar that quite reasonably declares its injected properties
required, still could not load.

The loader is the thing that is wrong, so fix it there instead. Bar.qml
keeps `required`.
A bar entry point declares omarchyPath, barWidgetRegistry, and barConfig
as required, and QML refuses to instantiate a component whose required
properties are unset. pluginBarLoader bound `source` and injected them
afterwards in onLoaded, so the Loader failed before onLoaded ran and
configureBar()'s `if (!target) return` made the injection a no-op. No bar
plugin could load, `omarchy plugin clone omarchy.bar` included.

setSource supplies them at creation, and Qt.binding keeps them live
afterwards the way defaultBarComponent's declarative bindings do -- which
also means a plugin bar now follows shell.json reloads instead of being
stuck with the barConfig it was built with. Only the properties Bar.qml
declares are passed; configureBar() still fills in the optional ones such
as pluginRegistry on load.

`active` no longer changes when switching straight from one bar plugin to
another, so the source url drives the reload itself.

The failure warning also names the file it tried to load, since the
engine logs the component's errors without saying which bar option asked
for them.
Copilot AI review requested due to automatic review settings August 17, 2026 12:05
@koenhendriks

Copy link
Copy Markdown
Author

Thanks — the review's objection to relaxing required was the right call, and following it produced a better fix. Rundown of all four points:

Relaxing barWidgetRegistry / barConfig from required weakens the contract — agreed, and reverted. It was also a narrower fix than it looked: it only helps bars descended from a fixed Bar.qml, so an already-existing clone, or a third-party bar that quite reasonably declares its injected properties required, would still have failed to load. The loader was the thing that was wrong. pluginBarLoader now supplies the properties at creation via setSource(url, {...}), with Qt.binding so they stay live afterwards. Bar.qml is untouched and keeps required; the net diff is shell/shell.qml only.

That turned out to fix a second, quieter bug: a plugin bar previously had barConfig assigned once in onLoaded and never followed a shell.json reload, where the built-in bar gets a real binding. It does now too.

Normalising the omarchyPath default — moot, since Bar.qml is no longer modified. Worth noting for its own sake though: shell.qml:27 already does property string omarchyPath: Quickshell.env("OMARCHY_PATH"), so that was the codebase's existing idiom rather than something new.

Feature-detect errorString rather than dropping the detail — I've left it dropped, deliberately. Loader has no errorString member in any Qt version, so typeof errorString === "function" would be guarding an API that has never existed; the identifier was simply a mistake, which is why it threw ReferenceError and took the fallback down with it. No diagnostics are lost either way — the engine logs the component's own QML errors itself, which is exactly how the underlying Required property … was not initialized messages surfaced. What was missing is which bar option asked, so the warning now names activeBarSourceUrl.

One note for anyone reproducing this: clear ~/.cache/quickshell/qmlcache first. A warm cache will serve a previously compiled Bar.qml and the bug appears to vanish — it cost me a wrong conclusion mid-investigation before I tested cold.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (3)

shell/shell.qml:277

  • With the declarative source: binding removed, the initial plugin load now depends on a change signal (onActiveChanged and/or onActiveBarSourceUrlChanged) to call loadPluginBar(). If the loader is constructed when active is already true and activeBarSourceUrl is already set (so neither changes after creation), nothing in this hunk guarantees an initial setSource(...) call. Consider triggering loadPluginBar() deterministically on component completion (e.g., via Component.onCompleted) so the initial bar plugin loads reliably.
    active: !shell.pluginReloading && shell.activeBarId !== shell.defaultBarId && shell.activeBarSourceUrl !== ""
    asynchronous: true
    onLoaded: shell.configureBar(item, shell.activeBarManifest)
    onActiveChanged: {
      if (!active) shell.bar = null
      loadPluginBar()
    }

shell/shell.qml:295

  • With the declarative source: binding removed, the initial plugin load now depends on a change signal (onActiveChanged and/or onActiveBarSourceUrlChanged) to call loadPluginBar(). If the loader is constructed when active is already true and activeBarSourceUrl is already set (so neither changes after creation), nothing in this hunk guarantees an initial setSource(...) call. Consider triggering loadPluginBar() deterministically on component completion (e.g., via Component.onCompleted) so the initial bar plugin loads reliably.
    Connections {
      target: shell

      function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }
    }

shell/shell.qml:273

  • onLoaded passes shell.activeBarManifest, which can drift from the manifest that was intended for the specific load if activeBar* properties change while an asynchronous load is in-flight. Since the component is being created with an injected manifest property in setSource(...), prefer configuring with the loaded item’s manifest (or another value captured at load initiation) to avoid configuring a bar with the wrong manifest.
    onLoaded: shell.configureBar(item, shell.activeBarManifest)

koenhendriks added a commit to koenhendriks/omarchy-supplement that referenced this pull request Aug 17, 2026
The relaxation of Bar.qml's three `required` properties was described as
self-cancelling: "written as optional so it turns into a no-op once it
lands". That is wrong. The accepted upstream fix (omacom/omarchy#7254)
supplies the properties at creation in shell.qml and leaves `required` in
Bar.qml, so the substitutions will keep firing after it ships -- silently
and pointlessly rather than lapsing. They are a local workaround to delete
by hand, and the check for when is now written down. Renamed optional() to
workaround() and dropped its "already applied upstream, skipping"
message, which under that fix can never be reached.

Also record that a bar with no background is bar.transparent rather than a
broken width patch: the flag is a double-left-click on empty centre-bar
space away, and it presents exactly like the content-inset patch having
failed. shell-bar.json deliberately does not pin it, so the gesture keeps
working.
Removing the declarative `source` binding left the initial load depending
on a change signal. A Loader constructed with `active` already true and
`activeBarSourceUrl` already set would never call setSource, and the
failure mode is a session with no bar at all.

That ordering does not occur today -- the bar config arrives after
construction, so `active` starts false and onActiveChanged drives the
load -- but nothing enforces it, so do it on completion as well.
setSource injected omarchyPath, barWidgetRegistry, barConfig and manifest
as Qt.bindings, but onLoaded hands the item straight to configureBar(),
which reassigns all four from the live shell properties -- and
onBarConfigChanged keeps barConfig current from then on. The bindings were
overwritten almost as soon as they were made, so plain values say what
actually happens.

This also settles the review's concern about the manifest drifting during
an asynchronous load: configureBar applies the current manifest at load
time, so the value injected at creation only has to satisfy the required
property.
Copilot AI review requested due to automatic review settings August 17, 2026 13:39
@koenhendriks

Copy link
Copy Markdown
Author

Picked up the suppressed comments from the last review.

Initial load not guaranteed — fixed in a229300. With source no longer bound, the load depended on a change signal; a Loader constructed with active already true would never call setSource. It does not happen today (the bar config arrives after construction, so active starts false and onActiveChanged drives it), but nothing enforces that ordering and the failure mode is a session with no bar, so Component.onCompleted: loadPluginBar() now covers it.

Manifest drift during an async load — addressed in 2abba61, by removing the cause rather than reordering. setSource was injecting the four properties as Qt.bindings, but onLoaded hands the item to configureBar(), which reassigns all four from the live shell properties, and onBarConfigChanged keeps barConfig current after that. The bindings were being replaced almost as soon as they were created, so they are now plain values: the value injected at creation only has to satisfy the required property, and configureBar applies the current manifest at load time.

Verified on Omarchy 4.0.0-1, Hyprland 0.56.2, two monitors, with a clone whose three required properties are left intact so the original bug is reachable:

  • stock shell.qml: hyprctl layers shows no omarchy-bar surface on either monitor
  • this branch: the cloned bar loads and renders on both
  • config still reaches the loaded plugin bar — omarchy bar position bottom moved the DP-1 surface from y=1440 to y=2854 and back, same layer id and pid, so it hot-reloaded in place rather than needing a restart

No new Required property … was not initialized or ReferenceError lines in the shell log.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (5)

shell/shell.qml:271

  • manifest is injected into the component as a plain value at instantiation time, but onLoaded calls configureBar() with shell.activeBarManifest at handler time. Because the Loader is asynchronous: true, shell.activeBarManifest can change between setSource(...) and onLoaded, causing the instance to be created with one manifest but configured with another. Prefer passing the same manifest value through both paths (e.g., read from item.manifest, or capture the manifest used in loadPluginBar() and provide that exact value to configureBar).
      setSource(shell.activeBarSourceUrl, {
        omarchyPath: shell.omarchyPath,
        barWidgetRegistry: shell.barWidgetRegistry,
        barConfig: shell.barConfig,
        shell: shell,
        manifest: shell.activeBarManifest
      })

shell/shell.qml:276

  • manifest is injected into the component as a plain value at instantiation time, but onLoaded calls configureBar() with shell.activeBarManifest at handler time. Because the Loader is asynchronous: true, shell.activeBarManifest can change between setSource(...) and onLoaded, causing the instance to be created with one manifest but configured with another. Prefer passing the same manifest value through both paths (e.g., read from item.manifest, or capture the manifest used in loadPluginBar() and provide that exact value to configureBar).
    onLoaded: shell.configureBar(item, shell.activeBarManifest)

shell/shell.qml:274

  • Reload is currently driven by active transitions and activeBarSourceUrl changes. If shell.activeBarId (or other inputs that affect injected properties, like activeBarManifest) changes while active remains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always change activeBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g., activeBarIdChanged / activeBarManifestChanged) to call loadPluginBar() (or update the already-loaded item if reload is undesirable).
    active: !shell.pluginReloading && shell.activeBarId !== shell.defaultBarId && shell.activeBarSourceUrl !== ""

shell/shell.qml:288

  • Reload is currently driven by active transitions and activeBarSourceUrl changes. If shell.activeBarId (or other inputs that affect injected properties, like activeBarManifest) changes while active remains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always change activeBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g., activeBarIdChanged / activeBarManifestChanged) to call loadPluginBar() (or update the already-loaded item if reload is undesirable).
    onActiveChanged: {
      if (!active) shell.bar = null
      loadPluginBar()
    }

shell/shell.qml:305

  • Reload is currently driven by active transitions and activeBarSourceUrl changes. If shell.activeBarId (or other inputs that affect injected properties, like activeBarManifest) changes while active remains true and the URL stays the same, the loader will not reload and the injected plain (non-bound) values can become stale. Either (a) enforce an invariant that bar switches always change activeBarSourceUrl, or (b) add signal handlers for the other relevant change signals (e.g., activeBarIdChanged / activeBarManifestChanged) to call loadPluginBar() (or update the already-loaded item if reload is undesirable).
    // Switching straight from one bar plugin to another keeps `active` true, so
    // the url change has to drive the reload by itself.
    Connections {
      target: shell

      function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }
    }

configureBar() assigns manifest imperatively when the bar loads, replacing
whatever binding the component was created with -- for the built-in bar too.
And activeBarManifest is recomputed from pluginRegistry.registryRevision, so
a plugin rescan produces a new manifest while the entry-point url stays the
same string. Nothing then reloads the loader or refreshes the value, leaving
the bar holding a stale manifest.

Push it on change, the way barConfig already is a few lines above. That also
settles the creation-versus-load question for an asynchronous loader: the
value injected at setSource only has to satisfy the required property, and
the item's manifest ends up reflecting the current one either way rather
than being frozen at whichever moment won.

A bar switch needs no extra handling: activeBarSourceUrl is derived from
activeBarManifest, which is derived from activeBarId, so changing the id
always changes the url and the existing onActiveBarSourceUrlChanged drives
the reload.
Copilot AI review requested due to automatic review settings August 17, 2026 14:43
@koenhendriks

Copy link
Copy Markdown
Author

Fourth review picked up in 4085d7d. Both suppressed points came down to one gap, so one change covers them.

Reload triggers — the branch the review suggested enforcing is already structural, so no extra signal handlers are needed for a bar switch. activeBarSourceUrl is derived from activeBarManifest, which is derived from activeBarId, so changing the id necessarily changes the url and the existing onActiveBarSourceUrlChanged drives the reload.

There is a real residue though, and the review is right about it: activeBarManifest is recomputed from pluginRegistry.registryRevision, so a plugin rescan yields a new manifest while the entry-point url stays the same string. Nothing reloaded the loader or refreshed the value, so the bar kept a stale manifest. Worth noting this predates the PR — configureBar() assigns manifest imperatively at load and replaces whatever binding the component was created with, for the built-in bar as well.

Fixed by pushing it on change, mirroring onBarConfigChanged a few lines above:

onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifest

Manifest consistency across an async load — this settles that too, rather than pinning the creation-time value. The value injected at setSource only has to satisfy the required property; the item's manifest now converges on the current one whichever moment wins the race, instead of being frozen at whichever manifest happened to be live when the load started.

Verified by running this branch directly (quickshell -n -p <checkout>/shell) on Omarchy 4.0.0-1, two monitors: the cloned bar loads on both, and omarchy-shell shell rescanPlugins — exactly the new-manifest-same-url case — leaves both surfaces up with no manifest-related errors in the shell log.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

shell/shell.qml:278

  • loadPluginBar() only gates on active, but it can also be called from onActiveBarSourceUrlChanged (line 311) during the same change that will later flip active to false. In that ordering, active may still be true while shell.activeBarSourceUrl is already empty, leading to setSource(\"\", { ... }) and an avoidable load error/noise. Consider adding an explicit URL check before calling setSource(url, props) (and unload via setSource(\"\") when the URL is empty/invalid) so the method is safe regardless of signal/binding evaluation order.
    function loadPluginBar() {
      if (!active) {
        setSource("")
        return
      }

      setSource(shell.activeBarSourceUrl, {
        omarchyPath: shell.omarchyPath,
        barWidgetRegistry: shell.barWidgetRegistry,
        barConfig: shell.barConfig,
        shell: shell,
        manifest: shell.activeBarManifest
      })
    }

shell/shell.qml:185

  • This handler relies on an unqualified bar identifier and an inline if without braces, which makes it harder to read and easier to misinterpret (e.g., whether this is meant to reference shell.bar vs. an id: bar). Consider making the target explicit (e.g., shell.bar) and using a braced block for clarity.
  onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifest

loadPluginBar() only checked `active`, which does include
activeBarSourceUrl !== "" -- but a signal handler can run before that
binding is re-evaluated. On the change that empties the url,
onActiveBarSourceUrlChanged fires while `active` is still true, so
setSource("") was called with a property map attached: a load error for a
transition that is really just an unload.

Read the url once and check it explicitly, so the method is correct
whichever order the signal and the binding arrive in.

Verified by switching the active bar between a plugin bar and the built-in
one and back, which is the transition that empties the url: both directions
leave two bar surfaces up with no load errors.
@koenhendriks

Copy link
Copy Markdown
Author

Fifth review picked up: one fix, one push-back.

Empty source url — fixed in b06256c. loadPluginBar() only gated on active, and while active does include activeBarSourceUrl !== "", a signal handler can run before that binding is re-evaluated: on the change that empties the url, onActiveBarSourceUrlChanged fires while active is still true, so setSource("") was called with a property map attached — a load error for what is really just an unload. It now reads the url once and checks it explicitly, so the method is correct whichever order the signal and the binding arrive in.

onActiveBarManifestChanged style — leaving as is, deliberately. It is byte-for-byte the same shape as the onBarConfigChanged handler it mirrors a few lines above:

onBarConfigChanged: if (bar && "barConfig" in bar) bar.barConfig = shell.barConfig
onActiveBarManifestChanged: if (bar && "manifest" in bar) bar.manifest = shell.activeBarManifest

Qualifying one and not the other, or bracing one and not the other, would make the pair harder to read than either style applied consistently. On the ambiguity specifically: bar is property var bar: null on the ShellRoot (shell.qml:192) and there is no id: bar anywhere under shell/, so the unqualified reference has nothing to shadow it. Happy to change both handlers together if a maintainer prefers the explicit form.

Verified on Omarchy 4.0.0-1, two monitors, running this branch directly: omarchy bar use omarchy.bar then omarchy bar use koen.bar — the transition that empties the url — leaves two bar surfaces up in both directions with no load errors. The only warnings are the pre-existing transient panels/weather/Panel.qml … of null lines that appear whenever the bar is torn down and rebuilt, present on unpatched shells too.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread shell/shell.qml
return
}

setSource(url, {
Neither behaviour fixed here was reachable from the existing tests.
manifest-entrypoints-test.sh instantiates the built-in bar directly, which
exercises defaultBarComponent's declarative properties and never touches
pluginBarLoader, so a regression that omitted the injected properties again,
or one where Loader.Error stopped selecting the fallback, would pass.

Two cases, both against the real shell rather than a stand-in, since the
loader is part of shell.qml and a reimplementation in a fixture would only
test itself:

- a bar plugin declaring omarchyPath, barWidgetRegistry and barConfig as
  `required` -- QML cannot instantiate it unless the loader supplies all
  three at creation. It reports the values back through the result file, so a
  property arriving undefined fails rather than passing quietly.
- a bar plugin that cannot load, asserting the log carries the fallback to
  omarchy.bar and no ReferenceError from the handler.

Both were checked against the unfixed code. Without the loader fix the first
case fails with "never loaded"; with only the errorString bug restored the
first passes and the second fails with "did not fall back".
@koenhendriks

Copy link
Copy Markdown
Author

Test added in 6919f50 — test/shell.d/plugin-bar-loader-test.sh.

You were right that nothing covered this path. manifest-entrypoints-test.sh instantiates the built-in bar directly, which exercises defaultBarComponent's declarative properties and never reaches pluginBarLoader, so either regression would have passed.

Two cases, both against the real shell rather than a stand-in — the loader is part of shell.qml, so a reimplementation in a fixture would only test itself. It follows runtime-smoke-test.sh: a copy of shell/ under a temp OMARCHY_PATH, an isolated HOME with a crafted shell.json pointing bar.id at a fixture plugin.

  • Injected properties. A fixture bar plugin declaring omarchyPath, barWidgetRegistry and barConfig as required, exactly as the first-party bar does. QML cannot instantiate it unless the loader supplies all three at creation. It reports the values back through the result file, so a property arriving undefined fails rather than passing quietly.
  • Broken bar. A fixture whose QML cannot load, asserting the log carries the fallback to omarchy.bar and that the handler did not throw a ReferenceError on the way.

Both were checked against the unfixed code so they are not vacuous:

variant result
loader fix absent case 1 fails — "never loaded"
only the errorString bug restored case 1 passes, case 2 fails — "did not fall back"

./test/all is 181 files with this added; the 4 failures on my machine (config-test, runtime-smoke-test, snapper-test, unowned-system-paths-test) are unchanged from a clean quattro checkout — they want a sibling omarchy-pkgs checkout, snapper config, and a pristine system.

One thing I noticed while in there, and did not touch since it is outside this PR: the panel loader at shell.qml:704 uses the same errorString && errorString() idiom this PR removed from the bar loader, with a comment saying Loader.errorString() reflects a source-load failure even when sourceComponent is null. In the bar loader that reference threw ReferenceError: errorString is not defined — that is what the fallback fix was for, and the new test's second case reproduces it. If the identifier does not resolve on a Loader here, the panel handler has the same latent problem, just on a rarer path. Worth a look by someone who knows which Qt version introduced it.

@koenhendriks
koenhendriks requested a balanced review from Copilot August 24, 2026 10:04

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread test/shell.d/plugin-bar-loader-test.sh Outdated
Comment on lines +205 to +208
if ! grep -q "failed to load, falling back to omarchy.bar" "$log_broken"; then
sed -n '1,120p' "$log_broken" >&2
fail "a bar plugin that cannot load did not fall back to the built-in bar"
fi
The broken-bar case only grepped for the warning, which the Loader.Error
handler prints before assigning failedBarId. So the test passed whether or
not the fallback actually took: remove the assignment and the log still
carries the warning.

Ask the shell instead. Once it has given up on the broken bar, activeBarId
is the built-in one, and listPlugins reports omarchy.bar as the active bar
option and the broken plugin as inactive. The test now polls the IPC for
that state.

Checked against the case the old assertion missed: with the warning left in
place and `shell.failedBarId = shell.activeBarId` removed, it now fails with
"did not fall back to the built-in bar".
@koenhendriks

Copy link
Copy Markdown
Author

Fixed in 723623d. You are right that the assertion proved nothing: the handler prints that warning before assigning failedBarId, so removing the assignment left the log unchanged and the test still passed.

It now asks the shell for the state instead. Once the broken bar is given up on, activeBarId is the built-in one, and listPlugins reports omarchy.bar with active: true and acme.broken-bar with active: false. The test polls the IPC for that, having first waited for shell ping, and dumps the bar-kind plugin rows plus the shell log if it never arrives.

Checked against exactly the hole you described: with the warning left in place and shell.failedBarId = shell.activeBarId removed, the case now fails with "did not fall back to the built-in bar". The old log grep passed under that same change.

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

shell/shell.qml:318

  • The new signal-driven reload path is not exercised by this test: both test cases start with one selected plugin, so they would still pass if onActiveBarSourceUrlChanged stopped reloading while active remains true. Add a runtime case that installs two valid bar plugins, switches directly between them, and verifies the second entry point loads.
      function onActiveBarSourceUrlChanged() { pluginBarLoader.loadPluginBar() }

The two existing cases each start with one selected plugin, so neither
exercises the reload that the url change drives: remove it and both still
pass. Add a case with two valid bar plugins that switches between them and
waits for the second entry point to report in.

The switch goes through enablePlugin, which sets bar.id with the in-process
config mutator. Rewriting shell.json and reloading it does not test this
path -- the reload empties the config on the way through, so
activeBarSourceUrl passes through "", the loader deactivates and reactivates,
and onActiveChanged does the reload. Mutating in place keeps both plugins
installed and the url non-empty, so `active` never drops and only the url
change is left to act.

Checked by making onActiveBarSourceUrlChanged reload only when nothing is
loaded yet, which is a handler that has stopped reloading while `active`
stays true: the first two cases still pass, the new one fails.
@koenhendriks

Copy link
Copy Markdown
Author

Added in 6b39043. You were right that the path was uncovered: with onActiveBarSourceUrlChanged gutted, both existing cases still passed.

The new case installs two valid bar plugins, starts on the first, then switches to the second and waits for that entry point to report its own id back.

One thing the switch had to get right to be worth anything. Rewriting shell.json and reloading it does not exercise this path — I traced it, and the reload empties the config on its way through, so activeBarSourceUrl passes through "", the loader deactivates and reactivates, and onActiveChanged does the reload. So the case switches via enablePlugin, which sets bar.id through the in-process config mutator: both plugins stay installed and the url stays non-empty, so active never drops and the url change is the only thing left to act.

Checked against the failure you described — a handler that stops reloading while active remains true:

ok     - a bar plugin declaring its injected properties required is loaded with them supplied
ok     - a bar plugin that cannot load falls back to the built-in bar
not ok - switching between two bar plugins did not load the second entry point

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

shell/shell.qml:184

  • This explanation is stale: loadPluginBar() now supplies manifest as a plain initial value, not a binding, and configureBar() only replaces that plain value. Reword this to explain that a same-URL manifest rescan does not recreate the item, which is the actual reason the explicit update handler is needed.
  // configureBar() assigns manifest imperatively at load, which replaces the
  // binding the bar was created with -- and a manifest can be re-read (a plugin
  // rescan) without its entry-point url changing, so nothing would reload the
  // bar or refresh the value. Push it the same way barConfig is pushed above.

shell/shell.qml:308

  • The broken-bar test verifies only fallback state and never asserts this new diagnostic or its failed URL. Removing or breaking the warning would restore the silent failure from the PR title while the suite still passes. Extend that case to inspect log_broken for the expected bar ID, source URL, and fallback ID.
        // Loader exposes no errorString; the engine has already logged the
        // component's own QML errors by the time this runs. Reaching for one
        // threw a ReferenceError here, which aborted the handler before the
        // fallback below and left the session with no bar and no explanation.
        console.warn("bar option " + shell.activeBarId + " (" + shell.activeBarSourceUrl + ") failed to load, falling back to " + shell.defaultBarId)

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 6b39043 against current quattro (3faafba). This needs a rebase and one change before it can go further, and part of it has already landed another way.

What quattro already fixed. Commit 1702cf0 (from #9618) removed the errorString reference from the bar loader's Loader.Error handler, so the fallback to omarchy.bar now runs. It also dropped required from shell/plugins/bar/Bar.qml, so a fresh omarchy plugin clone omarchy.bar loads. On a worker built from the Omarchy ISO, your plugin-bar-loader-test.sh run against unmodified quattro passes its fallback and bar-switch cases.

What is still broken on quattro, and what this fixes. A bar that declares omarchyPath, barWidgetRegistry or barConfig as required still can't be created, because the loader only assigns them in onLoaded. That covers a clone made before 1702cf0 and any third-party bar written that way. On the same worker, your first case fails on quattro with the three Required property … was not initialized warnings, followed by the fallback. So it is no longer a silent blank bar, but that bar still can't load. On this branch's own base, all three cases pass, and so do runtime-smoke-test.sh and manifest-entrypoints-test.sh.

What merging it onto quattro would break. quattro now gives third-party plugins capability-scoped facades instead of the host objects. configureBar() passes pluginShellFor(manifest), publicPluginManifest(manifest), pluginBarWidgetRegistryFor(manifest) and barConfigFor(manifest). With the one textual conflict resolved, setSource() at shell/shell.qml:278 instead hands every plugin bar the raw shell, shell.barWidgetRegistry, shell.barConfig and the internal manifest, at creation time. This applies to every plugin bar, not only those declaring required. I checked this on the worker with a fixture bar that reports what it receives in Component.onCompleted. On the merged tree it gets the real ShellRoot (pluginShellForId is callable) and a manifest still carrying __sourceDir. configureBar() later swaps in the facades, but anything captured before that keeps the host objects. plugin-auth-boundary-test.sh and runtime-smoke-test.sh still pass on the merged tree, because neither looks at creation time. onActiveBarManifestChanged (line 185) has the same problem on a rescan: it assigns the raw activeBarManifest, not publicPluginManifest(...). The fix is to build the setSource map from the same helpers configureBar() uses (including pluginRegistryFor, which the map currently omits), and to push publicPluginManifest(shell.activeBarManifest) in the handler.

In the test. shell_ipc_quiet shell ping can't serve as a readiness check, because omarchy-shell -q exits 0 when the shell is not reachable yet. Both ping loops therefore exit on their first pass, and the bar-switch case can send its single enablePlugin before IPC is up. Checking the output of plain shell_ipc shell ping would fix that.

Related. #7024 fixes a different leftover: the same errorString reference in the panel loader, which you pointed out in your 24 August comment. #8391, #8739 and #9219 mostly fix the parts quattro already has. #12115 takes the same setSource approach and has the same facade issue. None of them fixes the required-property case better than this one does.

The second opinion was Codex Medium. It independently found the creation-time facade bypass and the manifest handler, and it added the -q readiness problem and the missing pluginRegistry. It read the same trees I did, so its agreement on the first two isn't guaranteed to be independent. Next step is yours: rebase onto quattro, route the initial properties through the facade helpers, and fix the readiness check. Whether third-party bars should be able to declare these properties required at all is the maintainer's call, since quattro chose to relax Bar.qml instead.

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 or third-party bar plugin fails to load, leaving no bar and no error

3 participants