Summary
The A2A daemon writes a PID file to ~/.zeph/zeph.pid on startup but does not clean it on abnormal termination (SIGKILL, crash). On the next launch, the daemon detects the stale PID file and fails to start cleanly.
Steps to reproduce
- Start daemon:
./target/debug/zeph --config ... --daemon
- Kill it with SIGKILL:
kill -9 <pid>
- Restart daemon — sees:
WARN zeph::daemon: failed to write PID file: File exists (os error 17)
Expected
Daemon should check if the PID in the file is actually alive. If the process is dead (stale PID), clean the file and proceed. Or use atomic PID file semantics (lock file).
Actual
Daemon prints a WARN and continues, but subsequent starts are unreliable. If the old process was a different binary, both can coexist without coordination.
Workaround
rm -f ~/.zeph/zeph.pid before restarting.