mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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:
1 parent
742472c525
commit
7c88f037d9
12 files changed
+398
-41
No files matched your search
@@ -0,0 +1,16 @@
|
||||
//! Removes stale snapshots before planned daemon replacements.
|
||||
|
||||
use std::io::ErrorKind;
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::Daemon;
|
||||
|
||||
pub(crate) fn discard_pending(daemon: &Daemon) -> Result<()> {
|
||||
match std::fs::remove_file(daemon.recovery_file()?) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(err) if err.kind() == ErrorKind::NotFound => Ok(()),
|
||||
Err(err) => Err(err).context("failed to clear daemon recovery file"),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user