onWatch icon indicating copy to clipboard operation
onWatch copied to clipboard

Tray companion should exit when its daemon is gone

Open prakersh opened this issue 2 months ago • 1 comments

On Linux and Windows the tray companion is spawned by the daemon and keeps running after the daemon is gone, showing a gray dash. onwatch stop kills the companion only when it finds the daemon's PID file; if the daemon dies otherwise, or stop runs with a different LOCALAPPDATA / HOME than the start did, the icon stays behind.

Proposal: the companion watches its parent daemon (PID handed over at spawn) and exits on its own when that process is gone, with a short grace period so a daemon restart does not flicker the icon. Same idea applies to the macOS companion if it does not already do this.

Observed by smoochy during the 2.14.0 betas in #117 (two scratch daemons, LOCALAPPDATA pointed elsewhere at stop time, three icons left over).

prakersh avatar Sep 07 '26 14:09 prakersh

Fixed in 2.14.1. The daemon hands its PID to the companion at spawn time; the companion checks every 5 seconds and quits about 30 seconds after that daemon is gone. A crash, a kill, or an onwatch stop that ran with a different HOME or LOCALAPPDATA than the start did no longer leaves an icon behind.

Restarts do not flicker it: a daemon that comes back inside the grace period is adopted, including under a new PID, and a dashboard still answering on the port counts as alive even when the PID file disagrees. The Windows liveness check was wrong in a related way and went with it - a handle to an exited process stays openable while anything holds one, so it now asks whether the process object has been signalled.

Applies to all three platforms, since they share the companion entry point.

Release: https://github.com/onllm-dev/onWatch/releases/tag/v2.14.1

prakersh avatar Sep 07 '26 14:09 prakersh