Skip to main content

MAX_INFRA_FAILURES

Constant MAX_INFRA_FAILURES 

Source
pub const MAX_INFRA_FAILURES: u32 = 5;
Expand description

Ceiling for crate::state::State::infra_failures before an infrastructure-class fault chain (OOM/ResourceKilled, missing agent binary/AgentUnavailable) forces a terminal gate (D-08, 17-01).

Deliberately more lenient than MAX_CONSECUTIVE_FAILURES (3): infra faults are not the agent’s fault, so a higher ceiling tolerates transient cloud outages/OOM blips that a 3-ceiling would abort prematurely, while still bounding a stuck loop to at most 5 unobserved cycles before a terminal abort. Any increment of infra_failures must use saturating_add so a long-running stuck loop cannot overflow u32. The CLI’s transition() resets infra_failures to 0 unconditionally on every successful stage transition (CR-01, 17-06 gap closure) — this reset is what makes the “5 unobserved cycles” ceiling bound a stuck loop rather than a phase’s entire lifetime. Unlike infra_failures, consecutive_failures’ reset is conditional — see transition_resets_consecutive_failures — the two counters no longer share a single reset condition (18d, WR-11).