fix(daemon): keep idle reap closed during shutdown

Merged
TH
9h ago
+117-9

Summary

Prevent request completion and lease-end activity during shutdown from restarting idle reap. The timer owns a terminal closed phase. Lifecycle admission now closes for every shutdown, so quiesce reports draining during a SIGTERM drain.

Three files; no scope expansion. FU-REAP audit task; no separate implementation issue.

Validation

  • Base: a0e7c7dc239922bf93adaceff20a2f7e78579146; head: b4e74e66f6ce37de044b1ac26965c6207de0ac57.
  • Regression command: pnpm exec vitest run --project unit-core packages/daemon/src/server/http/daemon-runtime-quiesce.test.ts -t 'request completion after close|quiesce during an external close'. Tests-only patch on base: 2 failed (one reap; daemon-busy). Same command on head: 2 passed. Four focused files: 43 passed.
  • pnpm gate unit: 16,967 passed, 1 skipped; smoke 76 passed, 6 skipped; temporary-directory guard passed.
  • pnpm format passed. pnpm check:affected --run --head HEAD failed. Receipt .tmp/validation/run-H4U4HJ/receipt.json: exactCommit=true, checkoutChanged=false; format, lint, typecheck, layering, Fallow, build passed.
  • Base blocker #4060: identical related-test command on unchanged base and head yielded 303 passed / 1 failed, apple-platform-output-guard.test.ts:385, record exceeded 20 seconds. Cause remains unproven.
  • Live at 1def13f07b (production identical to head): private-state daemon, inventory request canceled by SIGTERM, exit 0. Temporary timer-observer log: SIGTERM 09:22:01.427, exit 09:22:06.447 UTC; zero re-arms/fires during the 25 ms idle window's drain. Scratch removed.

Cold self-review only. CI Integration Tests/Coverage remain authoritative. Ready for review as requested; not merge-ready while #4060 blocks validation.