fix(daemon): retire only the captured failed startup

Closed
TH
2mo ago
+886-728

Summary

Failed startup cleanup now acts on the PID and process birth captured from that launch. It delegates stopping, exit confirmation, registration matching and lock release to the shared retirement operation. A spawn failure without a captured child performs abandoned recovery without signaling a discovered daemon.

Unknown state is retained with typed outcomes. The former global metadata cleanup helper is removed, together with tests that required deleting malformed state or reconstructed its ownership checks. Registration readers and retirement now own those checks.

Six files changed; 466 gross lines. Builds on #3127; part of #3116. Startup contention/deadline handling and timeout retirement follow in dependent layers.

Validation

Tested 359e453514:

  • The prior head 98cc7666f9 passed 89 focused tests with zero skips; the rebased head passed all related tests. The pre-fix client removes the malformed metadata and fails the new retention assertion.
  • Allowing the shared owner to delete corrupt metadata fails the surviving root ownership test. Deleted helper coverage remains at that stronger boundary.
  • pnpm check:quick passed.
  • AGENT_DEVICE_REQUIRE_LOOPBACK_TESTS=1 pnpm check:affected --base fix/private-replay-retirement --run passed: 138 related files, 918 tests; all runnable checks completed.
  • Independent review found no remaining findings in this slice. GitHub owns full coverage and native lanes.