fix: return confirmed daemon termination outcomes

Merged
TH
2mo ago
+606-298

Summary

Daemon stopping now returns an explicit outcome. One function verifies the captured process lifetime, sequences TERM/KILL, and waits for exit. PID reuse and a verified zombie prove that lifetime ended; unreadable identity, failed signals, and exhausted waits do not.

Manual stop refuses success when exit is unconfirmed. Startup cleanup preserves normalized error reasons, and the transitional timeout fallback reports rejection instead of leaving it unhandled. Integration cleanup retains unconfirmed state and preserves the primary test failure.

18 files changed. Builds on #3123; part of #3116. The dependent client migration replaces the transitional cleanup paths.

Validation

Tested 1b2e47efb5:

  • AGENT_DEVICE_REQUIRE_LOOPBACK_TESTS=1 pnpm check:affected --base refactor/shared-daemon-registration --run passed; all runnable checks completed.
  • Real cleanup, HTTP daemon and replacement smoke passed. Actual children are joined before private test directories are removed.
  • Restoring the old zombie predicate, nested error details, or uncaught timeout fallback fails the corresponding regression. The timeout regression exercises the socket route and reproduces the unhandled rejection.
  • Independent review confirmed termination and response projection. GitHub CI and coverage remain authoritative on the new head.