fix(daemon-client): document the drain timeout and tighten ensureDaemon follow-ups

Merged
TH
5h ago
+106-51

Part of #3747. References #3754 and #3780 (merged before these landed).

Follow-ups to the quiesce/ensure stack:

  • Docs: daemon-drain-timeout and the post-drain force retire in client-api.md and the help lifecycle topic.
  • A drain-deadline retirement now goes through the typed stopAndRetireDaemon result (stopDaemonForTakeover), replacing the cast on error.details.retirement.
  • A daemon force-retired for outlasting its drain is reported as unreachable (Replaced unreachable daemon), not Replaced idle daemon.
  • The daemon-not-running hint names --state-dir <dir> when the directory is not the default.
  • isDaemonNotRunningError(error) replaces the bare reason string in daemon-client-ensuring.ts.
  • session-store.ts uses DAEMON_SHUTTING_DOWN_REASON.
  • Test: ensureDaemon against a busy daemon with startingUp: true asserts the startup hint.

Already on main, so unchanged: the client reads the startingUp census (readDaemonQuiesceCensus) and daemonBusyError gives the startup hint; the stale comment in daemon-client-metadata.ts no longer exists.

The "answers a probe" stand-in keeps serving /health: a stand-in that stops serving is the previous test (no probe answered, force retire). Its comment now says it models a stuck drain.

🤖 Generated with Claude Code