Skip to content

Check a clone's source before reporting it restored - #13509

Open
yeomanse wants to merge 4 commits into
omacom:quattrofrom
yeomanse:fix/plugin-remove-restore-message
Open

yeomanse wants to merge 4 commits into
omacom:quattrofrom
yeomanse:fix/plugin-remove-restore-message

Conversation

@yeomanse

Copy link
Copy Markdown

Fixes #13507

omarchy plugin remove prints Restored <source>. for any enabled clone, but the registry only re-enables the source when enabling the clone is what disabled it. remove now checks the source after the rescan and only reports it restored if it's enabled; otherwise it says it's still disabled and how to enable it:

omarchy.disk-speedtest is still disabled. Enable it with: omarchy plugin enable omarchy.disk-speedtest

Tests: test/shell.d/plugin-clone-test.sh has a new case that fails on quattro and passes with this change; plugins, plugin-enable, plugin-add and plugin-registry-contract also pass.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@llstrk

llstrk commented Sep 29, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Outcome: The new source lookup can make omarchy plugin remove exit 1 after the plugin is already removed.

Source lookup can fail the command after removal

The new listPlugins | jq lookup runs after the clone is moved to its backup, under set -euo pipefail with no fallback. If that IPC call fails (for example omarchy-shell is not responding after its 2s timeout), remove prints Removed ... and exits 1 with no final line; the merge-base exits 0. The reproducer forces the failure; timing was not measured.

Suggested change: Make the lookup best effort (...) || source_enabled=""), as in the patch below.

Reproducer: lookup failure (fails at 91d3868)

Reproducer: a failed source lookup now fails omarchy plugin remove after the clone is already removed

Reviewed head: 91d386852ba38adc7589fb2a3508b66b096c8b52 (PR #13509). Merge-base: 3faafba234e530b0986196b98dc2c38951e7dd6f.

The new listPlugins | jq substitution runs after the plugin has been moved or deleted and after rescanPlugins, under set -euo pipefail. If that call fails, for example omarchy-shell is not responding when the 2s IPC timeout expires while the shell is still reloading, the command exits 1 with no restore or disabled line. At the merge-base the same run prints Restored ... and exits 0. The stub below makes the IPC fail only after the rescan; it does not reproduce real shell timing.

Save as test/shell.d/plugin-remove-listplugins-failure-test.sh in a checkout and run it with bash. No live shell is needed; omarchy-shell is stubbed.

#!/bin/bash

# Reproducer: the source lookup this PR adds runs after the clone is already
# removed, under set -euo pipefail. If that one IPC call fails (for example
# "omarchy-shell is not responding" while the shell is still reloading after
# rescanPlugins), remove exits nonzero with no restored/disabled line.

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
plugins="$TMPDIR/home/.config/omarchy/plugins"
mkdir -p "$plugins/tester.idle" "$TMPDIR/bin"
printf '%s\n' '{"id":"tester.idle","omarchy":{"clonedFrom":"omarchy.idle"}}' >"$plugins/tester.idle/manifest.json"

# Answers normally until the rescan, then fails the way omarchy-shell does
# when its IPC timeout expires.
cat >"$TMPDIR/bin/omarchy-shell" <<'SH'
#!/bin/bash
case "$*" in
  *rescanPlugins*)
    touch "$FAKE_STATE/rescanned"
    ;;
  *listPlugins*)
    if [[ -e $FAKE_STATE/rescanned ]]; then
      echo "omarchy-shell is not responding" >&2
      exit 1
    fi
    printf '[{"id":"tester.idle","enabled":true},{"id":"omarchy.idle","enabled":false}]\n'
    ;;
  *setPluginEnabled*)
    printf 'ok\n'
    ;;
esac
SH
chmod +x "$TMPDIR/bin/omarchy-shell"

status=0
output=$(HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$TMPDIR/bin:$ROOT/bin:$PATH" FAKE_STATE="$TMPDIR" \
  omarchy-plugin-remove tester.idle --yes 2>&1) || status=$?
printf '%s\n' "${output//$TMPDIR/\$TMPDIR}"
printf 'exit status: %s\n' "$status"

[[ ! -e $plugins/tester.idle ]] || fail "remove did not remove the clone"
(( status == 0 )) ||
  fail "remove exits $status after the clone was already removed when the source lookup fails"
pass "remove still succeeds when the shell stops answering after the rescan"

Actual output at the PR head (91d3868)

$ bash test/shell.d/plugin-remove-listplugins-failure-test.sh; echo "exit=$?"
Removed tester.idle. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.idle.bak.20260929073320
omarchy-shell is not responding
exit status: 1
not ok - remove exits 1 after the clone was already removed when the source lookup fails
exit=1

Actual output at the merge-base (3faafba)

$ bash test/shell.d/plugin-remove-listplugins-failure-test.sh; echo "exit=$?"
Removed tester.idle. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.idle.bak.20260929073321
Restored omarchy.idle.
exit status: 0
ok - remove still succeeds when the shell stops answering after the rescan
exit=0

With the suggested change (lookup made best effort, false and unknown told apart)

$ bash test/shell.d/plugin-remove-listplugins-failure-test.sh; echo "exit=$?"
Removed tester.idle. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.idle.bak.20260929073459
exit status: 0
ok - remove still succeeds when the shell stops answering after the rescan
exit=0

The backup timestamp differs between runs. $TMPDIR stands for the test's temporary directory.

Suggested patch for both lookup findings (passes the PR's test and both reproducers)
--- a/bin/omarchy-plugin-remove
+++ b/bin/omarchy-plugin-remove
@@ -117,12 +117,14 @@
 omarchy-shell shell rescanPlugins >/dev/null
 
 if [[ -n $cloned_from && $was_enabled == "true" ]]; then
-  source_enabled=$(omarchy-shell shell listPlugins | jq -r --arg id "$cloned_from" '
+  # The plugin is already gone, so a shell that does not answer here only
+  # costs the report, not the command.
+  source_enabled=$(omarchy-shell shell listPlugins 2>/dev/null | jq -r --arg id "$cloned_from" '
     .[] | select(.id == $id) | .enabled
-  ')
+  ' 2>/dev/null) || source_enabled=""
   if [[ $source_enabled == "true" ]]; then
     echo "Restored $cloned_from."
-  else
+  elif [[ $source_enabled == "false" ]]; then
     echo "$cloned_from is still disabled. Enable it with: omarchy plugin enable $cloned_from"
   fi
 elif [[ $was_enabled == "true" ]]; then
More findings: a source that listPlugins does not return

A source that listPlugins does not return gets an enable hint that fails

The new else treats an empty lookup result the same as false. A clone's clonedFrom can name a built-in that no longer exists (for example omarchy.model-usage, renamed to omarchy.agents by a migration that does not rewrite clone manifests), so remove prints ... is still disabled. Enable it with: omarchy plugin enable omarchy.model-usage, and that command fails with plugin 'omarchy.model-usage' is not known. The merge-base printed Restored omarchy.model-usage., also wrong, so this is a different wrong message rather than a regression.

Suggested change: Print the enable hint only when the value is exactly false (included in the patch above).

Reproducer (fails at 91d3868):

Reproducer: a source the shell does not list is reported as "still disabled", with an enable command that fails

Reviewed head: 91d386852ba38adc7589fb2a3508b66b096c8b52 (PR #13509). Merge-base: 3faafba234e530b0986196b98dc2c38951e7dd6f.

The new branch sends every value other than true to the "still disabled" message, including no value at all (the source id is not in listPlugins). That happens for a clone whose clonedFrom names a built-in that no longer exists, for example one cloned before migration 1786099804.sh renamed omarchy.model-usage to omarchy.agents; that migration rewrites shell.json, not clone manifests. The suggested omarchy plugin enable then fails. The merge-base printed Restored omarchy.model-usage., which was wrong too, so this is a different wrong message rather than a regression. The stub's enablePlugin answer mirrors PluginRegistry.setEnabled, which returns false for an id with no manifest, so the IPC handler answers unknown.

Save as test/shell.d/plugin-remove-missing-source-test.sh in a checkout and run it with bash.

#!/bin/bash

# Reproducer: a clone whose clonedFrom names a built-in the shell no longer
# lists (for example a clone made before omarchy.model-usage became
# omarchy.agents; that rename migration rewrites shell.json, not clone
# manifests). The PR treats "not listed" as "disabled" and suggests an enable
# command that then fails.

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
plugins="$TMPDIR/home/.config/omarchy/plugins"
mkdir -p "$plugins/tester.model-usage" "$TMPDIR/bin"
printf '%s\n' '{"id":"tester.model-usage","omarchy":{"clonedFrom":"omarchy.model-usage"}}' >"$plugins/tester.model-usage/manifest.json"

# listPlugins does not include omarchy.model-usage. enablePlugin answers
# "unknown" for an id with no manifest, as PluginRegistry.setEnabled does.
cat >"$TMPDIR/bin/omarchy-shell" <<'SH'
#!/bin/bash
case "$*" in
  *listPlugins*)
    printf '[{"id":"tester.model-usage","enabled":true},{"id":"omarchy.agents","enabled":true}]\n'
    ;;
  *setPluginEnabled*)
    printf 'ok\n'
    ;;
  *enablePlugin*omarchy.model-usage*)
    printf 'unknown\n'
    ;;
esac
SH
chmod +x "$TMPDIR/bin/omarchy-shell"

run() {
  HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$TMPDIR/bin:$ROOT/bin:$PATH" "$@"
}

output=$(run omarchy-plugin-remove tester.model-usage --yes 2>&1)
printf '%s\n' "${output//$TMPDIR/\$TMPDIR}"

if grep -q 'Enable it with: omarchy plugin enable omarchy.model-usage' <<<"$output"; then
  enable_status=0
  enable_output=$(run omarchy-plugin-enable omarchy.model-usage 2>&1) || enable_status=$?
  printf '$ omarchy plugin enable omarchy.model-usage\n%s\nexit status: %s\n' "$enable_output" "$enable_status"
  fail "remove suggests enabling a source the shell does not list"
fi
pass "remove does not suggest enabling a source the shell does not list"

Actual output at the PR head (91d3868)

$ bash test/shell.d/plugin-remove-missing-source-test.sh; echo "exit=$?"
Removed tester.model-usage. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.model-usage.bak.20260929073320
omarchy.model-usage is still disabled. Enable it with: omarchy plugin enable omarchy.model-usage
$ omarchy plugin enable omarchy.model-usage
omarchy-plugin-enable: plugin 'omarchy.model-usage' is not known; run: omarchy-shell shell rescanPlugins
exit status: 1
not ok - remove suggests enabling a source the shell does not list
exit=1

Actual output at the merge-base (3faafba)

$ bash test/shell.d/plugin-remove-missing-source-test.sh; echo "exit=$?"
Removed tester.model-usage. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.model-usage.bak.20260929073321
Restored omarchy.model-usage.
ok - remove does not suggest enabling a source the shell does not list
exit=0

With the suggested change

$ bash test/shell.d/plugin-remove-missing-source-test.sh; echo "exit=$?"
Removed tester.model-usage. Backup at: $TMPDIR/home/.config/omarchy/plugins/.tester.model-usage.bak.20260929073459
ok - remove does not suggest enabling a source the shell does not list
exit=0

The backup timestamp differs between runs. $TMPDIR stands for the test's temporary directory.

More findings: a mixed-kind source already in disabledPlugins

A mixed-kind source already in disabledPlugins is still reported restored

For a source that is both a bar-widget and a menu or service (omarchy.menu, omarchy.media), listPlugins reports enabled as bar placement (shell/shell.qml 1806-1807), and removing the clone always puts the source back in the bar. If the source was already in disabledPlugins when the clone was enabled (for example a hand-edited disabledPlugins or a second clone of the same built-in), remove prints Restored <source>. while isEnabled stays false and nothing of the source loads. The merge-base prints the same line, so this is a gap the PR leaves rather than a regression.

Suggested change: Have listPlugins also report whether the plugin loads (isEnabled) and print Restored only when both are true; this direction was not tested.

Reproducer (registry fixture, fails at 91d3868):

Reproducer: a mixed-kind source that is already in disabledPlugins is reported "Restored" but does not load

Reviewed head: 91d386852ba38adc7589fb2a3508b66b096c8b52 (PR #13509).

This drives the real shell/services/PluginRegistry.qml through setEnabled(clone, true) and then setEnabled(clone, false). That second call is the one omarchy plugin remove makes. It runs for sources that are both a bar widget and a menu (omarchy.hybrid, shaped like omarchy.menu) or a service (omarchy.svcwidget, shaped like omarchy.media). It records two values for the source after each step:

  • listPlugins.enabled: what omarchy-shell shell listPlugins reports. For a bar-widget kind that is inBar(id) (shell/shell.qml lines 1806-1807, restated in the fixture's listedEnabled). The PR prints Restored <source>. exactly when this is true.
  • loads: isEnabled(id). This is the gate for the bar widget component (syncPluginWidgets, line 1415), menus and panels (computePanelEntries, line 1336), services (_syncServices, line 952) and summon (line 1154).

Scenarios B, C, D and G fail. After the clone is removed, the source is back in the bar, so listPlugins says enabled and head prints Restored .... But it is still in disabledPlugins, so nothing of it loads. The merge-base prints the same Restored ... line in these cases, so this is a gap the PR leaves, not a regression. Scenario A (the normal CLI path) and scenario H (omarchy plugin disable of a mixed-kind source) are included for contrast.

It runs quickshell with QT_QPA_PLATFORM=offscreen, so no compositor is needed. Save the QML as test/shell.d/fixtures/plugin-registry-mixed-kind/shell.qml and the script as test/shell.d/plugin-registry-mixed-kind-test.sh, then run the script with bash from the repository root.

test/shell.d/fixtures/plugin-registry-mixed-kind/shell.qml

import QtQuick
import Quickshell
import "services"

// Reviewer fixture for PR #13509: clone restore of a source that is both a
// bar widget and a menu/service, driven through the real PluginRegistry.qml.
// Helpers mirror test/shell.d/fixtures/plugin-registry/shell.qml.
ShellRoot {
  id: root

  readonly property string resultPath: Quickshell.env("OMARCHY_QML_TEST_RESULT")
  property var failures: []
  property var steps: []
  property var config: ({ version: 1, bar: { layout: { left: [], center: [], right: [] } }, plugins: [] })

  function fail(message) { failures.push(String(message)) }

  function shellQuote(value) {
    return "'" + String(value).replace(/'/g, "'\\''") + "'"
  }

  function manifest(id, kinds, entryPoints) {
    return { schemaVersion: 1, id: id, name: id, version: "1.0.0", kinds: kinds, entryPoints: entryPoints }
  }

  function block(kind, source, payload) {
    return "===" + kind + "::" + source + "===\n" + JSON.stringify(payload) + "\n=== EOM ===\n"
  }

  // What `omarchy-shell shell listPlugins` reports as `enabled` for a
  // non-bar plugin: shell/shell.qml listPlugins, lines 1806-1807.
  function listedEnabled(id) {
    var kinds = registry.installedPlugins[id].kinds || []
    return kinds.indexOf("bar-widget") !== -1 ? registry.inBar(id) : registry.isEnabled(id)
  }

  // The gate every loader applies: syncPluginWidgets (1415), computePanelEntries
  // (1336), _syncServices (952) and summon (1154) all require isEnabled.
  function loads(id) { return registry.isEnabled(id) }

  function record(scenario, label, source) {
    var c = root.config
    steps.push({
      scenario: scenario,
      step: label,
      layout: c.bar && c.bar.layout ? c.bar.layout : null,
      disabledPlugins: c.disabledPlugins === undefined ? null : c.disabledPlugins,
      cloneSourceRestores: c.cloneSourceRestores === undefined ? null : c.cloneSourceRestores,
      sourceListedEnabled: listedEnabled(source),
      sourceLoads: loads(source)
    })
  }

  // After the clone is gone, head prints "Restored <source>." exactly when
  // listPlugins reports the source enabled. Check that this matches what loads.
  function checkReport(scenario, source) {
    var said = listedEnabled(source) ? "Restored " + source + "." : source + " is still disabled."
    if (listedEnabled(source) !== loads(source))
      fail(scenario + ": remove would print \"" + said + "\" but the source "
        + (loads(source) ? "loads" : "does not load (isEnabled is false)"))
  }

  function runChecks() {
    var scan = ""
    scan += block("firstparty", "/first/hybrid", manifest("omarchy.hybrid", ["menu", "bar-widget"], { menu: "Menu.qml", barWidget: "Widget.qml" }))
    scan += block("firstparty", "/first/media", manifest("omarchy.svcwidget", ["service", "bar-widget"], { service: "Service.qml", barWidget: "Widget.qml" }))
    var localHybrid = manifest("local.hybrid", ["menu", "bar-widget"], { menu: "Menu.qml", barWidget: "Widget.qml" })
    localHybrid.omarchy = { clonedFrom: "omarchy.hybrid" }
    scan += block("thirdparty", "/third/local-hybrid", localHybrid)
    var sharedHybrid = manifest("shared.hybrid", ["menu", "bar-widget"], { menu: "Menu.qml", barWidget: "Widget.qml" })
    sharedHybrid.omarchy = { clonedFrom: "omarchy.hybrid" }
    scan += block("thirdparty", "/third/shared-hybrid", sharedHybrid)
    var localSvc = manifest("local.svcwidget", ["service", "bar-widget"], { service: "Service.qml", barWidget: "Widget.qml" })
    localSvc.omarchy = { clonedFrom: "omarchy.svcwidget" }
    scan += block("thirdparty", "/third/local-svcwidget", localSvc)
    registry.parseScanOutput(scan)

    // H: `omarchy plugin disable` of a mixed-kind built-in.
    root.config = { version: 1, bar: { layout: { left: [{ id: "omarchy.svcwidget" }], center: [], right: [] } }, plugins: [] }
    record("H disable mixed-kind source", "before", "omarchy.svcwidget")
    registry.setEnabled("omarchy.svcwidget", false)
    record("H disable mixed-kind source", "after setEnabled(source,false)", "omarchy.svcwidget")

    // A: CLI path. Source taken off the bar with disable (writes no
    // disabledPlugins), then its clone enabled and removed.
    root.config = { version: 1, bar: { layout: { left: [{ id: "omarchy.hybrid" }], center: [], right: [] } }, plugins: [] }
    registry.setEnabled("omarchy.hybrid", false)
    record("A off bar via disable", "source disabled", "omarchy.hybrid")
    registry.setEnabled("local.hybrid", true)
    record("A off bar via disable", "clone enabled", "omarchy.hybrid")
    registry.setEnabled("local.hybrid", false)
    record("A off bar via disable", "clone disabled (remove)", "omarchy.hybrid")
    checkReport("A off bar via disable", "omarchy.hybrid")

    // B: source in disabledPlugins and still in the bar when the clone is enabled.
    root.config = { version: 1, bar: { layout: { left: [{ id: "omarchy.hybrid" }], center: [], right: [] } }, plugins: [], disabledPlugins: ["omarchy.hybrid"] }
    record("B disabledPlugins, in bar", "before", "omarchy.hybrid")
    registry.setEnabled("local.hybrid", true)
    record("B disabledPlugins, in bar", "clone enabled", "omarchy.hybrid")
    registry.setEnabled("local.hybrid", false)
    record("B disabledPlugins, in bar", "clone disabled (remove)", "omarchy.hybrid")
    checkReport("B disabledPlugins, in bar", "omarchy.hybrid")
    // E: what `omarchy plugin enable <source>` would then do.
    registry.setEnabled("omarchy.hybrid", true)
    record("E enable after B", "setEnabled(source,true)", "omarchy.hybrid")

    // C: source in disabledPlugins and off the bar.
    root.config = { version: 1, bar: { layout: { left: [], center: [], right: [] } }, plugins: [], disabledPlugins: ["omarchy.hybrid"] }
    registry.setEnabled("local.hybrid", true)
    record("C disabledPlugins, off bar", "clone enabled", "omarchy.hybrid")
    registry.setEnabled("local.hybrid", false)
    record("C disabledPlugins, off bar", "clone disabled (remove)", "omarchy.hybrid")
    checkReport("C disabledPlugins, off bar", "omarchy.hybrid")

    // D: as C for a service plus bar-widget source (omarchy.media's kinds).
    root.config = { version: 1, bar: { layout: { left: [], center: [], right: [] } }, plugins: [], disabledPlugins: ["omarchy.svcwidget"] }
    registry.setEnabled("local.svcwidget", true)
    record("D service+widget, disabledPlugins", "clone enabled", "omarchy.svcwidget")
    registry.setEnabled("local.svcwidget", false)
    record("D service+widget, disabledPlugins", "clone disabled (remove)", "omarchy.svcwidget")
    checkReport("D service+widget, disabledPlugins", "omarchy.svcwidget")

    // G: CLI-only route. Own clone enabled normally, then a second clone of
    // the same built-in (for example a shared one) enabled and removed.
    root.config = { version: 1, bar: { layout: { left: [{ id: "omarchy.hybrid" }], center: [], right: [] } }, plugins: [] }
    registry.setEnabled("local.hybrid", true)
    record("G second clone", "own clone enabled", "omarchy.hybrid")
    registry.setEnabled("shared.hybrid", true)
    record("G second clone", "second clone enabled", "omarchy.hybrid")
    registry.setEnabled("shared.hybrid", false)
    record("G second clone", "second clone disabled (remove)", "omarchy.hybrid")
    checkReport("G second clone", "omarchy.hybrid")

    var payload = JSON.stringify({ ok: failures.length === 0, failures: failures, steps: steps })
    if (resultPath)
      Quickshell.execDetached(["bash", "-c", "printf '%s' " + shellQuote(payload) + " > " + shellQuote(resultPath)])
  }

  PluginRegistry {
    id: registry
    firstPartyDir: ""
    pluginsDir: Quickshell.env("HOME") + "/.config/omarchy/plugins"
    shellConfigProvider: function() { return root.config }
    shellConfigMutator: function(mutator) {
      var next = JSON.parse(JSON.stringify(root.config || {}))
      mutator(next)
      root.config = next
    }
  }

  Timer {
    interval: 100
    running: true
    repeat: false
    onTriggered: root.runChecks()
  }
}

test/shell.d/plugin-registry-mixed-kind-test.sh

#!/bin/bash

# Reproducer for PR #13509: removing a clone of a source that is both a bar
# widget and a menu or service, when that source is already in
# disabledPlugins. Runs the real shell/services/PluginRegistry.qml under
# quickshell with Qt's offscreen platform, so no compositor is needed.

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

command -v quickshell >/dev/null 2>&1 || { skip "quickshell not installed"; exit 0; }
require_command jq

TMPDIR=$(mktemp -d)
QS_PID=""
cleanup() {
  if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then
    kill "$QS_PID" 2>/dev/null || true
    wait "$QS_PID" 2>/dev/null || true
  fi
  rm -rf "$TMPDIR"
}
trap cleanup EXIT

result="$TMPDIR/result.json"
config_dir="$TMPDIR/config"
mkdir -p "$config_dir" "$TMPDIR/home"
cp "$SHELL_TEST_DIR/fixtures/plugin-registry-mixed-kind/shell.qml" "$config_dir/shell.qml"
ln -s "$ROOT/shell/services" "$config_dir/services"
ln -s "$ROOT/shell/Commons" "$config_dir/Commons"

QT_QPA_PLATFORM=offscreen OMARCHY_PATH="$ROOT" OMARCHY_QML_TEST_RESULT="$result" HOME="$TMPDIR/home" \
  quickshell -p "$config_dir" --no-color >"$TMPDIR/quickshell.log" 2>&1 &
QS_PID=$!

for _ in {1..100}; do
  [[ -s $result ]] && break
  kill -0 "$QS_PID" 2>/dev/null || fail "quickshell exited before writing a result"
  sleep 0.1
done
[[ -s $result ]] || fail "no result from quickshell"

jq -r '.steps[] | "\(.scenario) | \(.step): layout=\(.layout | tostring) disabledPlugins=\(.disabledPlugins | tostring) cloneSourceRestores=\(.cloneSourceRestores | tostring) listPlugins.enabled=\(.sourceListedEnabled) loads=\(.sourceLoads)"' "$result"
if ! jq -e '.ok' "$result" >/dev/null; then
  jq -r '.failures[]' "$result" >&2
  fail "remove's restore report matches whether the source loads"
fi
pass "remove's restore report matches whether the source loads"

Actual output at the PR head (91d3868), quickshell 0.3.1

$ bash test/shell.d/plugin-registry-mixed-kind-test.sh; echo "exit=$?"
H disable mixed-kind source | before: layout={"left":[{"id":"omarchy.svcwidget"}],"center":[],"right":[]} disabledPlugins=null cloneSourceRestores=null listPlugins.enabled=true loads=true
H disable mixed-kind source | after setEnabled(source,false): layout={"left":[],"center":[],"right":[]} disabledPlugins=null cloneSourceRestores=null listPlugins.enabled=false loads=true
A off bar via disable | source disabled: layout={"left":[],"center":[],"right":[]} disabledPlugins=null cloneSourceRestores=null listPlugins.enabled=false loads=true
A off bar via disable | clone enabled: layout={"left":[],"center":[{"id":"local.hybrid"}],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=["local.hybrid"] listPlugins.enabled=false loads=false
A off bar via disable | clone disabled (remove): layout={"left":[],"center":[{"id":"omarchy.hybrid"}],"right":[]} disabledPlugins=null cloneSourceRestores=null listPlugins.enabled=true loads=true
B disabledPlugins, in bar | before: layout={"left":[{"id":"omarchy.hybrid"}],"center":[],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=null listPlugins.enabled=true loads=false
B disabledPlugins, in bar | clone enabled: layout={"left":[{"id":"local.hybrid"}],"center":[],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=null listPlugins.enabled=false loads=false
B disabledPlugins, in bar | clone disabled (remove): layout={"left":[{"id":"omarchy.hybrid"}],"center":[],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=null listPlugins.enabled=true loads=false
E enable after B | setEnabled(source,true): layout={"left":[{"id":"omarchy.hybrid"}],"center":[],"right":[]} disabledPlugins=null cloneSourceRestores=null listPlugins.enabled=true loads=true
C disabledPlugins, off bar | clone enabled: layout={"left":[],"center":[{"id":"local.hybrid"}],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=null listPlugins.enabled=false loads=false
C disabledPlugins, off bar | clone disabled (remove): layout={"left":[],"center":[{"id":"omarchy.hybrid"}],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=null listPlugins.enabled=true loads=false
D service+widget, disabledPlugins | clone enabled: layout={"left":[],"center":[{"id":"local.svcwidget"}],"right":[]} disabledPlugins=["omarchy.svcwidget"] cloneSourceRestores=null listPlugins.enabled=false loads=false
D service+widget, disabledPlugins | clone disabled (remove): layout={"left":[],"center":[{"id":"omarchy.svcwidget"}],"right":[]} disabledPlugins=["omarchy.svcwidget"] cloneSourceRestores=null listPlugins.enabled=true loads=false
G second clone | own clone enabled: layout={"left":[{"id":"local.hybrid"}],"center":[],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=["local.hybrid"] listPlugins.enabled=false loads=false
G second clone | second clone enabled: layout={"left":[{"id":"local.hybrid"}],"center":[{"id":"shared.hybrid"}],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=["local.hybrid"] listPlugins.enabled=false loads=false
G second clone | second clone disabled (remove): layout={"left":[{"id":"local.hybrid"}],"center":[{"id":"omarchy.hybrid"}],"right":[]} disabledPlugins=["omarchy.hybrid"] cloneSourceRestores=["local.hybrid"] listPlugins.enabled=true loads=false
B disabledPlugins, in bar: remove would print "Restored omarchy.hybrid." but the source does not load (isEnabled is false)
C disabledPlugins, off bar: remove would print "Restored omarchy.hybrid." but the source does not load (isEnabled is false)
D service+widget, disabledPlugins: remove would print "Restored omarchy.svcwidget." but the source does not load (isEnabled is false)
G second clone: remove would print "Restored omarchy.hybrid." but the source does not load (isEnabled is false)
not ok - remove's restore report matches whether the source loads
exit=1

Reading the result:

  • B, C, D and G end with listPlugins.enabled=true loads=false. The PR prints Restored <source>., but the source's widget, menu or service does not load.
  • E shows that omarchy plugin enable <source> (setEnabled(source, true)) would repair it. The PR never suggests that command here, because the "still disabled" branch needs enabled to be something other than true.
  • A shows the normal path is reported correctly. It also shows the source comes back into the bar, in the clone's slot, although the user had taken it off.
  • H shows that omarchy plugin disable of a mixed-kind source only removes its bar entry. It records nothing in disabledPlugins, and the source keeps loading.
Details

Verified:

  • The omarchy plugin remove prints "Restored <source>." when the source stays disabled #13507 scenario (source already disabled when a non-widget clone was enabled) now prints the enable hint instead of Restored.
  • The new test case fails with the merge-base's omarchy-plugin-remove and passes at the head, also on the current quattro tip.
  • The source state read after rescanPlugins is not stale: setPluginEnabled updates the shell config synchronously before the IPC returns, and listPlugins reads that same config.
  • For non-widget clones (panel, service, overlay, menu-only), Restored is printed when the source was enabled; when it was already disabled, the new hint is printed and omarchy plugin enable <source> re-enables it.
  • The plugins, plugin-enable and plugin-add tests pass at the head.

Optional test improvement: The fake listPlugins returns a fixed source state, so a mutant that reads the source from the pre-removal listPlugins snapshot still passes the PR's test (21/21). A stub that re-enables the source only when setPluginEnabled <clone> false is called catches both that mutant and the merge-base.

Related: #13678 fixes the same issue (it stays silent instead of printing an enable hint) and conflicts textually with this PR in both changed files.


Review information

Test scope: Source code and sandbox tests (stubbed omarchy-shell, offscreen registry fixture), at 91d3868; not tested against a live shell.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

The source lookup runs after the clone has been moved to its backup, so under set -e a shell that stops answering there made remove exit 1 with the plugin already gone. It is now best effort, and the enable hint is printed only when the shell lists the source as disabled: a source it does not list at all, such as a built-in renamed since the clone was made, would be told to run an enable that fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy worker. The bug in #13507 is real: PluginRegistry only re-enables the source when enabling the clone is what disabled it, so the unconditional Restored <source>. was wrong for a source that was already disabled. This change fixes that.

I pushed one commit on top (9095a39), for two points from @llstrk's review above that I confirmed:

  • The source lookup runs after the clone has already been moved to its backup. Under set -euo pipefail, a shell that stopped answering at that point made omarchy plugin remove exit 1 with the plugin already gone. The lookup is now best effort, so that case prints no report line and the command still succeeds.
  • The enable hint is now printed only when the shell lists the source as false. A source the shell does not list at all (for example a built-in renamed after the clone was made) used to get an omarchy plugin enable hint that then fails.
  • The listPlugins stub in plugin-clone-test.sh now skips hidden backup directories, as the real scanner does. Without this, a second clone of the same source listed its own earlier backup, was_enabled came out as two lines, and the source check never ran. The two new cases for the points above depend on this.

On the worker, test/shell.d/plugin-clone-test.sh fails against the base's omarchy-plugin-remove, fails against 91d3868 (the unlisted-source case, and separately the stopped-shell case), and passes at 9095a39 (23 of 23). plugins, plugin-enable, plugin-add and plugin-registry-contract also pass. The full ./test/cli and test/shell runs each have failures (one and five), all outside the plugin code, and the same tests fail on the base on the same worker. GitHub reports no CI checks on this pull request.

Codex Medium reviewed the final diff as a second opinion and found nothing blocking. It agreed with the above, and its independence from my review is not guaranteed. One gap it pointed out was already there before this PR: a failed rescanPlugins call still exits nonzero after the plugin has been removed.

Not covered here, and also already there before this PR: for a source that is both a bar widget and a menu or service, listPlugins reports bar placement as enabled. If that source was already in disabledPlugins, it can still be reported as restored while nothing of it loads (scenarios B to G in the review above). That needs a change to what listPlugins reports, so I have left it for the maintainer.

Waiting on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

omarchy-plugin-remove now checks a clone’s source before reporting it restored.

  • Removing a clone reports whether its source is really enabled.

Reviews (3) · Last reviewed commit: "Merge quattro to refresh translation che..." · Reviewed by Greptile

listPlugins reports a bar widget as enabled when it sits in the bar, but a widget that is also a menu or service, like omarchy.menu, does not load while it is in disabledPlugins. restoreCloneSource puts the source's bar entry back and lifts that disable only when enabling the clone is what set it, so a source the user had disabled first came back to the bar, still disabled, and was reported restored. Read disabledPlugins too, ignoring it unless it is an array as the registry does, and best effort like the listPlugins lookup, so a shell that stops answering costs only the report.

From omacom#15250.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed one more commit (ae6f3ee). It folds in a check from #15250, a newer fix for the same #13507. This pull request is the one carried forward, and the commit credits #15250.

The gap my last comment left for the maintainer is now closed. For a source that is both a bar widget and a menu or service, like omarchy.menu, listPlugins reports enabled from whether it is in the bar. restoreCloneSource in shell/services/PluginRegistry.qml puts the bar entry back, but it only lifts disabledPlugins when enabling the clone is what set it. So a source the user had disabled first came back to the bar without loading, and was reported restored. remove now also reads disabledPlugins from listShellConfig. A listed source is reported as still disabled, with the omarchy plugin enable hint. The lookup is best effort like the listPlugins one, so a shell that does not answer costs only the report line. A disabledPlugins that is not an array is ignored, the same as in the registry.

test/shell.d/plugin-clone-test.sh has two new cases: a source that is back in the bar but listed in disabledPlugins, and a listShellConfig call that fails. On a disposable Omarchy worker it passes 25 of 25 at ae6f3ee, and also when merged with current quattro (cce8b1c). With this commit's change to bin/omarchy-plugin-remove reverted, the first new case fails. With the base's script, the existing still-disabled case fails. Merged with quattro, ./test/cli passes 125 of 125. The full test/shell run has 8 failures (block-art logo, backgrounds, da menu catalog, lock-view timing, pre_remove, a keepLoaded fixture). The same 8 fail on quattro alone on the same worker, and none are in the plugin code.

Codex Medium reviewed this change as a second opinion. In its first round it found two cases where a hand-edited config would produce the wrong report. The non-array case is fixed in this commit. It withdrew the other, a bar in disabledPlugins, after checking that setEnabled never adds a bar there. Its second round, on ae6f3ee, found nothing open. Its independence from my review is not guaranteed.

Waiting on the maintainer. The full shell suite is not green on quattro itself, and that is what keeps this from being marked ready.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 17, 2026
…ssions

Keep both the clone-source status cases and quattro’s empty-plugin-picker regression while bringing in the corrected locale test fixture. The historical CI logs are no longer available, so this refresh is checked against the current translation gate rather than claiming to explain that run.

Co-Authored-By: GPT-6 (effort not exposed) <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Merged current quattro into this branch in df332b3, preserving both the clone-source regression cases and quattro’s newer empty-picker case. The test-file conflict is resolved.

On a disposable Omarchy worker linked to this head, test/cli passed 143 checks, plugin-clone-test.sh passed 26, the plugin list/enable/add/registry tests passed, and the structural translation test passed 415. The English-literal extraction check also passed. I did not rerun the unrelated full shell suite.

I also exercised the real shell with distinct clone IDs. For a source disabled before its clone was enabled, the base removal script falsely reported restoration, this head printed the enable hint, and restoring the base script brought back the false report. The same held for a menu/widget source that was back in the bar but still in disabledPlugins. Normal restoration still reports Restored; a deliberately stale-status version failed that live check.

Reviewed by GPT-6 High in Codex and Opus 5.5 High and muse-wonder via pi, thinking high. Both second-opinion reviewers found no code defects; Opus noted an optional persistent test gap for stale status, which the live normal-restoration check above exercised. Their independence from my review is not guaranteed.

The historical translation run’s logs and job details are no longer available, so its original failure remains unexplained. On df332b3, GitHub has marked both Tests and Check translation structure as action_required without starting jobs. Waiting on the maintainer; those runs still need action.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy plugin remove prints "Restored <source>." when the source stays disabled

3 participants