Skip to content

Preserve active themes when staging or publication fails - #12913

Open
yamz8 wants to merge 2 commits into
omacom:quattrofrom
yamz8:codex/preserve-themes-on-render-failure
Open

yamz8 wants to merge 2 commits into
omacom:quattrofrom
yamz8:codex/preserve-themes-on-render-failure

Conversation

@yamz8

@yamz8 yamz8 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What changes

When copying, converting or rendering a theme fails, omarchy-theme-set ignores the failure, deletes the working theme, publishes the incomplete one and exits 0. Foot then loses foot.ini and falls back to its default palette.

This stops on those failures before the current theme is touched:

  • Copying the built-in theme, the packaged intros and loops, or the user's theme, and converting a legacy alacritty.toml palette, now refuse activation when they fail. A missing overlay is still fine; an unreadable one no longer counts as empty.
  • omarchy-theme-set-templates runs under set -e and reports its own read and write failures. The cases it skips on purpose (every output already supplied, no templates, no shell.toml for an override, empty gradients) still succeed. Decimal rgb() components with a leading zero are read as base 10, which set -e would otherwise turn into a refused switch.
  • A switch that had already put up an intro cover cancels it by token without applying a palette, before removing its snapshot. The cover's own fallback no longer applies empty palette payloads before the theme is published.

The theme is still replaced the way it is today, so this does not cover a failure while the new theme is being moved into place.

Related: #11223 decides what to do with a theme that has no palette; this handles failed commands. #19445, #19446, #19467 and #19494 edit the same two colour lookups in the renderer; a sparse theme activates the same way here as on quattro.

Verification

  • With omarchy-theme-set-templates stubbed to exit 42, switching from Tokyo Night to Catppuccin Latte on quattro exits 0, publishes catppuccin-latte and leaves 7 of the 30 theme files, without foot.ini. On this branch it exits 1 with could not render the theme and leaves the name and all 30 files unchanged. A retry without the stub publishes Catppuccin Latte. This ran headless in a temporary home with the real built-in themes.
  • theme-staging-test.sh covers failed renders, copies (built-in, packaged, user, nested installed), palette and legacy palette conversion, unreadable sources, the renderer's intended no-op cases, snapshot cleanup, and an intro cover cancelled by token followed by a successful retry. With bin/omarchy-theme-set reverted to quattro, it fails on its first case.
  • theme-staging-test.sh, theme-templates-test.sh, background-intro-lifecycle-test.sh, theme-intro-switch-test.sh, bin-style-test.sh and ./test/cli pass.
  • Not checked on this exact head: a failing switch on a live desktop with an intro. Earlier heads of this PR were checked that way on a VM, and the intro path is unchanged since.

Screenshots

A Foot terminal opened after a failed render, captured at an earlier head of this PR; the trimmed change preserves the same files.

Before: foot.ini is gone and Foot uses its default palette.

Before: failed rendering removes foot.ini and Foot uses its default palette

After: foot.ini is kept and Foot stays on Tokyo Night.

After: failed rendering preserves foot.ini and Tokyo Night

🤖 Generated with Claude Code

@yamz8
yamz8 marked this pull request as ready for review September 22, 2026 16:56
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Verified: No actionable defect found in the reviewed scope at 12cdaf4b. An injected renderer failure now returns an error and preserves the previous active theme files and name.

Headless checks using a synthetic theme and the actual activation entry points:

Case Merge-base PR head
Renderer exits 42 Returns 0; replaces the previous theme with incomplete staging Returns 1; preserves previous files and name
Successful production rendering Not checked in this comparison Returns 0; publishes the generated configuration and new name

Source inspection also supports the publication rollback and retained recovery-directory design. The separate directory/name operations remain command-failure recovery, not a power-loss or SIGKILL transaction.


Review information

Test scope: Targeted headless checks with a stubbed failing renderer and a real-render success control. Desktop hooks, live terminals, and rollback-failure execution are outside these validated checks.

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

Automated AI review: Astra Medium initial inspection and evidence-based synthesis, with independent technical assessments by Opus 5.5 High and GPT 6 Sol Xhigh, followed by a fresh Astra Medium editorial check.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 12cdaf4b. The bug is real and this fixes it, but the branch no longer merges into quattro, so it needs a rebase before it can go further.

What was checked, on a disposable Omarchy VM: a headless activation of Catppuccin Latte from Tokyo Night with omarchy-theme-set-templates stubbed to exit 42. On current quattro (821ae589) it exits 0, publishes catppuccin-latte and deletes the previous theme's foot.ini. On this head it exits 1 with "could not render the theme" and leaves the old files and name in place. With this PR's two bin/ files reverted, the failure comes back. ./test/cli, theme-activation-failure-test.sh (22 passed) and theme-staging-test.sh (8 passed) pass on the head, and all 22 built-in themes activate on it with nothing left behind.

Second opinion: none. The configured reviewer, Codex Medium, did not run because its daily review budget was spent. This review is one model's reading (Claude Opus 5.5), plus the worker results above.

The conflict. Two changes landed on quattro since this branch was cut, and both touch what this PR changes:

  • Start the theme transition ~600ms sooner #13406 rewrote bin/omarchy-theme-set-templates to render every template in a single awk pass. If the rebase keeps set -e -o pipefail and inherit_errexit, the bare || return lines in the new renderer would make activation fail when there is nothing wrong. They need the same return 0 treatment this PR already gives the old code: add_mix_value (lines 187-188), add_function_values (225), render_templates (334, which returns 1 whenever the theme already ships every file a template would produce) and apply_shell_section_override (259-265).
  • Decode theme backgrounds earlier, and at screen size #13408 moved the background choice ahead of rendering. By the time omarchy-theme-set-templates runs at line 390, quattro has already made the snapshot files in ~/.cache/omarchy/background-transitions (lines 373 and 379) and sent background prepare to the shell (381). A failure exit at that point has to remove those snapshots too, or every failed activation leaves them behind.

Scope. The bug is that a failed copy or render was ignored and the old theme deleted anyway. The smallest fix is to stop on those failures before rm -rf "$CURRENT_THEME_PATH" and to make the renderer report its own failures. This PR also adds rollback when writing theme.name fails, retained .theme-swap.* recovery directories and signal handling around the swap. That guards against much rarer failures (a write to a file in the user's own state directory failing) and adds most of the code that the rebase now has to carry through. It would be easier to review and land as the core fix first, with the publication rollback as its own follow-up if the maintainer wants it. That choice is the maintainer's, not a defect.

Related: #11223 (refusing a theme with no palette) touches the same script and complements this rather than competing with it. No other open pull request fixes this bug.

Waiting on the author to rebase onto quattro. Once that lands, this gets tested again at the new head.

@yamz8
yamz8 force-pushed the codex/preserve-themes-on-render-failure branch from 12cdaf4 to d904707 Compare October 4, 2026 23:58
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking delay in removing failed-switch covers on older shells.

Findings

  1. P2 Failed switch leaves wallpaper frozen ▶

Summary

This PR stops failed copies, palette conversions, and template renders before they replace the active theme.

  • Theme activation stops when a required staging step fails.
  • Intro covers wait for a published theme before applying its colors.
  • Theme rendering now stops when required reads or writes fail.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Copy theme files] --> B[Convert palette]
  B --> C[Prepare background cover]
  C --> D[Render templates]
  D -->|Success| E[Replace active theme]
  D -->|Failure| F[Discard staging and cancel cover]
  F --> G[Keep active theme]
Loading

Reviews (13) · Last reviewed commit: "Keep intro covers working with a running..." · Reviewed by Greptile

Comment thread bin/omarchy-theme-set Resolved
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 7, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed after the rebase, at 8245bb32. The bug is real, this fixes it, and both points from the last review are handled: the renderer's optional helpers now return 0 under set -e, and a failed activation removes the background snapshots it made. I pushed one fix to your branch, described below.

What was checked, on a disposable Omarchy VM:

  • Reproduction. I activated Catppuccin Latte from Tokyo Night with omarchy-theme-set-templates stubbed to exit 42. On current quattro (d9b970dd) that exits 0, publishes the new name and deletes the old foot.ini. On this head it exits 1 and leaves the old files and name in place. With this PR's two bin/ files reverted, the bug comes back.
  • The live desktop. On the VM's desktop, the same failure after background prepare exits 1, keeps the theme and leaves nothing in ~/.cache/omarchy/background-transitions. Without the fix it leaves two snapshots there. A retry then activates normally.
  • Output unchanged. All 22 built-in themes activate on the head and render byte-identical files to quattro, with no .theme-swap.* left behind.
  • Tests. ./test/cli passes. These shell tests pass through the worker's session: theme-activation-failure-test.sh (39), background-test.sh (13), theme-staging-test.sh (8), video-background-test.sh (34) and bin-style-test.sh (2).

Pushed: 8245bb32 Read decimal rgb() components as base 10. Codex Medium found this one. color_to_shell_hex passes a decimal rgb() component with a leading zero straight to printf, which reads 08 as octal and fails. Before, that only produced the wrong colour (rgb(08,16,24) became #001018). With the renderer now under set -e, it refuses activation instead. Only a gradient_start token in a user template reaches this code, so it is rare, but such a theme would stop applying. The components are now read as base 10, the colour renders #081018, and a case in your test file covers it. I reproduced the failure on the VM before the fix and saw it pass after.

Second opinion: Codex Medium reviewed two rounds on this head. Beyond the finding above, it agreed that cleanup is correct on every path, including rollback and signals, and that the test file cannot pass vacuously. It had read my brief, so that agreement is not a fully independent check. In its second round it raised an overflow for components of 19 digits or more. I did not act on it: quattro renders those the same way, they never stop activation, and no real theme writes them. This review is Claude Opus 5.5 and Codex Medium.

Scope. The rebase keeps the publication rollback, the retained .theme-swap.* recovery directories and the signal handling. As before, they guard against much rarer failures than the bug itself, which needs only the staging and render checks before the swap. That is a choice for the maintainer, not a defect.

No other open pull request fixes this bug.

This is now waiting on the maintainer.

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

Copy link
Copy Markdown
Collaborator

Checked again at 8245bb32 after quattro moved to 902fd8ae. The fix itself is unchanged and still correct, but #9639 (theme-switch background intros) landed since and the branch no longer merges. Resolving it takes more than the text conflict, so this is back with you. You wrote #9639 too, so you are best placed to decide how its handoff should unwind.

The text conflict is one hunk in bin/omarchy-theme-set, at the render step. The resolution keeps all three parts in this order: the guarded omarchy-theme-set-templates || fail ..., then quattro's themeIntroCoverStatus wait, then this PR's trap '' HUP INT TERM / publish_staged_theme / cleanup. Your rename-based publish keeps the staged directory's inode, so the %d:%i intro tokens quattro takes on NEXT_THEME_PATH before publishing still match CURRENT_THEME_PATH afterwards.

The failure path needs one more step. On quattro, a switch to a theme with an intro calls prepareThemeIntro "$OLD_BACKGROUND_SNAPSHOT" <token> "" "" before rendering (bin/omarchy-theme-set:436). With this PR, a render or publish failure after that point exits through cleanup_theme_staging, which deletes the snapshot but leaves the shell's prepared intro in place. In shell/services/BackgroundIntro.qml, themeFallback (line 164) then calls revealTheme() (78) after ten seconds, and that applies the two empty payloads. Color.loadShell("") clears the current theme's shell overrides, so the bar can change appearance even though the activation failed and the theme did not change. loadColors("") also resets muted. Until then, the old wallpaper sits under a still of itself, so a video background looks frozen. If the snapshot was deleted before it decoded, the cover fails to load.

No existing IPC cancels a prepared intro without applying a palette. finishThemeIntro reveals the cover, which applies the payloads, and applyTheme calls cancelTheme() and then applies a palette. A token-checked IPC that calls cancelTheme() (BackgroundIntro.qml:119) would do it, with the failure cleanup calling it before deleting the snapshot. The token has to be saved when it is prepared, since THEME_INTRO_TOKEN is only set later on the success path. A case for this in theme-activation-failure-test.sh would cover it.

What was checked: a trial merge of this head into quattro 902fd8ae, and the intro code paths above, read in source. Nothing was run on a worker this time, because there is no merged tree to test yet. The earlier reproduction and suite results at this head were against d9b970dd and no longer say anything about quattro.

Second opinion: Codex Medium reviewed the same merge independently of the steps above. It found the same single conflict and resolution, and it confirmed that the inode tokens survive the publish. It agreed on the failure-path gap and contributed the muted reset and the snapshot-deletion detail. It had my questions in its brief, so its agreement is not a fully independent check. This review is Claude Opus 5.5 and Codex Medium.

The scope point from the last review still stands for the maintainer: the publication rollback and recovery directories go beyond the bug.

Waiting on the author to merge quattro and cancel the prepared intro on failure.

Comment thread bin/omarchy-theme-set Resolved
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 7, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at d949bf97, after your merge of quattro (902fd8ae) and the two commits since. The merge is resolved the way the last review described, a failed activation now cancels its prepared intro cover by token without applying a palette, and the cover fallback no longer applies empty payloads before the theme is published. The bug is still fixed on current quattro, and this is labelled verified.

What was checked, on a disposable Omarchy VM running this branch's shell:

  • Reproduction. A headless switch from Tokyo Night to Catppuccin Latte with omarchy-theme-set-templates stubbed to exit 42. On quattro 902fd8ae it exits 0, publishes catppuccin-latte and deletes the old foot.ini. On this head it exits 1 and leaves the name and foot.ini unchanged, with no .theme-swap.* or next-theme left behind. With this PR's two bin/ files reverted, the bug comes back.
  • The intro path on the live desktop, switching to Catppuccin (which has an intro) with the renderer failing. Failing at once: the shell receives prepareThemeIntroCover then cancelThemeIntro for the same token, the theme stays Tokyo Night and no snapshot is left in ~/.cache/omarchy/background-transitions. Failing after 13 seconds: the cover is up at 1.5s, the shell's 10-second fallback releases it while rendering is still running, the script's own cancel follows at 13s, and the theme and cache are again unchanged. That the fallback applies no palette rests on the QML fixture below, not on what was seen on screen.
  • Tests. ./test/cli passes. These pass through the worker's session: theme-activation-failure-test.sh (45), background-intro-lifecycle-test.sh (27, including the fixture under a real quickshell), background-test.sh (13), video-background-test.sh (34), theme-intro-switch-test.sh (9), theme-staging-test.sh (8), theme-background-memory-test.sh (12), theme-install-guards-test.sh (12), theme-templates-test.sh (4), background-startup-test.sh (2), user-theme-test.sh (1) and bin-style-test.sh (2).

Second opinion: Codex Medium reviewed this head. It agreed that the merge resolution is correct, that the staged directory's inode token survives both the first-activation rename and the exchange, that the success path still delivers the palette after the cover has timed out, and that the new assertions would fail without the change. It had my questions in its brief, so that agreement is not a fully independent check. It raised one point: cleanup_theme_staging deletes the cover's snapshot even when cancelThemeIntro times out (bin/omarchy-theme-set:87-89). That needs the shell to be unresponsive for more than two seconds during a failed activation, and even then the fallback now releases the cover without a palette within ten seconds. I have not changed it, but you may want to keep the snapshot when the cancel is not acknowledged. This review is Claude Opus 5.5 and Codex Medium.

Scope, for the maintainer: the publication rollback, retained .theme-swap.* recovery directories and signal handling still go beyond the bug, which needs only the staging and render checks before the swap plus the intro cancel those checks now make necessary. Codex Medium judged the size defensible; whether to take it whole or split is the maintainer's call, not a defect.

No other open pull request fixes this bug. This is now waiting on the maintainer.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review and removed verified Omarchy Triage has verified that this issue is ready for final review labels Oct 13, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed after quattro moved to 85ffa807 and this branch stopped merging. I merged quattro in and fixed two tests that the merge broke without a textual conflict. The bug is still fixed on current quattro, and this is labelled verified again.

Pushed:

  • 07be7da0 Merge quattro. The only textual conflict was in bin/omarchy-theme-set, against Retint terminals first and finish other apps behind a theme switch #15189. The resolution keeps your staging helpers beside quattro's FAILED_THEME_COMMANDS and direct run_parallel. At the swap it runs your guarded publish_staged_theme and cleanup first, then writes quattro's new theme generation token, so a failed or rolled-back activation leaves the previous token in place for theme_still_current. With quattro's omarchy-theme-set-glass now ending omarchy-theme-set-templates, a failed glass write into the staged theme fails the render and so refuses activation, which is consistent with the renderer now running under set -e.
  • 631c6337 Give the intro lifecycle test the qualified Color quattro now calls. quattro changed BackgroundIntro.qml's palette loads to Commons.Color (Fix shell palette collision with Qt 6.12 #14553). The test's node sandbox defined only a bare Color, so it threw a ReferenceError on the first reveal and stopped after 22 of its 27 checks.
  • 4e8a8264 Stub the theme retints directly in the activation failure test. The fixture kept the successful desktop retries inside the test by intercepting bash -lc. Since Retint terminals first and finish other apps behind a theme switch #15189, quattro runs each retint as a command, so those retries ran the real omarchy-restart-terminal, omarchy-theme-set-foot, omarchy-theme-set-gnome and the rest against whatever desktop ran the test. On the VM, with markers added to three of them, the old fixture ran all three and this one runs none. The test now reads the stub list from the script's two retint arrays, so a retint added there is stubbed too.

What was checked, on a disposable Omarchy VM running this branch's shell:

  • Reproduction. A headless switch from Tokyo Night to Catppuccin Latte with omarchy-theme-set-templates stubbed to exit 42. On quattro 85ffa807 it exits 0, publishes catppuccin-latte and replaces foot.ini. On this head it exits 1 with "could not render the theme", and the name and foot.ini are unchanged, with no .theme-swap.*, next-theme or staged name left behind. With this PR's two bin/ files reverted, the bug comes back.
  • Output unchanged. All 23 built-in themes activate on the head and render the same files as quattro, with glassy windows both on and off. The only difference is the checkout path in Ghostty's gtk-custom-css.
  • Tests. ./test/cli passes, and so do 31 theme and background shell tests through the VM's session (301 checks), including theme-activation-failure-test.sh (45), background-intro-lifecycle-test.sh (27), theme-set-retint-order-test.sh (11) and hyprland-window-transparency-test.sh (17). background-instant-reload-test.sh failed twice in early runs on this head, and also failed on quattro while the VM's display was disturbed. Every file it loads is identical on both, and after a reboot it passed 12 of 12 runs on each.

Second opinion: Codex Medium reviewed three rounds. It found the retint stub gap in theme-activation-failure-test.sh, and in its second round that the first version of the stub pattern missed omarchy-theme-set-t3code. Both are fixed above. It agreed that the merge resolution and the generation-token placement are correct, and that a failing glass step should refuse activation. Its last round on this head found nothing open. That agreement came from a brief that included my reasoning, so it is not a fully independent check. This review is Claude Opus 5.5 and Codex Medium.

Scope, for the maintainer, unchanged: the publication rollback, retained .theme-swap.* recovery directories and signal handling go beyond the bug, which needs only the staging and render checks before the swap plus the intro cancel those checks make necessary. Whether to take it whole or split it is the maintainer's call, not a defect.

No other open pull request fixes this bug. This is waiting on the maintainer.

@yamz8

yamz8 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Merged quattro in. The only conflict was background-test.sh, which #16334 deleted along with the other source-reading tests, so this branch's one-line adjustment to it goes too. theme-activation-failure, background-intro-lifecycle, every theme-* suite and ./test/cli pass. In a running desktop at the merge, an ordinary switch to Catppuccin and back works. A switch with omarchy-theme-set-templates stubbed to exit 42 exits 1 with "could not render the theme" and leaves the active theme's name and files unchanged.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at c4099ba9, after your two merges of quattro and the move of the failure cases into theme-staging-test.sh. The bug is still fixed, the adaptation to quattro's new intro handoff holds, and nothing new was found. I pushed nothing. This stays labelled verified.

What was checked, on a disposable Omarchy VM. Everything below ran on this head merged with current quattro (175e63b6, 143 commits past your last merge; the only one touching these files is #17113, which merges cleanly):

  • Reproduction. A headless switch from Tokyo Night to Catppuccin Latte with omarchy-theme-set-templates stubbed to exit 42. On quattro it exits 0, publishes catppuccin-latte and replaces foot.ini. On this head, and on this head merged with quattro, it exits 1 with "could not render the theme", and the name and foot.ini are unchanged, with no .theme-swap.*, next-theme or staged name left behind. With this PR's two bin/ files reverted, the bug comes back.
  • The intro path on the live desktop, with the VM's shell running the merged tree. A failing switch to Catppuccin sends prepareThemeIntroCover and then cancelThemeIntro with the same token. The theme, the background link and ~/.cache/omarchy/background-transitions stay as they were. A normal switch to Catppuccin afterwards completes, and the shell reports the intro settled.
  • The handoff. I traced every caller of prepareTheme, revealTheme and finishTheme. The themePaletteReady guard (shell/services/BackgroundIntro.qml:114) cannot cancel a published switch, because set_theme_background calls prepareThemeIntro with the real payloads (bin/omarchy-theme-set:317) before playThemeIntro. It cannot cancel a background-only change either, because BackgroundSwitch.cover calls prepareTheme directly.
  • Output unchanged. All 23 built-in themes activate and render the same files as quattro, with glassy windows on and off. The only difference is the checkout path in Ghostty's gtk-custom-css.
  • Tests. ./test/cli passes, and so do all 27 theme, background and intro shell test files plus bin-style-test.sh, run through the VM's session. That includes theme-staging-test.sh (53 checks) and background-intro-lifecycle-test.sh (29). At the unmerged head, ./test/cli, theme-staging-test.sh, background-intro-lifecycle-test.sh and theme-set-retint-order-test.sh pass too.

Second opinion: Codex Medium and muse-wonder (pi, thinking high) each reviewed this head and found nothing open. Both traced the cover and cancel paths and reached the same result as above. muse-wonder also confirmed that the cancel cannot reach a newer activation's cover while the theme lock is held, and that the moved tests keep their coverage. This review is Claude Opus 5.5 with those two, and their brief named the paths to check, so their agreement is not a fully independent check.

Scope, for the maintainer, unchanged from the last review. The publication rollback, the retained .theme-swap.* recovery directories and the signal handling go beyond the reported bug. The bug needs only the staging and render checks before the swap, plus the intro cancel those checks make necessary. Whether to take it whole or split it is the maintainer's call, not a defect.

No other open pull request fixes this bug. This is waiting on the maintainer.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review and removed verified Omarchy Triage has verified that this issue is ready for final review labels Nov 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Merged current quattro into this branch to resolve the packaged-intro staging conflict. f4e6cbf8 keeps the packaged intros and refuses activation if copying them fails; it also adapts the interrupted-intro test to the cover-only IPC call. 71755541 keeps icon rendering independent of regular app-template directories, so an unreadable template directory cannot silently remove the drawn app icons.

On a disposable Omarchy VM running the merged shell, ./test/cli passed all 136 checks, and all 19 focused theme, background, video and command-style test files passed (207 checks). A renderer forced to exit 42 still replaces the active theme and returns success on quattro b972bd8c; this head returns an error and preserves every active theme file and its name. Reverting the two script changes brings the bug back. The new packaged-copy test also fails when its guard is removed. The icon regression case passes on the final head and fails with only that renderer fix reverted. All 23 built-in themes also activate and render the same files as quattro, with glassy windows on and off (apart from the checkout path). On the live desktop, a failed switch prepares and cancels the same intro token, preserves the theme/name/background, and a normal retry succeeds.

The cropped Foot captures use the generated theme include after that failure: the base loses foot.ini and falls back to Foot's default palette; this head retains Tokyo Night. The reverted capture matches the base exactly. These show terminal configuration preservation, not a full desktop acceptance run.

Before: failed rendering removes foot.ini and Foot uses its default palette

After: failed rendering preserves foot.ini and Tokyo Night

GPT-6 in Codex (effort setting not exposed) ran these checks. Opus 5.5 High and muse-wonder via pi, thinking high reviewed two rounds; their last round at 71755541 found no remaining actionable defect. muse-wonder identified the icon regression above, which I reproduced and fixed. Their agreement on the remaining code is not guaranteed to be independent.

The scope decision remains with the maintainer: the staging/render checks and intro cancellation address the failure before publication; publication rollback, retained recovery directories and signal handling add more state to maintain. Splitting that recovery behavior would keep the immediate fix smaller. The verified label is restored. ready was refused because the complete change was not judged proportionate; this waits on the maintainer’s scope decision.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 19, 2026
A failed copy, palette conversion or template render used to be ignored,
so activation deleted the working theme, published the incomplete one and
reported success. Stop on those failures before the swap, make the
renderer report its own errors, and cancel a prepared intro cover by
token without applying a palette.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yamz8
yamz8 force-pushed the codex/preserve-themes-on-render-failure branch from 7175554 to 225159a Compare November 19, 2026 18:09
@yamz8

yamz8 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Cut this down to the fix itself, as the earlier reviews suggested, and rebuilt it on current quattro as one commit.

Kept: the checks before the theme is replaced, the renderer reporting its own failures, and cancelling a prepared intro cover. Dropped: the rollback when writing theme.name fails, the retained .theme-swap.* recovery directories, signal handling and the lock checks. Those guarded against much rarer failures and made up most of what had to be carried through every merge. The full version is on theme-render-failure-full if a follow-up is wanted.

Review comments above that mention rollback or .theme-swap.* refer to code that is no longer here.

@omarchybot

Copy link
Copy Markdown
Collaborator

Checked the rebuilt branch at 225159a2: it removes the publication rollback, retained recovery directories and signal handling discussed in the previous review. The earlier verification applies to a different head.

GPT-6 in Codex (effort setting not exposed) read the updated change and classified it as a bug fix. The configured second classifier, deepseek-v4p1-flash, returned no valid classification, so the required classification step remains incomplete. The main review panel answered its availability check, but no technical second review, reproduction or test suite was run for this head in this session. Nothing was pushed and no verification labels were added.

This is waiting on the maintainer to resolve the classification blocker so verification of the trimmed head can continue.

A shell an update could not restart does not understand prepareThemeIntroCover. Fall back to its existing prepareThemeIntro call with empty palette payloads so the outgoing cover is still presented before activation replaces its still. Extend the existing older-shell case to reject the new IPC and require the preparation before publication.

Co-Authored-By: GPT-6 (effort setting not exposed) <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 22, 2026
Comment thread bin/omarchy-theme-set
Comment on lines +520 to +521
shell_ipc shell prepareThemeIntroCover "$OLD_BACKGROUND_SNAPSHOT" "$PREPARED_INTRO_TOKEN" ||
shell_ipc shell prepareThemeIntro "$OLD_BACKGROUND_SNAPSHOT" "$PREPARED_INTRO_TOKEN" "" "" || true

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.

P2 Failed switch leaves wallpaper frozen

If an update leaves the older shell running, this fallback prepares a cover through prepareThemeIntro, but that shell has no cancelThemeIntro. If rendering fails, cleanup ignores the failed cancellation and deletes the snapshot while the cover still uses it. The wallpaper can stay frozen until the shell’s ten-second fallback runs.

Keep the legacy path cancellable without applying a palette, or skip early cover preparation when cancellation is unavailable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the older-shell compatibility limit at e0ae4595, which Opus 5.5 High and muse-wonder via pi, thinking high both considered in their final review; GPT-6 in Codex (effort setting not exposed) checked it on a worker running the previous shell. The old shell has no token cancellation call. Its existing ten-second fallback releases the cover, and its themeColors || themeShell guard keeps the empty preparation payload from changing the palette. The failed render still preserves the active theme and its name.

Skipping preparation would restore the regression this fallback fixes: a successful switch could replace the still under a playing OWE intro before any cover is presented. Adding token cancellation to the new code cannot update a shell that is still running old code. I have kept the existing cover path and left the bounded freeze versus skipping that cover as a decision for the maintainer. The updated shell cancels immediately by token. No further code was changed for this finding.

@omarchybot

Copy link
Copy Markdown
Collaborator

Rechecked the trimmed fix at e0ae4595. An injected renderer failure on quattro (0bcf203d) returns success, changes the theme name and removes foot.ini. This head returns an error and preserves every active theme file and the name; reverting its two script changes brings the failure back. I pushed e0ae4595: if a running shell predates the new cover-only IPC, activation now falls back to its existing preparation call. Without that fallback the outgoing cover was skipped; the existing older-shell test fails without the fix, and a VM running the actual previous shell presents the cover with it.

On a disposable Omarchy VM serving this branch's shell, ./test/cli passed all 136 checks and 20 focused shell test files passed 182 checks, including the live QML lifecycle fixture. All 23 built-in themes activate with glassy windows on and off and render the same files as quattro, apart from the checkout path. Immediate and thirteen-second renderer failures preserve the live theme/name/background; the matching intro cover is cancelled or released by its ten-second fallback, and a normal retry succeeds.

The cropped Foot captures use a minimal config that loads the generated theme include when it exists. The base capture shows the default palette after that file is lost; the head retains Tokyo Night. The capture with the two scripts reverted matches the base exactly. With the stock Foot config, the missing include instead prevents a new terminal from starting: its config check exits 230 on the base and reverted scripts, and 0 on this head. These images compare palettes, not a full desktop acceptance run.

Before: comparison window uses default colors because generated foot.ini is missing

After: failed rendering preserves foot.ini and Tokyo Night

GPT-6 in Codex (effort setting not exposed) ran these checks. Opus 5.5 High and muse-wonder via pi, thinking high reviewed two rounds; both found nothing actionable on the final head. Opus identified the older-shell regression fixed above. Their agreement on the remaining code is not guaranteed to be independent.

The fix is labelled verified. An older shell cannot cancel the prepared cover immediately on failure and relies on its existing ten-second fallback; I answered Greptile’s finding on that limit. This remains with the maintainer to decide whether the strict renderer error handling, intro state and test burden are proportionate. CI is green on this head.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants