fix(daemon): finalize every host-owned close through registration

Merged
TH
2mo ago
+2205-292

Summary

Hosted runtimes close through authenticated shutdown or the host's direct close. One registration finalizer publishes completion and cleanup results atomically in daemon-shutdown.json before releasing its claim.

Stops keep the original token, PID, and process start time. A successor cannot answer for that lifetime. Stops that captured the original record can confirm direct close after the listener shuts down. A retained completion answers later stops while the same host lives. Warnings and unknown cleanup confidence identify unconfirmed resource cleanup.

agent-device daemon stop --state-dir /tmp/agent-device

This 27-file, 2,497-gross-line layer depends on #3806. It supports #3747 and #3757. Public host entry and binding remain later work.

Validation

Head d2f2eb7d86360844e8b113741d07f1ff00ab3ed3, parent e574ba365a. The range-diff preserves central ownership judgment, captured registration, finalizer/report fencing, and the direct-close assertion. Since approved 23a68a41, only three help/documentation lines changed. Runtime implementation and test blobs are unchanged.

pnpm check:affected --run --head d2f2eb7d: 36 runnable checks passed. Receipt run-gr2nMV: exactCommit=true, checkoutChanged=false. GitHub-owned skips are not passes.

Independent code, sentence, and smaller-design review approved 23a68a41. Independent sentence review approved the final clarification and rebase at d2f2eb7d; no findings remain. Required CI remains pending.