Skip to content

Let the Elsewhen migration survive a shell it cannot reach - #12853

Merged
spencerbull merged 2 commits into
quattrofrom
elsewhen-migration-absent-shell
Sep 22, 2026
Merged

spencerbull merged 2 commits into
quattrofrom
elsewhen-migration-absent-shell

Conversation

@spencerbull

@spencerbull spencerbull commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

omarchy update dies at the Elsewhen migration with "omarchy-shell is not running" and then "Something went wrong during the update!". The migration runs omarchy-shell shell rescanPlugins bare; omarchy-shell asks qs ipc for an instance on $OMARCHY_PATH/shell, and no shell answering there is a non-zero exit. omarchy-migrate runs migrations under set -e, so that one exit ends the update before its post-update hooks, the shell restart and the reboot prompt, and the marker is never written, so every later update fails the same way until a shell can be asked.

An update has no shell to ask more often than it looks: run from a TTY or over ssh, or with the shell down after the package replaced its QML, or from an environment that names a tree the running shell was not started from. omarchy-bar put was already written to carry on without a shell, and the keyboard-layout migration relies on that; the rescan was the one call without that tolerance, and its test asserted the opposite.

Two changes, one per commit:

  • The rescan is best-effort. omarchy-shell -q shell rescanPlugins, the shape Make the closing plugin rescan best-effort #11117 gives the plugin commands' closing rescan. A shell that cannot be asked is the update's to restart afterwards, not the migration's failure to report. An unknown widget on a live shell still leaves the migration pending, and the put still fails on a shell that hangs or answers wrongly, so a misbehaving shell is not hidden; only a shell that vanishes between the two calls now reads as absent.
  • A stranded link is re-pointed. The 2026-09-19 revision of this migration, and a symlink then shipped under config/, pointed every install's ~/.config/omarchy/plugins/omacom.elsewhen at /usr/share/omarchy/plugins/omacom.elsewhen; elsewhen 1.0.0-2 moved to shell/plugins, so the link dangles, the shell lists the plugin as enabled but never loads it, and the bar shows an empty slot. A link into /usr/share/omarchy that no longer resolves is Omarchy's own and is re-pointed; a user's link is still left alone, resolving or not. Closes Elsewhen migration bug #12703.

Related and not changed here: #12777 and @sanjyay's #12797 cover the same migration when the shell is merely busy, where omarchy-bar put gives up on a 2s timeout it should retry, so #12797 is the companion half of this fix; #12531 and @paulogeyer's #12532 cover installs with no omarchy package, where omarchy-pkg-add itself fails; #11115 is the same bare-rescan pattern in the plugin commands, fixed by @Mario-Mohar's #11117, with #11118 giving those commands an IPC budget. Each is a different line of this migration or a different failure of the same call. All four merge cleanly on top of this branch in any order, and the combined tree passes their tests and these.

The diagnosis here stands on work in those threads. @avenkidur found the stranded link and its repair in #12703. @pedrohcmeneses traced in #12777 how one shell call under set -e takes the whole update down and listed everything skipped after omarchy-migrate. @TMartinPPC showed in #12531 that a failed migration re-fails every later update because its marker is never written. @Mario-Mohar's #11117 is where the best-effort -q rescan comes from, and @lancefaul's note on #9304 caught the same unguarded rescan one call earlier in omarchy plugin add.

Reviewed by Codex at xhigh, read-only. It raised that a shell answering "not ready" to the quiet rescan and then dying inside the put's window would let the migration complete without placing the widget; that race is accepted, since the alternative is the update dying whenever the shell cannot be asked, and the put still fails on any live shell that misbehaves. It found nothing else against the migration change.

🤖 Generated by Fable 5.1 in Claude Code. Reviewed by Codex XHigh.

A bare `omarchy-shell shell rescanPlugins` exits 1 when no shell answers on the caller's tree, and omarchy-migrate runs migrations under `set -e`, so an update run from a TTY or over ssh, or one whose shell had gone down while the package replaced its QML, died at "omarchy-shell is not running" before its post-update hooks, shell restart and reboot prompt, and re-failed the same way every time until a shell could be asked. The rescan is now best-effort, like `omarchy-bar put` already is and like #11117 makes the plugin commands' closing rescan: the update restarts the shell once the migrations are through, and a session without one has no bar to place on. An unknown widget on a live shell still leaves the migration pending.
The 2026-09-19 revision of this migration, and a symlink then shipped under config/, pointed every install's ~/.config/omarchy/plugins/omacom.elsewhen at /usr/share/omarchy/plugins/omacom.elsewhen. elsewhen 1.0.0-2 moved to shell/plugins, so the link dangles, the shell lists the plugin as enabled but never loads it, and the bar carries an empty slot. The migration kept any existing link, resolving or not, so a rerun could not repair it. A link into /usr/share/omarchy that no longer resolves is Omarchy's own and is re-pointed; a link the user made is still left alone.
@spencerbull
spencerbull force-pushed the elsewhen-migration-absent-shell branch from 8b13393 to aa5c4be Compare September 22, 2026 00:34
@spencerbull

Copy link
Copy Markdown
Contributor Author

Reviewed and tested end to end on a disposable Omarchy worker through omabot: the branch ran only on a throwaway VM built from the ISO, and the VM was destroyed afterwards. Every log and screenshot below is in this gist, with the raw ssh transcripts beside the pictures.

Base quattro at b8c382da
Head reviewed aa5c4beb
Worker Omarchy 4.0.4-1 from the ISO, 4 cores, 4 GB, one 1280×800 output, Hyprland with omarchy-shell on quickshell 0.3.1
How commands ran over ssh in a login shell, which is the case this PR is about: an update with no shell to ask
Second opinion Codex at xhigh reasoning, read-only, on the same head (its report)

Flow 1: the bug, on the base branch

The shell was stopped the way omarchy-restart-shell stops it, then omarchy update -y was run over ssh on quattro at b8c382da (log):

Running migration (1789581661)
Install Elsewhen, the world clock plugin
...
(1/1) installing elsewhen
omarchy-shell is not running

Something went wrong during the update!

Exit 1, marker 1789581661.sh not written, package installed and link in place, and nothing after omarchy-migrate ran, so the shell was never restarted. Before and after:

no shell before the update
still no shell after the failed update

Flow 2: the fix, on this branch

The worker was dev-linked to this branch at aa5c4beb and rebooted; at login the shell reported the two pending migrations (this one, and the OWE one behind it).

booted on the PR checkout, two migrations pending

With the shell stopped again, omarchy update -y over ssh (log):

Running migration (1789581661)
Install Elsewhen, the world clock plugin
omarchy-shell is not running; omacom.elsewhen was not put on the bar
...
Restarting shell
All plugins have been reloaded

Exit 0, both markers written, omarchy-migrate --pending reports nothing, and the update restarted the shell. The bar layout is unchanged, since the put was skipped:

shell restarted by the update; the bar is back without Elsewhen

With the shell up, the command the docs now name places the widget (omacom.elsewhen is on the bar):

Elsewhen placed before the clock

Flow 3: the stranded link from #12703

With ~/.config/omarchy/plugins/omacom.elsewhen pointed at /usr/share/omarchy/plugins/omacom.elsewhen and the shell restarted, omarchy-plugin-catalog and omarchy-shell shell listPlugins no longer list the plugin while shell.json still names it, and the bar draws nothing where the widget was:

dangling link: no Elsewhen between the indicators and the clock

With the marker removed, omarchy-migrate re-points the link to /usr/share/omarchy/shell/plugins/omacom.elsewhen, the catalog lists the plugin again, and the widget is back after a shell restart (log):

repaired link: Elsewhen is back before the clock

Also checked there: with the marker present, omarchy-migrate exits 0 and leaves the link dangling; a link the user made (/home/omarchy/my-elsewhen, dangling) is left alone; and the migration run with OMARCHY_PATH=/usr/share/omarchy re-points the link the same way and skips the put in under four seconds.

Automated tests, on the worker

Suite Result
test/shell.d/elsewhen-default-migration-test.sh 11 ok
test/shell.d/bar-test.sh 88 ok
test/shell.d/migrate-wrapper-test.sh, migrate-scope-test.sh, update-sequence-test.sh 5, 6, 3 ok
test/shell.d/config-test.sh 30 ok
./test/cli exit 0

Each fix was broken on purpose to check the test is not vacuous: putting the bare omarchy-shell shell rescanPlugins back fails install, scan and placement run in order, and deleting the re-point block fails a stranded link to the package's old path is re-pointed.

Findings

  1. The re-point reaches fewer installs than "Closes Elsewhen migration bug #12703" implies. It lives in migration 1789581661, and omarchy-migrate never re-runs a migration whose marker exists. The marker exists for everyone whose 09-19 run completed and for every fresh install, since omarchy-provision-user marks all shipped migrations done, and those are exactly the installs with the dangling link. What it does reach is anyone whose migration is still pending, which after this PR is the population the -q change unblocks. Reaching the rest takes a migration with a new timestamp carrying the same re-point.
  2. The re-point pattern is wider than the historical target. == /usr/share/omarchy/* is a glob, so any dangling link into that tree is rewritten. The only link Omarchy ever wrote there is /usr/share/omarchy/plugins/omacom.elsewhen; matching that exact string is safer. Low.
  3. One sentence of docs/omarchy-shell.md is now wrong. Existing plugin directories and symlinks are left intact stays in the paragraph this PR edits, while the migration now re-points some symlinks. Low.

Codex at xhigh raised the same three and found nothing else. The first was a line of attack named in its prompt, so its agreement there is not independent; the population table and the omarchy-provision-user reference are its own. It also traced every failure the quiet rescan can swallow and confirmed omarchy-bar put still leaves the migration pending for each of them except an absent shell.

Unrelated to this PR, seen on the way: omarchy update -y over plain ssh stops at the orphan-package prompt, because the script wrapper gives gum confirm a terminal; a real TTY would not.

🤖 Generated by Fable 5.1 in Claude Code. Reviewed by Codex XHigh.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elsewhen migration bug

2 participants