Shell restores unbounded backlog of stale never-expiring critical popups after power loss (plus 0-byte state files)
What happened
My laptop ran its battery flat and powered off with ~260 undismissed critical "Time to recharge!" popups on screen (the storm itself is a separate bug — see #9670). On the next boot, the shell rehydrated the entire backlog from ~/.local/state/omarchy/notifications/ and displayed a full-screen wall of stale "Battery is down to 3%" toasts — from a session that had ended two hours earlier, while the battery was by then happily charging.
Because they're critical urgency, durationFor() returns 0 and none of them ever auto-expire; they sit there until each is manually dismissed (or omarchy notification dismiss "Time to recharge!").
The abrupt power-off also left 11 zero-byte popup state files (writes truncated at the moment of death):
-rw-r--r-- 1 calum calum 0 Sep 1 14:27 1788287246194-307.json
-rw-r--r-- 1 calum calum 0 Sep 1 14:27 1788287249390-308.json
...
These hydrated as blank/summary-less popups, and since omarchy notification dismiss matches on summary substring, there was no way to dismiss them by summary — I had to delete the files by hand.
Expected
Popup persistence surviving a shell restart is a nice feature, but restore should be bounded:
- Cap the hydrated backlog by count and/or age (e.g. don't restore popups older than a few minutes, or more than ~10 — anything beyond that belongs in history, which is already capped at
historyLimit). - Coalesce duplicates on restore (same app + summary + body) into one popup.
- Discard empty/unparsable state files during hydration instead of surfacing blank toasts.
System
- Framework Laptop 13 (AMD Ryzen 7 7840HS / Radeon 780M)
- Omarchy
4.0.0.r1846.g946704f-1, quickshell0.3.1-1, kernel7.1.9-arch1-2
Related: #9361 (critical toasts never auto-expire, which is why the backlog can only grow).
I reproduced this on a disposable worker built from the Omarchy ISO, running the shell from current quattro (988f44ea1). Then I ran the same steps against open pull request #14335.
What happens on quattro:
- Restore is not bounded. I sent 21 distinct critical notifications, planted 3 zero-byte files, and restarted the shell. All 21 toasts came back.
restorePopupsinshell/plugins/notifications/Service.qmlhydrates every persisted file that has not expired.durationForreturns 0 for critical urgency, sopopupExpiredinNotificationLogic.jsnever drops a critical toast, however old it is. - Identical toasts now collapse while the shell is running. 20 identical "Battery is down to 3%" notifications left a single file. That is de63134b8 (#13522). It only applies to live arrivals, though, not to rows restored from disk. A storm whose body keeps changing (3%, then 2%, …) still builds a backlog.
- Zero-byte files do not become toasts on
quattro. The restore reads the files withawk 1, so an empty file contributes no line, andparsePopupFilesskips empty or unparseable lines. The parsing is the same at the version you reported, so I could not reproduce the blank toasts from empty files. What is real is that nothing ever deletes these files. They were still in~/.local/state/omarchy/notifications/after every toast had been dismissed.
What #14335 changes: with it, the same restart restored 10 toasts instead of 21, and it moved the rest into history. It does not age out stale critical toasts. That depends on critical notifications getting a finite lifetime, which is #9361 and has several competing pull requests. It also does not coalesce duplicates on restore or remove empty files. I tried to link #14335 to this issue so it closes when that merges. The link was refused because #14335 has not been classified yet, so it is not linked.
Reviewed by Opus 5.5. No second opinion ran: the configured reviewer (Codex Medium) answered its availability check, but today's review budget was already spent. This is waiting on the maintainer to decide on #14335 and on how critical toasts should expire (#9361).