Record thread recovery candidates on managed daemon shutdown (#44299)

## What changed

- Atomically save successfully persisted, loaded root thread IDs to `app-server-daemon/loaded-threads.json` during graceful managed shutdown, excluding ephemeral threads and threads pending unload.
- Clear stale recovery state at startup and around daemon lifecycle operations, including explicit stops and fresh starts.
- Probe support for `--managed-daemon` before launching managed app servers, and clear recovery state best-effort when launching older binaries.
- Keep forced shutdown responsive while saving the snapshot and log snapshot failures without preventing shutdown.

## Testing

Add coverage for snapshots after active turns finish, forced shutdown without a snapshot, excluded threads, snapshot write failures, and recovery-state cleanup for stops, fresh starts, and legacy launches.

GitOrigin-RevId: 422dc32b85355510f7e4c57b7540597b47d9f0b2
This commit is contained in:
Eric Traut
2026-09-09 20:39:33 +00:00
committed by copyberry
parent 742472c525
commit 7c88f037d9
12 changed files with 398 additions and 41 deletions
+2 -2
View File
@@ -759,8 +759,8 @@ impl MessageProcessor {
self.thread_processor.thread_created_receiver()
}
pub(crate) async fn persist_daemon_threads(&self) {
self.thread_processor.persist_daemon_threads().await
pub(crate) async fn daemon_recovery_candidates(&self) -> Vec<String> {
self.thread_processor.daemon_recovery_candidates().await
}
pub(crate) async fn send_initialize_notifications_to_connection(