Skip to main content

should_evict_on_forward_failure

Function should_evict_on_forward_failure 

Source
pub fn should_evict_on_forward_failure(entry: &AgentEntry) -> bool
Expand description

Should server/reactive.rs’s evict-on-forward-failure sites remove this entry after a failed forward (success:false or a connection error)?

entry.pid identifies the OWNING SRV PROCESS (AgentEntry::pid’s own doc comment: “OS PID of the owning agentmux-srv process”), not the individual agent — every agent registered under the same channel/srv shares one pid value. A first version of this function (PR #2640, reagent P1 round 2) checked ONLY pid_alive(entry.pid): alive process ⇒ never evict. That over-corrects — it can only ever prove “the whole process died,” never “this ONE agent’s controller died while its srv process kept running for other agents,” which is at least as common a failure mode as a whole-process death on a host running multiple agents under one shared srv (the default topology — see the retro). Under that version, a genuinely-dead individual agent’s entry would linger in the shared registry forever as long as ANY other agent kept that same srv process alive, with no self-healing path short of a full srv restart — strictly worse than the pre-PR-2640 behavior (unconditional eviction) for that case.

Evict when EITHER signal indicates death:

  • the owning process is confirmed dead (definitive), OR
  • the entry is older than FORWARD_FAILURE_GRACE_MS — a fresh entry gets one grace window to account for the specific race PR #2640 fixes (the registering agent’s controller hasn’t finished its own registration yet, even though its srv process and this file both already exist); anything older that still fails a forward is presumed genuinely gone, matching pre-PR-2640 behavior for everything but a just-registered entry.

See docs/retro/retro-cross-channel-jekt-eviction-2026-08-17.md.