fix(windows): supervise the status tray, and stop the host on exit #451

Merged
enricobuehler merged 1 commits from fix/windows-tray-supervisor into main 2026-08-30 20:42:09 +00:00
1 Commits
Author SHA1 Message Date
enricobuehler 0329afcb58 fix(windows): supervise the status tray, and stop the host on exit
ci / bun-nix (pull_request) Successful in 22s
ci / docs-drift (pull_request) Failing after 37s
ci / web (pull_request) Successful in 58s
ci / docs-site (pull_request) Successful in 57s
ci / rust-arm64 (pull_request) Successful in 1m55s
ci / rust (pull_request) Failing after 6m32s
android / android (pull_request) Successful in 7m39s
The tray died on every upgrade and stayed dead until the next sign-in. The
update-specific remedy only covered console-initiated updates, and only when
the previous binary already recorded the intent — winget, a hand-run setup and
a plain crash all still ended the same way.

Worse, the relaunch it did manage joined the service worker's kill-on-close
job object, because spawn_in_active_session never asked to break away. Every
process that call launches — the tray, the user's game, a hook — was therefore
reaped when the service stopped, contradicting its own documented contract.

The host now supervises the tray for its whole lifetime, gated on the HKLM Run
value the trayicon task writes. That covers every way a tray can die and needs
nothing from the version that ran before, so the intent record's
tray_was_running flag goes.

The icon's lifetime tracks the host's in both directions: the menu's exit
entry stops the host, and says so. Only that entry does — a sign-out and the
uninstaller's --quit still leave a headless host running. The uninstaller now
removes the service before the tray, so the supervisor cannot put one back.
2026-08-30 18:07:48 +02:00