fix(daemon-client): wait for an acknowledged quiesce instead of killing the daemon
Merged
TH
10h ago+417+417+012345678901234567890123456789-14-14-01234567890123456789
Part of #3747, references #3754.
After a daemon answered the authenticated quiesce with draining, ensureDaemon still called retireDaemonForTakeover: SIGTERM, then SIGKILL after 3 s. On Windows SIGTERM ends the process outright, skipping plugin disposal, lease finalization and registration cleanup; on POSIX a healthy drain over 3 s was killed.
Now the client signals nothing after draining:
- It waits up to 60 s (polling every 250 ms) for the fenced daemon (pid + start time) to exit, then clears the registration it left.
- At the deadline, a daemon that fails 3 liveness probes is force-retired.
stopDaemonProcessstill signals only a process whose command line is a daemon entry, so an embedded host is never signaled (#3757 will register embedded ownership explicitly). - A daemon that still answers is left alone; the call fails with
daemon-drain-timeoutand a hint namingagent-device daemon stop.
Tests use a virtual clock: a 5 s drain (past the old 3 s kill window) sees no signal, no signal arrives before the deadline, and a responsive daemon at the deadline is left running. Existing replace tests now let the stand-in daemon exit by itself after it answers.
ADR 0006 and the changelog are updated.
🤖 Generated with Claude Code