Skip to content

fix(serving): key the remote-lane breaker by the PEER, not the persona — one dead host learned once for all its citizens (ad96f5d1) - #4173

Merged
joelteply merged 1 commit into
canaryfrom
fix/peer-keyed-remote-breaker
Sep 17, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/peer-keyed-remote-breaker

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The breaker keyed on the wrong thing

The remote-lane breaker (consecutive_deadlines / cold_until_ms) was two atomics on each adapter, and every remote lane is built per persona. So a per-peer fault — one dead grid host — was counted once per citizen.

Measured on the Intel tier 2026-09-17 (Cormac, card ad96f5d1): eight personas exiled to one dead peer, six 600 s deadline misses over fifty minutes, one citizen rescued. The first three misses landed on three different adapters, each stuck at 1; only when three misses happened to hit one persona in a row did her counter reach 3 and fall her home. Seven stayed exiled — at ~600 s/miss × 3 misses/citizen, rescuing the rest is ~4 hours. A peer-keyed breaker trips at the third miss and falls all eight home at once, 30 minutes earlier.

The fix

One PeerBreaker per peer (new peer_breaker.rs), shared by every adapter that pins it via breaker_for. Their evidence about one dead host sums. An answer from any persona resets it (the peer evaluated someone's mail → alive for all); the cold window re-measures once for all; a peer-less adapter (a dream, a test) keeps a private breaker. Pure — now_ms is an argument, so trip/reset/re-measure is assertable with no clock.

No other change is needed. PlacementSwitch::lane_cold() reads the adapter's is_cold(), which now reads the shared breaker, so the next grid tick falls every persona on a tripped peer home at once through the same lane_cold → decide → FallHome path verified end-to-end on the tier today. Fixing the breaker's cardinality makes the existing liveness path do the rest.

Seatbelt, not crash

This is the seatbelt — 8× faster recovery when a peer is genuinely dead. It is not the crash: cross-grid inference is still broken at the root — transport.rs routes a directed peer request through current_room(), so requests land in #general and remote_lane.answered is 0 across all history. That routing fix is separate, two-sided, and pending the well-known-channel decision. This PR does not touch it.

Tests

a_peer_keyed_breaker_sums_evidence_across_callers (three callers, one peer, one miss each → trips once, cold for all) and an_answer_from_any_caller_resets_the_shared_count. All 38 airc_remote tests green.

acceptance: read-and-confirm that N adapters to one dead peer trip the breaker once, and the existing fall-home fires for all of them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply
joelteply enabled auto-merge (squash) September 17, 2026 18:15
…a — one dead host is learned once, for all its citizens (ad96f5d1)

The breaker (`consecutive_deadlines` / `cold_until_ms`) was two atomics ON each
`AircRemoteInferenceAdapter`, and every remote lane is built PER PERSONA — so a
per-PEER fault was counted once PER CITIZEN. Measured on the Intel tier
2026-09-17 (Cormac, card ad96f5d1): eight personas exiled to one dead peer, SIX
600 s deadline misses over fifty minutes, and only ONE citizen rescued — the
first three misses landed on three different adapters each stuck at 1, and only
when three misses happened to hit one persona in a row did her counter reach 3
and fall her home. Seven stayed exiled; at ~600 s per miss and 3 misses needed
per citizen, rescuing the rest would take ~4 hours. A peer-keyed breaker trips at
the THIRD miss and falls all eight home at once, thirty minutes earlier, because
the evidence is about the peer, not about who happened to ask.

So the breaker keys on the fault's true cardinality: ONE `PeerBreaker` per peer
(new `peer_breaker.rs`), shared by every adapter that pins it via `breaker_for`.
An answer from ANY persona resets it (the peer evaluated someone's mail → alive
for all); the cold window re-measures once for all; a peer-less adapter (a dream,
a test) keeps a private breaker. Pure — `now_ms` is an argument, so the
trip/reset/re-measure is assertable with no clock.

The existing liveness path needs no other change: `PlacementSwitch::lane_cold()`
reads the adapter's `is_cold()`, which now reads the shared breaker, so the next
grid tick falls EVERY persona on a tripped peer home at once through the same
`lane_cold → decide → FallHome` path Cormac verified end to end.

This is the SEATBELT (8x faster recovery when a peer is genuinely dead), the
"leaving half" — cross-grid inference is still broken at the root (`transport.rs`
routes a directed peer request through `current_room()`, requests land in
#general, `remote_lane.answered` is 0 across all history), and the "returning
half" (a service-gated ReturnRemote so a rescued citizen is not sent straight
back to a never-serving peer) is a separate PR. This one does not touch either.

Addresses Cormac's #4173 review: (1) a stated eviction bound on `PEER_BREAKERS`
(bounded by distinct grid peers, never evicted — the house rule wants a decision,
not an assumption); (2) `observe_timeout` claims the trip with a CAS so concurrent
misses at the threshold emit the cold probe EXACTLY once, instead of double-
counting in the trip-frequency probe.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fix/peer-keyed-remote-breaker branch from 44b048c to 5c4736d Compare September 17, 2026 18:25
@joelteply
joelteply merged commit 6fe6130 into canary Sep 17, 2026
6 checks passed
@joelteply
joelteply deleted the fix/peer-keyed-remote-breaker branch September 17, 2026 18:46
joelteply added a commit that referenced this pull request Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1)

The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold &&
cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel
tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home,
then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still
fresh — she was returned to e85a5bb3, a peer that has never answered a single request
in this node's entire history (`remote_lane.answered` = 0 all-time).

A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that
beacons perfectly and serves nothing is the most attractive dead seat on the grid.
#1560 already won this argument one layer down — `has_observed_success` makes
`health_check` admit "no signal" until traffic proves a peer reachable, so the
SELECTOR does not route to an unproven peer. The placement gate made the identical
mistake for SEAT selection and never asked.

The fix, composing with the peer-keyed breaker (#4173): the service signal, like the
fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker`
(`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed
as `served_ok()`. The Seat::Home arm becomes
`fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying,
opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok`
decides when it is safe to GO BACK on summed SUCCESS.

The self-sealing wrinkle — a never-served peer would never receive a first placement —
is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried,
only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and
gets its first chance. #1560's strict reading was about not ROUTING to an unproven
peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for`
returns a pristine (served_ok = true) entry for a peer never seen, so
`follow_the_fleet` never self-seals a new seat.

Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is
ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct
from the count-reset path.

On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root
is that cross-grid inference was never addressable (the receiving node refuses every
`ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This
closes the placement flap that root produced.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1)

The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold &&
cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel
tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home,
then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still
fresh — she was returned to e85a5bb3, a peer that has never answered a single request
in this node's entire history (`remote_lane.answered` = 0 all-time).

A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that
beacons perfectly and serves nothing is the most attractive dead seat on the grid.
#1560 already won this argument one layer down — `has_observed_success` makes
`health_check` admit "no signal" until traffic proves a peer reachable, so the
SELECTOR does not route to an unproven peer. The placement gate made the identical
mistake for SEAT selection and never asked.

The fix, composing with the peer-keyed breaker (#4173): the service signal, like the
fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker`
(`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed
as `served_ok()`. The Seat::Home arm becomes
`fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying,
opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok`
decides when it is safe to GO BACK on summed SUCCESS.

The self-sealing wrinkle — a never-served peer would never receive a first placement —
is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried,
only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and
gets its first chance. #1560's strict reading was about not ROUTING to an unproven
peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for`
returns a pristine (served_ok = true) entry for a peer never seen, so
`follow_the_fleet` never self-seals a new seat.

Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is
ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct
from the count-reset path.

On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root
is that cross-grid inference was never addressable (the receiving node refuses every
`ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This
closes the placement flap that root produced.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 17, 2026
…con — stop sending a rescued citizen back to a never-serving peer (ad96f5d1) (#4176)

The placement return gate (`decide()`, Seat::Home arm) was `fresh && !lane_cold &&
cooled`, where `fresh` is BEACON age — liveness, not service. Measured on the Intel
tier 2026-09-17 (Cormac, card ad96f5d1): the peer-keyed breaker fell Saoirse home,
then five minutes later — the moment COLD_WINDOW lapsed and the beacon was still
fresh — she was returned to e85a5bb3, a peer that has never answered a single request
in this node's entire history (`remote_lane.answered` = 0 all-time).

A beacon proves the peer is ALIVE; it does not prove it will ANSWER, and a node that
beacons perfectly and serves nothing is the most attractive dead seat on the grid.
#1560 already won this argument one layer down — `has_observed_success` makes
`health_check` admit "no signal" until traffic proves a peer reachable, so the
SELECTOR does not route to an unproven peer. The placement gate made the identical
mistake for SEAT selection and never asked.

The fix, composing with the peer-keyed breaker (#4173): the service signal, like the
fault, is a fact about the PEER not who asked, so it moves onto `PeerBreaker`
(`ever_served` / `ever_observed`, set in `observe_answer`/`observe_timeout`) exposed
as `served_ok()`. The Seat::Home arm becomes
`fresh && !lane_cold && cooled && peer_served_ok`. Same registry, same keying,
opposite polarity: the breaker decides when to LEAVE on summed FAILURE, `served_ok`
decides when it is safe to GO BACK on summed SUCCESS.

The self-sealing wrinkle — a never-served peer would never receive a first placement —
is resolved by `served_ok = ever_served || never-observed`: a proven-bad peer (tried,
only timeouts, e85a5bb3) is blocked; a brand-new UNTRIED peer reads optimistic and
gets its first chance. #1560's strict reading was about not ROUTING to an unproven
peer; refusing to ever TRY one is the worse, self-sealing failure. `breaker_for`
returns a pristine (served_ok = true) entry for a peer never seen, so
`follow_the_fleet` never self-seals a new seat.

Also folds in Cormac's #4173 re-review test (same file): a miss while the peer is
ALREADY cold does not re-trip — exercises the CAS warm-guard refusal branch, distinct
from the count-reset path.

On this tier e85a5bb3 is proven-bad, so the flap cannot form. NOT the root: the root
is that cross-grid inference was never addressable (the receiving node refuses every
`ai/generate` with request_not_for_me — card c34034b9), a separate transport fix. This
closes the placement flap that root produced.


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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant