caelestia-niri/docs/PROGRESS.md
Jacob Ward 17a7774f9c S002: a restart no longer loses tray icons or freezes the music player
The tray watcher took its bus name before serving its object, and zbus
drops calls that arrive in that gap without a reply. ksni items (Mulberry)
wait for that reply holding their tray lock, so they went missing and the
app's UI froze until the shell exited. The watcher is now served first,
queues for its name, re-scans item names, keeps entries by owner and path,
and the host re-registers with any new watcher; item and player calls time
out. An empty tray keeps its expand state. Fire-and-forget commands are
reaped (services::detach), and Restart Shell stops the last image's helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 08:45:03 -06:00

4 KiB

Progress

One entry per session, newest last, ≤ 15 lines: done, verified how, not done, later.

S001 — Visualiser follows the sound (2026-11-13)

  • Cause: pw-record - writes an AU file (big-endian) to a pipe; we read little-endian, so cava saw noise. Fix: --raw, plus node.passive like the original. Beat (§1.3) was fed the same noise; fixed with it, and toggling the beat no longer restarts the tap.
  • Covered screens now let the visualiser fade (autoHide) before their background stops painting; before, the last bars froze in the gaps.
  • Zombies: Restart Shell's exec orphaned the old image's children (proved in nested niri: pw-record, pactl, swayidle Z); services::reap_inherited reaps them. pw-play sounds reaped (live shell had 470 Z). Tap child reaped on any exit (Rec).
  • Pause (user: bars stick where they were when Mulberry pauses): on pause playing flips the beat, which restarted the tap, and a new tap never sent zeros, so the old heights stayed. Now the beat is a flag and a new tap sends zeros first; pause test in nested (fake MPRIS + null sink) falls to rest.
  • Test: audio::tests::sine_lifts_its_own_bar (peak at the tone's bar, bars change), records_raw_samples.
  • Verified in nested niri: grim crops differ with a tone, match in silence; 6 forced tap restarts + Restart Shell leave no Z; dashboard toggles keep one tap. Only snapshot/nested-tested, not live.
  • Live checks for the batched restart: bars follow a browser video and system sounds on both monitors; dashboard Media ring moves; after Restart Shell, ps -o stat=,comm= --ppid $(pgrep -x caelestia-shell) shows no Z.
  • Not done: the live shell still holds 470 pw-play and 166 caelestia zombies until restart.
  • Later: caelestia (166) and wpctl zombies come from spawn(...) calls in wl.rs that never wait; old-image pactl subscribe etc. still run after an exec restart until they exit (S002 area).

S002 — Restart side effects: tray and the music player (2026-11-13)

  • Cause of both: the tray watcher took its name before serving its object; zbus drops calls in that gap unanswered. ksni items (Mulberry) call RegisterStatusNotifierItem holding their tray lock, so they went missing and Mulberry's UI froze on its next tray update until the shell exited (stand-in: 5.2 s blocks, live: for ever). Fix: serve first, queued name, re-scan item names, dedupe by owner+path, host re-registers with a new watcher; 2 s item / 1 s player call timeouts.
  • Chevron: it vanished with the items; hovering an empty tray no longer collapses it, so a list refilled under the pointer comes back expanded.
  • Zombies: fire-and-forget commands go through services::detach (wpctl, caelestia, udisksctl, autostart, notify-send); Restart Shell stops the last image's helpers (CAELESTIA_HELPER mark) and reaps each inherited child on its own thread (a long ddcutil held up the rest).
  • Verified on a private bus in nested niri, 2 ksni stand-ins (Mulberry-like) + 2 Gio items (one never re-registers) + Position probe: old build lost 1–3 items and froze both ksni stand-ins; new build 5 kill+start and 5 Restart Shell rounds, 4/4 items each, 0 freezes, Position ≤ 35 ms, no zombies. Tests tray::tests (4), cargo test --release green, fuzz 854 tried, 0 crashed. Not tested live.
  • Live checks for the batched restart: after the restart and after a Restart Shell, every tray icon is back (busctl --user list | grep StatusNotifierItem: Mulberry, equibop, Claude, ABDownloadManager) and each one's menu opens; Mulberry keeps playing and its window still responds to play/pause; ps -o stat=,comm= --ppid $(pgrep -x caelestia-shell) shows no Z and one pactl.
  • Note: the user has two Mulberry processes running (711560, 712208, started 11 s apart this morning), maybe a second start after a freeze.
  • Later: notifs.rs serves then requests its name on a plain connection (same race, smaller window: use the builder); current_exe() reads " (deleted)" after install replaces the binary, so Restart Shell's exec likely fails until a real restart; sync_idle's own swayidle kill is now redundant.

Later