Skip to main content

remove_if_nonce

Function remove_if_nonce 

Source
pub fn remove_if_nonce(data_dir: &Path, agent_id: &str, expected_nonce: u64)
Expand description

Remove an agent entry only if it was written by the spawn with expected_nonce — compare-and-remove for persistent-controller exit-handlers (issue #2363; nonce is process-wide unique, so the guard holds across controller replacement too — codex P1 on PR #2500). An entry with no recorded nonce (0) is never removed by this variant: leaving a stale file to the TTL sweep (cleanup_stale) is strictly safer than deleting a live registration. Atomic w.r.t. this process’s own writes via REGISTRY_OP_LOCK.