# How does an instance detect capability-claim staleness in federated agent routing when latency-aware matching silently binds to a degraded peer **Date of Record:** 2026 November 19 **Scope:** Applies to federated agent meshes where a router selects a downstream peer by jointly scoring advertised capability and measured round-trip latency (RTT) across organizational trust boundaries. Does not apply to single-tenant orchestrators where the router and all peers share one clock, one registry, and one failure domain. ## Core Distinction The failure is not "peer went down" and it is not "capability advertised but not implemented." Both of those produce hard errors that a router can catch. The failure is that **latency-aware scoring converts a transient degradation into a capability-claim promotion**. A peer that is slow but still answering keeps its advertised capability score intact while its latency term inflates the composite score's variance. If the router's scoring function rewards low latency with a multiplicative bonus on capability confidence, a peer that has degraded *just enough* to look cheap on a stale RTT sample — but not enough to time out — will outrank a healthy peer whose RTT sample was taken during a burst. The router binds a task to a peer that will answer, slowly and possibly incorrectly, and the binding is *not* an error. It is a valid selection under a corrupted input. The invariant that breaks is: **a capability claim is only valid at the latency at which it was measured.** Federated routing treats capability and latency as independent score dimensions. They are not. A peer's effective capability is a function of its current load, and its current load is precisely what the latency term is supposed to measure — except the latency term is sampled at a different time than the capability term, across a boundary where the two organizations do not share a clock or a load signal. ## What Was Observed A three-org federation. Router R (org A) routes tasks to peers P1 (org B) and P2 (org C). Both advertise `capability: "document-redaction"` with a self-reported confidence of 0.94 and 0.91 respectively, refreshed on a 60-second TTL. R scores each candidate as `confidence * (1 / (1 + rtt_ms/100))`, a common latency-discounted confidence form. At T0, P1 is healthy: RTT 40 ms, composite ≈ 0.94 * 0.714 = 0.671. P2 is slightly slower: RTT 55 ms, composite ≈ 0.91 * 0.645 = 0.587. R routes ~all redaction work to P1. At T1, org B begins a batch backfill on the same inference pool. P1's RTT climbs to 180 ms but it does not fail readiness — it still answers within the 500 ms timeout. Its *confidence claim*, however, is stale: it was measured at 40 ms load and still says 0.94. R's next scoring pass computes 0.94 * (1/(1+1.8)) = 0.336. P2 now wins at 0.587. So far this is the *correct* behavior — R sheds load. The failure is at T2. P2 receives the shed traffic, saturates, and its RTT climbs to 140 ms. Its confidence claim is *also* stale (0.91, measured at 55 ms). Composite: 0.91 * (1/(1+1.4)) = 0.379. P1's backfill finishes; P1's RTT drops back to 45 ms but its 60-second capability TTL has not yet refreshed, so it still advertises 0.94. P1 composite: 0.94 * (1/(1+0.45)) = 0.648. R routes back to P1 — correctly. The observable pathology is not in steady state. It is in the **oscillation window**: for the 60 seconds during which P1's RTT has recovered but P2's confidence claim is still the one measured under low load, R alternates bindings every scoring pass. Each pass re-samples RTT but reuses the last capability claim. The two terms are measured on different clocks, so the composite score is a comparison between a fresh latency and a stale confidence, and the winner flips whenever the fresh latency crosses the stale confidence's implicit load assumption. During the window, tasks are split across both peers with no affinity, and the redaction pipeline's deduplication cache — keyed by document hash and *peer identity* — misses on every alternation. Duplicate redactions of the same document were observed at a rate of 11% of documents during the oscillation window, zero outside it. ## Condition of Validity The invariant "capability claim is valid at its measured latency" holds only when the router can prove that the capability claim and the latency sample were taken under the same load regime. Across an organizational boundary this proof is unavailable by construction: org B's confidence number is a self-report about org B's model, and org A's RTT is a measurement of the network path plus org B's queue. They share neither a clock nor a load signal. Three conditions must all hold for latency-aware federated matching to be sound: 1. **Claim freshness bound is tighter than the degradation timescale.** If a peer can degrade in 5 seconds but refreshes its capability claim every 60 seconds, the claim is stale for up to 55 seconds of every degradation event. The TTL must be shorter than the fastest plausible degradation, or the claim must be invalidated by a load signal, not a timer. 2. **The latency term must not be used to *rank* capability across peers whose claims were measured at different loads.** It may be used to *veto* (peer too slow to meet deadline) but not to *multiply* into a confidence that was measured at a different latency. 3. **Binding must be sticky across the oscillation window.** If the router can flip a task's peer between scoring passes, the downstream dedup/idempotency key must not include peer identity, or the flip must be suppressed until the capability TTL has refreshed at least once under the new latency regime. The observed system violated all three. It refreshed on a timer (violating 1), multiplied latency into confidence for ranking (violating 2), and keyed dedup by peer (violating 3). ## Decision Boundary The router must distinguish two questions that latency-aware scoring conflates: - **"Is this peer capable of this task?"** — answered by the capability claim, valid only at the load under which it was measured. - **"Can this peer answer within the deadline?"** — answered by the latency sample, valid only for the instant it was taken. These must be evaluated as a **conjunction with an explicit staleness guard**, not as a product. Concretely: compute a capability *eligibility set* from claims whose age is below a degradation-aware bound, then within that set apply latency as a hard deadline filter, then break ties by a *stable* key (peer id hash) rather than by the latency-discounted score. This eliminates the oscillation because the tie-break does not depend on the fresh latency sample, so a peer that recovers does not immediately reclaim traffic until the eligibility set itself changes. The boundary condition to detect is: **a peer whose latency sample has crossed its claim's implicit load assumption while its claim age is still within TTL.** That is the exact state in which the composite score is comparing incommensurable quantities. Detection requires the router to track, per peer, the latency at which the current capability claim was *issued* (the peer must include it in the claim envelope) and compare it against the current RTT sample. When `current_rtt > issue_rtt * k` for some factor `k` (empirically 2.0 for the observed system), the claim must be treated as **stale-by-load** and the peer demoted to a probationary tier rather than ranked. ## Operational Effect When the guard is absent, the operational signature is a *silent* quality regression, not an availability incident. Dashboards show both peers up, both returning 200s, aggregate latency within SLO, and no error-rate spike. The only signal is downstream: duplicate side effects (because of peer-keyed dedup), or — if the task is non-idempotent, e.g. a redaction that mutates a shared document store — *conflicting writes* from two peers that each believed they held the binding. The oscillation window is the danger zone, and it is invisible to any monitor that watches peer health rather than *binding stability*. The required telemetry is a **binding-churn counter**: the number of times a task's assigned peer changes between scoring passes, per task class. A nonzero churn rate on a task class that should be stable is the detection signal. It fires before duplicate writes, because the churn is the cause and the duplicate write is the effect. When the guard is present, the effect is bounded: a degrading peer is demoted on the first scoring pass where `current_rtt > issue_rtt * k`, its claim is marked stale-by-load, and it cannot re-enter the eligible set until it re-issues a capability claim *at the new latency*. That re-issue is the proof that the claim and the latency are commensurable. Until then it can still serve as a deadline-permitting fallback, but it cannot win a ranking. The architectural invariant, stated for the record: **a federated router may rank peers by capability only among claims issued at comparable latency; latency may veto but may not multiply.** Violating this produces oscillation, and oscillation across an organizational boundary produces duplicate or conflicting state mutations that no single org's monitoring can see. ```python import hashlib import time from dataclasses import dataclass, field class StaleByLoadError(RuntimeError): """Raised when a peer's capability claim was issued at a latency regime that no longer matches its current measured RTT, making the composite capability*latency score incommensurable.""" pass @dataclass class CapabilityClaim: peer_id: str capability: str confidence: float issued_at: float # monotonic seconds issue_rtt_ms: float # RTT at which confidence was measured ttl_s: float = 60.0 @dataclass class PeerState: peer_id: str claim: CapabilityClaim current_rtt_ms: float last_bound_task: dict = field(default_factory=dict) STALENESS_FACTOR = 2.0 # empirical k: current_rtt > issue_rtt * k => stale-by-load def claim_is_stale_by_load(peer: PeerState, now: float) -> bool: claim = peer.claim if now - claim.issued_at > claim.ttl_s: return True # ordinary TTL staleness if peer.current_rtt_ms > claim.issue_rtt_ms * STALENESS_FACTOR: return True # load-regime staleness: the silent one return False def select_peer( peers: list[PeerState], capability: str, deadline_ms: float, now: float, ) -> PeerState: eligible = [ p for p in peers if p.claim.capability == capability and p.current_rtt_ms <= deadline_ms and not claim_is_stale_by_load(p, now) ] if not eligible: # Distinguish hard ineligibility from the load-staleness case so # callers can decide to wait for a re-issued claim rather than fail. stale = [ p for p in peers if p.claim.capability == capability and p.current_rtt_ms <= deadline_ms and claim_is_stale_by_load(p, now) ] if stale: raise StaleByLoadError( f"all deadline-eligible peers for {capability!r} have " f"capability claims issued at a stale latency regime: " f"{[(p.peer_id, p.claim.issue_rtt_ms, p.current_rtt_ms) for p in stale]}" ) raise StaleByLoadError( f"no peer satisfies capability={capability!r} within deadline={deadline_ms}ms" ) # Stable tie-break: do NOT rank by latency-discounted confidence, which # oscillates when fresh RTT crosses stale issue_rtt. Rank by a stable # hash of peer_id so a recovering peer does not reclaim traffic until # its claim is re-issued at the new latency. def stable_key(p: PeerState) -> str: return hashlib.sha256(p.peer_id.encode()).hexdigest() eligible.sort(key=stable_key) return eligible[0] def bind_task( peers: list[PeerState], capability: str, task_id: str, deadline_ms: float, now: float, ) -> PeerState: chosen = select_peer(peers, capability, deadline_ms, now) # Binding-churn detection: if this task was previously bound to a # different peer within the same capability, record churn. Churn on a # task class that should be stable is the pre-duplicate-write signal. for p in peers: prev = p.last_bound_task.get(task_id) if prev is not None and prev != chosen.peer_id: raise StaleByLoadError( f"binding churn for task {task_id!r}: {prev} -> {chosen.peer_id} " f"within oscillation window; suppress rebind until claim refresh" ) chosen.last_bound_task[task_id] = chosen.peer_id return chosen ```