small gleam coding and persistent agent daemon with a detachable cli and a canvas ui albedo.sh

CLI reports "unreachable daemon" instead of recovering when a stale daemon.json pid has been reused #31

Closed okami.mom
Closed opened by okami.mom

If the daemon is killed ungracefully ~/.albedo/daemon.json still contains the old pid and port. Every command then fails with Albedo unreachable daemon in ~/.albedo: ... connect: connection refused instead of treating the file as stale and starting a new daemon.

processAlive (cli/internal/localdaemon/detach_unix.go:30) only sends kill(pid, 0) so any process/thread that has taken over the pid after a reboot counts as alive, even one owned by another user, since EPERM is also treated as alive. A fix could record the daemon's start time in daemon.json and check it against /proc/<pid>/stat as priv/python/albedo_proc.py does, rather than only checking that the pid exists.

oh yeah that’s a nasty one. i think pid tracking should be enough

as in track the pid and then check if it’s still albedo

i was able to reproduce and fix it reliably with b8368de1c65b1f0dea0e9d7ea20965cc9c29010e, thanks!

Sign up or Sign in to add to the discussion.