Skip to content

feat(agent): ghost-sweep prune circuit breaker + lost-ADD self-heal eviction (#566, #567) - #572

Merged
bpalermo merged 3 commits into
mainfrom
feat/566-567-ghostsweep-hardening
Jul 19, 2026
Merged

bpalermo merged 3 commits into
mainfrom
feat/566-567-ghostsweep-hardening

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

Hardens the CNI ghost sweep against the 2026-07-19 power-blip incident, where a transient fleet-wide netns-check failure made the prune classify every stored pod as a ghost and wipe persistent storage on all nodes — a total mesh egress outage with no self-recovery (container restarts never re-run CNI ADD).

Fixes #566 — prune circuit breaker (root cause).
Fixes #567 — self-heal lost-CNI-ADD pods.

Extends the small phase-helper structure introduced in #561.

#566 — prune circuit breaker

  • Hysteresis: a netns-gone pod is only classified a ghost after ghostNetnsFailThreshold = 3 consecutive failed sweep passes. A passing check (or an API-confirmed-live pod) resets the per-container streak. Orphan pruning (K8s pod authoritatively gone) is not gated — the API is ground truth.
  • API cross-check: before pruning on a netns failure, if the pod list the sweep already fetches reports the pod Running with a live IP, it is not a ghost — skipped and logged. This vetoes the incident's exact false positive.
  • Mass-delete breaker: a pass that would prune more than pruneBreakerFraction = 0.30 of stored pods and more than pruneBreakerMinPods = 2 absolute is refused wholesale — logged at ERROR with the would-be count and a prune_breaker_tripped metric. Every pod is kept. Manual recovery is unaffected: truly-gone pods are gone from the API too, which the orphan cross-check prunes once the correlated failure clears.

#567 — lost-ADD self-heal

  • A live mesh pod missing from local storage (lost CNI ADD) is evicted via the Eviction API (policy/v1, PDB-respecting) after lostAddEvictThreshold = 3 consecutive detections, forcing sandbox recreation and a fresh CNI ADD.
  • Rate-limited to lostAddEvictPerPass = 2 evictions per sweep per node. Emits a AetherCNIAddLost Warning Event on the pod + log + lost_add_evictions metric. Streaks reset when the pod registers or disappears.
  • Interlock: eviction is skipped entirely in any pass where the agent: ghost-sweep prune needs a mass-delete circuit breaker (power-blip incident 2026-07-19) #566 mass breaker tripped (mass loss = fix the storage cause, not evict the world).
  • RBAC: agent ClusterRole gains policy/pods/eviction create and events create. Chart base version bumped 0.78.0 → 0.79.0.

Incident replay under the new logic

  1. Power blip: netns stat fails for all N pods simultaneously; sandboxes survive; API still reports every pod Running with its IP.
  2. API cross-check vetoes every pod immediately — Running-per-API ⇒ not a ghost. Zero prune candidates, zero streaks accrued. (Even absent the API, hysteresis would hold them for 3 passes, and the mass breaker would refuse the pass on pass 3.)
  3. Storage is untouched; listeners stay; mesh egress continues. No outage.
  4. If instead a pod genuinely lost its ADD, it accrues a missing-storage streak and, after 3 passes (breaker not tripped), is evicted — the sandbox is recreated and CNI ADD re-registers it. Self-healed with no manual roll.

Tests

Table-driven, using the package's existing fakes: hysteresis (below-threshold kept, threshold prunes, passing-check reset), API-cross-check veto, mass-breaker trip + metric + eviction interlock, eviction after M sweeps, per-pass rate limit, streak reset on recovery. Existing TestSweepPrunesStalePods adapted to drive past the hysteresis threshold (intent preserved). Full //agent/... suite green (non-race; TestHandlePodTerminatingPoolClosePhase is the known #554 -race flake, untouched).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR

@bpalermo
bpalermo merged commit eb21e28 into main Jul 19, 2026
14 checks passed
@bpalermo
bpalermo deleted the feat/566-567-ghostsweep-hardening branch July 19, 2026 23:01
bpalermo added a commit that referenced this pull request Jul 20, 2026
…icy (#567 self-heal) (#575)

#572 granted pods/eviction under apiGroups:["policy"], but the eviction
subresource create is authorized under the CORE ("") group — so every
ghost-sweep self-heal eviction silently 403'd ("cannot create resource
pods/eviction"). Found via a node-reboot G1 validation: a rebooted node's
prober pod lost its CNI ADD, the self-heal correctly tried to evict it to
force re-ADD, and got a 403 — leaving the pod mesh-broken (5/s prober
connection errors) until manually rolled.


Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant