# How does an instance detect a stale trust warrant during cross-org federation handoff when policy alignment succeeds but routing authority has silently expired **Date of Record:** 2026 December 1 **Scope:** Applies to federated multi-agent systems where instance A (origin domain) hands a task to instance B (partner domain) under a negotiated trust warrant that carries both a policy-alignment scope and a routing-authority lease. Does not apply to intra-org agent meshes where a single control plane issues and revokes all warrants, nor to stateless request/response tool calls that carry no delegated authority. ## Core Distinction In cross-org federation there are two independent things a trust warrant attests: **policy alignment** (B is permitted to act on A's behalf under an agreed data-handling and capability scope) and **routing authority** (B's domain gateway will actually accept and forward traffic from A's identity for this task). These are negotiated in the same handshake and are usually logged as one object, so a handler that checks "is the warrant valid?" conflates them. The dangerous boundary is this: **policy alignment is evaluated at negotiation time and is stable; routing authority is a leased, renewable resource on the partner's edge and can expire, be rate-limited, or be revoked by the partner's own control plane while the warrant object still reads `valid: true` to the origin.** A handoff therefore succeeds the alignment check and then fails — or worse, silently degrades — at the partner's routing layer. The instance must detect lease expiry as a *separate* invariant from warrant validity, because the warrant's own signature cannot tell it. ## What Was Observed Origin agent `A1` negotiated a federation warrant with partner domain `P` for a classification task. The handshake returned a warrant `W` with `policy_scope: {data: "pii-redacted", caps: ["classify","summarize"]}`, `expires_at: T+3600s`, and an embedded `route_lease: {gateway: "gw.p.example", lease_id: "L-8842", lease_ttl: 300s, renewable: true}`. The 3600s figure is the *warrant* lifetime; the 300s figure is the *route lease* lifetime. A1's planner cached `W` and treated the whole object as valid until `T+3600`. At `T+340` the partner's edge gateway renewed the lease for its own local traffic but, under a capacity policy, declined to renew leases for federated origins whose `lease_id` had not been re-asserted in the prior 60s window. A1 had no reason to re-assert: from its side `W.expires_at` was still 54 minutes out. At `T+410` A1 dispatched a sub-task to `B` (partner worker) through `gw.p.example`. The gateway accepted the connection, completed the TLS and identity handshake, then returned a `200` on the control channel with a body of `{"status":"accepted","dispatch_id":...}` — and dropped the payload, because the route lease `L-8842` had been marked `expired` and the gateway's fallback behavior was to ack-then-discard rather than reject. A1's loop recorded the dispatch as successful. The task's checkpoint advanced. Three downstream sub-tasks were routed on the same dead lease. The failure surfaced only when A1's verifier tried to reconcile results at `T+900` and found `B` had never received any of the four dispatches. Because the warrant still read valid, A1's retry logic re-dispatched on the same warrant and hit the same ack-then-discard four more times before the token budget for the task was exhausted. The non-obvious part: **the failure was invisible at every layer that A1 was instrumented to check.** Warrant signature valid, policy scope matched, gateway reachable, HTTP 200 returned, dispatch acknowledged. The only signal that the lease was dead was a field in the gateway's ack body that A1's handler did not parse (`"lease_state":"expired"`) and a `lease_id` that `B`'s worker would have echoed back in its first heartbeat — which never came because the payload was discarded. ## Condition of Validity The invariant that would have caught this is: **a federated dispatch is not complete until the partner worker echoes the `lease_id` and `dispatch_id` in a worker-originated heartbeat, and the origin must treat any ack lacking that echo as an unconfirmed dispatch, not a success.** This holds only when: - The partner gateway is contractually required to echo `lease_state` in the control-channel ack (many are not; ack-then-discard is common in rate-limited federation edges). - The origin's dispatch handler parses the ack body rather than only the status code. - The origin maintains a per-`lease_id` liveness timer derived from `lease_ttl`, not from `warrant.expires_at`, and re-asserts the lease (a cheap `renew` call) before dispatching any sub-task whose expected duration exceeds the remaining lease. Where these do not hold — e.g., a partner that returns bare `200 OK` with no body, or a warrant format with no embedded lease — the origin cannot detect lease expiry from the dispatch path alone and must fall back to an out-of-band lease-status probe against the partner's control plane before each dispatch batch. That probe is itself a network call with its own failure modes, so it does not restore the invariant; it only reduces the window. ## Decision Boundary The instance must decide, per dispatch, whether it is operating under **warrant-time authority** (safe to treat the warrant as the unit of validity) or **lease-time authority** (must re-assert the lease before every dispatch whose expected duration approaches `lease_ttl`). The boundary is crossed when `expected_task_duration + dispatch_overhead > remaining_lease_ttl`. Below that, warrant-time authority is sound because the dispatch will complete inside the lease. Above it, the instance must either (a) renew the lease and confirm the renewal in the control-channel response before dispatching, or (b) split the task into sub-dispatches each bounded by the remaining lease, checkpointing between them so a lease death mid-task is recoverable rather than silent. The instance must *not* treat `renewable: true` as a guarantee. A renewable lease is renewable only at the partner's discretion; the capacity policy that declined A1's renewal was not visible in the warrant. The decision boundary is therefore evaluated against the *current* lease state, which must be read from the partner, not inferred from the warrant. ## Operational Effect With the invariant enforced, A1's behavior changes in three concrete ways. First, dispatch acks are parsed for `lease_state` and `dispatch_id` echo; an ack without a matching worker heartbeat within `2 × expected_dispatch_latency` is reclassified from `dispatched` to `unconfirmed`, and the checkpoint does not advance. Second, the planner refuses to schedule any sub-task whose expected duration exceeds `remaining_lease_ttl - margin` without a preceding successful renew, so the `T+410` dispatch is either preceded by a renew at `T+400` (which succeeds or fails visibly) or is split. Third, on `unconfirmed`, the instance probes the partner control plane for `L-8842` state before retrying, so the retry storm that burned the token budget is replaced by a single status check that returns `expired` and triggers renegotiation of the lease rather than re-dispatch on a dead warrant. The cost is one extra control-plane round trip per dispatch batch and a planner that must carry lease metadata alongside task metadata. The benefit is that routing-authority death becomes a detectable, recoverable event instead of a silent ack-then-discard that corrupts the task checkpoint and exhausts the token budget on retries against a gateway that will never deliver. ```python import time from dataclasses import dataclass class StaleRouteLeaseError(RuntimeError): """Raised when a federated dispatch is attempted on a route lease that is expired, unconfirmed, or whose remaining TTL cannot cover the dispatch.""" pass @dataclass class RouteLease: lease_id: str gateway: str lease_ttl: float # seconds, from partner edge issued_at: float # monotonic renewable: bool def remaining(self, now: float) -> float: return (self.issued_at + self.lease_ttl) - now @dataclass class DispatchAck: status_code: int body: dict def dispatch_under_lease( lease: RouteLease, expected_duration: float, dispatch_fn, renew_fn, heartbeat_fn, margin: float = 5.0, heartbeat_timeout: float = 10.0, ) -> DispatchAck: now = time.monotonic() # Decision boundary: warrant-time vs lease-time authority. if lease.remaining(now) < expected_duration + margin: if not lease.renewable: raise StaleRouteLeaseError( f"lease {lease.lease_id} has {lease.remaining(now):.1f}s left, " f"task needs {expected_duration:.1f}s, not renewable" ) renewed = renew_fn(lease.lease_id) if not renewed.get("ok"): raise StaleRouteLeaseError( f"renewal of lease {lease.lease_id} refused by {lease.gateway}: " f"{renewed.get('reason', 'unknown')}" ) lease.issued_at = time.monotonic() lease.lease_ttl = renewed["lease_ttl"] ack = dispatch_fn(lease) # Ack-then-discard guard: status 200 is not delivery. if ack.status_code != 200: raise StaleRouteLeaseError( f"dispatch on lease {lease.lease_id} returned {ack.status_code}" ) if ack.body.get("lease_state") != "active": raise StaleRouteLeaseError( f"gateway acked dispatch but lease_state=" f"{ack.body.get('lease_state')!r} on {lease.lease_id}; " f"payload likely discarded" ) dispatch_id = ack.body.get("dispatch_id") if not dispatch_id: raise StaleRouteLeaseError( f"ack on {lease.lease_id} missing dispatch_id; cannot confirm delivery" ) # Delivery is confirmed only by a worker-originated heartbeat echoing both ids. hb = heartbeat_fn(lease.lease_id, dispatch_id, timeout=heartbeat_timeout) if not hb or hb.get("lease_id") != lease.lease_id or hb.get("dispatch_id") != dispatch_id: raise StaleRouteLeaseError( f"no worker heartbeat echo for dispatch {dispatch_id} on lease " f"{lease.lease_id}; dispatch unconfirmed, checkpoint must not advance" ) return ack ```