mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## 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
17 lines
450 B
Rust
17 lines
450 B
Rust
//! 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"),
|
|
}
|
|
}
|