Skip to content

Prevent persistent shell cache failures during upgrades - #16880

Open
cobrakoral wants to merge 4 commits into
omacom:quattrofrom
cobrakoral:fix/shell-qml-cache-coherence
Open

cobrakoral wants to merge 4 commits into
omacom:quattrofrom
cobrakoral:fix/shell-qml-cache-coherence

Conversation

@cobrakoral

@cobrakoral cobrakoral commented Oct 28, 2026 •

Copy link
Copy Markdown

Runtime QML caches can preserve stale plugin bytecode across shell restarts after source replacement. Disable runtime disk-cache reads and writes for the Quickshell process started by omarchy-launch-shell. Existing caches and settings are preserved; the policy is scoped to that shell process.

Reproduction and diagnosis

With Quickshell 0.3.2.r7.g2b4501a-1 and Qt 6.12.0, a controlled file replacement reproduces ShellIpc is not a type in two fresh processes despite a complete replacement tree. Root IPC responds while the representative plugin target is absent; a fresh-cache control succeeds.

Qt reads the source for compilation and reopens it for its checksum when saving the compiled unit. Replacement between those reads can associate old bytecode with the new source's checksum. The regression synchronizes that replacement with a test-only preload shim and verifies the saved checksum; it does not modify cache files.

Change and coverage

The launcher bypasses existing poisoned runtime caches and prevents new runtime cache writes. Shared launch helpers, direct app launches, and URL handlers remove the variable with Quickshell's per-child environment override. Notification URL validation remains intact.

The regression identifies the intended compiled unit by its source checksum among multiple real caches. Real detached children verify that command, argv, direct, and URL launches exclude the cache policy while retaining other environment values and literal arguments; the shell's protection remains active.

The regression fails on base 83f04009 at launcher recovery and passes with the correction. It exercises real Quickshell component instantiation and external plugin IPC, repeated recovery, replacement during loading, restart after repair, and preservation of existing caches and settings. Existing supervisor tests also pass.

bash test/shell.d/launch-shell-test.sh
bash test/shell.d/notifications-test.sh
bash test/shell.d/dropbox-test.sh
bash -n bin/omarchy-launch-shell test/shell.d/launch-shell-test.sh
shellcheck bin/omarchy-launch-shell
git diff --check

The aggregate CLI suite passes. The shell run reports three failures out of 404 files: update-lock and update-stay-awake-security also fail individually on the unchanged baseline; preinstalls passes individually on both trees, leaving its parallel-run cause unestablished. The final URL-routing extension was checked with focused tests after the aggregate run. Graphical tests were skipped without a usable compositor.

QML lint passes for the changed utilities, clipboard, Dropbox, Tailscale, and notification components. Network-panel lint did not complete; a bounded baseline comparison also timed out.

Scope and tradeoff

This is an Omarchy workaround for a demonstrated Qt cache-coherence race. The type-removal fixture does not establish the reporter's exact historical upgrade sequence. Full Dock/Elsewhen desktop validation and startup-performance measurements remain outstanding. Warm runtime compilation-cache benefits are lost; transient errors in a running engine during replacement and incompatible plugins remain outside this change.

#6751's main-watcher protection remains intact. #13006 coordinates third-party Git plugin updates. #16818 independently improves restart readiness. quickshell-mirror/quickshell#1049 changes VFS/import paths and disk-cache behavior; restoring disk caching requires a verified coherent source/checksum path.

Refs #16126.

Synchronize an atomic replacement between Qt's source and checksum reads. Verify that fresh processes accept stale bytecode, then exercise launcher recovery, repeated starts, cache-write prevention, and retained settings. This regression fails against the unchanged launcher.
Scope QML_DISABLE_DISK_CACHE to the supervised shell process so stale runtime units are ignored and replacements cannot poison new cache entries. Preserve existing caches and user settings. This is a workaround for Qt's separate compilation and checksum reads.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed and no new actionable issues were found.

Summary

The launcher disables runtime QML disk caching for Quickshell while preserving existing caches and settings.

  • The launcher keeps the shell from reading or writing runtime QML caches.
  • External apps started by the shell do not inherit its cache setting.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[omarchy-launch-shell] --> B[Quickshell: disk cache disabled]
  B --> C[Util.execApp]
  B --> D[Notification URL checks]
  D --> E[Util.openUrl]
  E --> C
  C --> F[External child: cache setting removed]
Loading

Reviews (2) · Last reviewed commit: "Keep the shell cache policy out of launc..." · Reviewed by Greptile

Comment thread bin/omarchy-launch-shell Resolved
Do not depend on directory enumeration order when inspecting compiled units. Retain the matching cache path for the preservation assertion.
Remove QML_DISABLE_DISK_CACHE with Quickshell's per-child environment override. Reuse that boundary for shared launch helpers, direct application launches, and URL handlers while preserving notification URL validation. Exercise real detached children, literal arguments, unrelated environment values, and the unchanged shell cache protection.
@cobrakoral

Copy link
Copy Markdown
Author

I reviewed this PR alongside #16818 to assess whether the two changes overlap, conflict, or should be integrated together.

My recommendation is to keep both PRs independent and merge this one first, followed by #16818.

The two changes address different failure modes within the same broader shell restart and upgrade problem:

#16880 addresses cache coherence. It prevents the launched Quickshell process from reading or writing runtime QML disk caches, avoiding the demonstrated case where stale compiled bytecode survives restarts despite the source tree being correct.

#16818 addresses startup observability and readiness. It distinguishes a responsive root IPC handler from successfully loaded first-party components, preventing restart success from being reported when required plugins have failed.

Neither change replaces the other. Disabling the disk cache does not guarantee that every plugin is valid or successfully instantiated, while improved readiness reporting does not prevent persistent cache corruption.

The current diffs do not modify overlapping files, and there is no direct code dependency between the implementations. Keeping them separate also makes their individual behavior, tradeoffs, and regression coverage easier to review.

I recommend merging #16880 first because it addresses the reproduced persistent failure and introduces the more significant runtime tradeoff: losing the benefits of warm QML disk caching. We can then evaluate #16818's readiness contract on top of that behavior.

Combined integration validation should remain focused on the actual interaction between these changes:

Verify that a previously poisoned cache cannot prevent successful component loading, IPC registration, and startupStatus=ready after a restart.

Confirm that repeated restarts neither consume nor recreate the affected runtime cache entries.

Verify that external applications launched through the shell do not inherit QML_DISABLE_DISK_CACHE, including command, argv, and URL launch paths.

Perform one real Hyprland session restart to verify that the startup readiness deadline remains sufficient without warm QML disk caching.

The existing isolated regression fixtures already cover much of this behavior. I do not think a full duplicate test suite or a combined PR is necessary.

Finally, I would retain the distinction between a demonstrated workaround and an upstream Qt fix. The controlled reproduction establishes a genuine cache-coherence failure, but it does not prove the reporter's exact historical upgrade sequence. Restoring runtime disk caching should require separate evidence that the underlying coherence issue has been resolved.

Conclusion: This PR and #16818 are complementary, independently reviewable improvements. I support merging #16880 first, followed by #16818 after focused combined integration validation.

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Nov 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 7be4899 by Claude Opus 5.5, with a second opinion from Codex Medium and muse-wonder (via pi, thinking high). The fix works. Most of the diff isn't needed for it, and whether to give up the disk cache is the maintainer's call.

What was run, on a disposable Omarchy VM with qt6-declarative 6.12.0 and quickshell 0.3.2.r7.g2b4501a, with the shell running from this branch:

  • Your qml-cache-replacement.py fixture passes. With only QML_DISABLE_DISK_CACHE=1 taken out of bin/omarchy-launch-shell, the same launcher fails launcher-recovery with ShellIpc is not a type against the poisoned cache. That one assignment is what does the work.
  • ./test/cli passes. ./test/shell has 7 failing files: agent-account-exec, ascii, branding-about-animation, first-run, i18n, lock-appear-budget and runtime-smoke. All 7 fail the same way on base 83f0400, so none comes from this change.
  • Startup cost on the real desktop, timed from restart until all 24 IPC targets answer: about 1.54s with the cache disabled vs 1.35s with it, from three or four samples each, which is noisy. Lazily loaded panels also recompile the first time they open after each restart.

Findings. Both reviewers raised these, and I checked each against the source:

  • The fixture asserts Qt's bug is still there. qml-cache-replacement.py:164-166 requires the baseline restarts to fail with ShellIpc is not a type, and lines 156-161 read the source hash from .qmlc bytes 28:44. A Qt release that fixes the race or changes the cache layout turns this test red while Omarchy still works. It also needs cc at test time. A smaller test that guards the actual change already has a home: the fake Quickshell in launch-shell-test.sh logs QS_DISABLE_FILE_WATCHER and QS_NO_RELOAD_POPUP from the launch environment. Adding QML_DISABLE_DISK_CACHE there takes a few lines and runs without Quickshell. The race reproducer would be valuable in an upstream Qt report.
  • Util.execApp strips the variable for the nine converted call sites, and environment: { QML_DISABLE_DISK_CACHE: null } does unset it. About 25 other Quickshell.execDetached calls and every Process {} still inherit it, for example the custom bar exec at Bar.qml:3169. None of the remaining paths starts a QML app, and a leak only makes a child skip its own cache, so the sweep protects little. Its comment (Util.qml:68-69) promises more than it delivers.
  • Util.openUrl replaces Qt.openUrlExternally with xdg-open for notification links and the Dropbox login. The URL gate in Security.js:44-48 is unchanged and still validates first. But this skips Qt's portal and activation-token path, so a portal's remembered handler choice or window focus can differ. openUrl also always returns true. This is a behaviour change separate from the cache fix.
  • Minor: a session that exports QML_FORCE_DISK_CACHE=1 overrides the launcher's setting, per Qt's docs.

Related. #16900 pauses plugin loads during package transactions. Once its hooks are installed, it also closes the window this race needs on later upgrades. It doesn't bypass caches already poisoned on users' machines, and this PR does. #16818 is about restart readiness and doesn't overlap. #16126 also covers the transient mid-upgrade failure, which this PR doesn't address, so I haven't marked it as closing that issue.

Nothing was pushed to your branch. This is labelled verified and waits on the maintainer: whether to give up the QML disk cache for the shell at all, and if so, whether to land the launcher change with a small test and move the fixture, the env-stripping sweep and the URL change out. Trimming it to that shape would make the decision easier.

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

Copy link
Copy Markdown
Collaborator

Rechecked unchanged head 7be489983038b1478b26a601b5365318e607aede against quattro at c6be7abb. The new conflict is in shell/plugins/panels/dropbox/Service.qml: the base now opens files with Folio, while this branch still names Nautilus. Any conflict resolution needs to preserve the current Folio launch.

Codex High reviewed the diff and merge result. Opus 5.5 High agreed, from the supplied current-base launcher and conflict hunk, that this leaves the November 3 scope decision unchanged; independence is not guaranteed. No code or tests ran in this pass, and the earlier worker results do not verify integration with the current base. The verified label was withdrawn when the conflict appeared and remains off.

This awaits the maintainer's decision on the shell's disk-cache policy and the scope raised in the previous review. After that decision, the branch needs its conflict resolved and fresh worker verification. Nothing was pushed.

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.

2 participants