# In what scenarios must an instance reject a federated capability grant when residency attestations arrive after tool-call dispatch **Date of Record:** 2026 November 24 **Scope:** Applies to cross-org agent federation where a policy engine (PE) evaluates a capability grant against data-residency constraints at the moment of tool-call dispatch, and where the residency attestation for the target resource is obtained asynchronously (via a signed `ResidencyAttestation` from the resource-owning org). Does not apply to single-org deployments or to synchronous grants where the attestation is embedded in the capability token itself. ## Core Distinction The failure mode is not "wrong policy" and not "missing attestation." It is **attestation-arrival skew relative to dispatch**: the PE evaluates the grant, the dispatch is issued optimistically (or under a cached attestation), and the authoritative attestation for the *actual* resource resolved by the tool arrives afterward — sometimes confirming, sometimes contradicting, the cached view. The distinguishing question is not *whether* the attestation is valid but *whether the PE holds a right to act before it arrives*. A policy engine that treats "attestation pending" as "attestation permissive" collapses the residency boundary into a race. A PE that treats it as "attestation blocking" is safe but stalls every federated call behind a cross-org round trip. The non-obvious part: the skew is not a latency bug to be optimized away. It is an **ordering invariant** — the attestation must be *causally prior* to the side effect, not merely temporally prior in the log. A tool that writes to a resource and *then* receives a contradicting attestation has already committed a residency violation that cannot be undone by a later revocation. ## What Was Observed A federated agent in org A (EU-resident) dispatched a `summarize_document` tool call against a resource handle `doc://partner-b/dataset-7` owned by org B. The capability grant was minted by org B's PE with a *cached* residency claim (`region: eu-west-1`) that had been observed 40 minutes earlier. The tool call resolved the handle through org B's resource router, which — due to a re-shard earlier that day — mapped `dataset-7` to a replica in `us-east-2`. The router returned a *new* attestation (`region: us-east-2`) in the response envelope, which org A's PE validated and logged. The summarization output had already been generated and written to org A's episodic store before validation completed. Trace: 1. `A.PE.evaluate(grant)` → `allow` (cached attestation `eu-west-1`, TTL 3600s, age 2400s). 2. `A.agent.dispatch(tool=summarize_document, handle=doc://partner-b/dataset-7)`. 3. `B.router.resolve(handle)` → replica `us-east-2`; executes summarization; returns `{content, attestation: {region: us-east-2, sig: ...}}`. 4. `A.PE.validate(attestation)` → `region_mismatch` (expected `eu-west-1`). 5. Side effect already committed: summary of US-resident data now in EU episodic store. The PE's post-hoc validation fired correctly. It just fired *after* the invariant it was supposed to protect had already been violated. The audit log shows a clean `region_mismatch` event — which is exactly the problem: the log looks like a detection, but the system behaved like a miss. ## Condition of Validity The guardrail holds only under the following conjunction, and fails if any conjunct is dropped: - **Attestation binding to resolved resource, not handle.** The capability grant must be bound to a *resource identity resolved at dispatch time*, not to the opaque handle. A handle-to-replica remap (re-shard, failover, cache miss) silently invalidates a handle-bound attestation. The binding must be `(handle, resolution_epoch, replica_id)` and the PE must reject grants whose `resolution_epoch` predates the router's current epoch. - **Causal priority of attestation over side effect.** For any tool with a write side effect, the attestation must be validated *before* the write commits. This means the tool contract must expose a two-phase form (`prepare` returns attestation + provisional result; `commit` is gated on PE validation). A single-phase tool that returns content and attestation together cannot satisfy this and must be treated as non-federatable for cross-region handles. - **Attestation freshness bound tighter than re-shard cadence.** TTL must be shorter than the minimum interval between resource-router re-shard events. If re-shards can occur every 15 minutes and TTL is 60 minutes, the cached-attestation window is structurally unsound regardless of signature validity. - **Monotonic epoch on the router.** The router must expose a monotonically increasing `resolution_epoch` so the PE can detect that its cached attestation refers to a prior topology. ## Decision Boundary The PE must choose between three actions at dispatch, and the choice is determined by the tool's side-effect class, not by latency budget: | Tool class | Attestation state | Action | |---|---|---| | Read-only, idempotent | Cached, unexpired, epoch-current | `allow` (post-hoc validation acceptable) | | Read-only, idempotent | Cached, epoch-stale | `deny` → force re-attestation | | Write / non-idempotent | Any cached state | `deny` → require two-phase with pre-commit attestation | | Write / non-idempotent | Attestation arrives with result | `deny` (tool is structurally non-federatable) | The boundary that operators get wrong: they apply the read-only row to write tools because the write "usually" targets the same region as the read. The invariant is not "usually." A single contradicting attestation on a non-idempotent write is an unrecoverable residency breach, and the probability of contradiction is exactly the re-shard rate times the TTL — which is small per call and certain over a fleet. ## Operational Effect Enforcing the two-phase contract for write tools moves the residency check from a *post-condition detector* to a *pre-condition gate*. The observable effects: - Cross-org write latency increases by one attestation round trip (typically 80–200ms intra-cloud) — this is the cost of correctness, not overhead to be optimized. - The `region_mismatch` audit event becomes a *prevention* signal (dispatch refused) rather than a *detection* signal (breach logged). Operators who alert on `region_mismatch` must distinguish the two, or they will page on every correctly-refused call. - Cached attestations remain usable for read-only tools, preserving the throughput win where it is safe. - Handles whose router does not expose `resolution_epoch` must be treated as epoch-unknown and forced into the write-tool deny path — a router contract gap becomes a federation eligibility gap. The residual risk after enforcement: a tool that *claims* read-only but has hidden side effects (telemetry writes, cache warming with PII) will still slip through the read-only row. This is why the tool class must be declared by the *resource owner's* PE, not the calling agent's manifest. ```python from dataclasses import dataclass from enum import Enum class ResidencyViolation(RuntimeError): """Raised when a federated tool dispatch would commit a side effect under an attestation that is not causally prior to the commit.""" class SideEffectClass(Enum): READ_ONLY = "read_only" WRITE = "write" @dataclass(frozen=True) class Attestation: region: str resolution_epoch: int issued_at: float signature_valid: bool @dataclass(frozen=True) class CapabilityGrant: handle: str expected_region: str side_effect: SideEffectClass cached_attestation: Attestation | None router_epoch: int ttl_seconds: float now: float def gate_dispatch(grant: CapabilityGrant) -> str: """Decide allow/deny for a federated dispatch. Returns 'allow' or raises.""" att = grant.cached_attestation if grant.side_effect is SideEffectClass.WRITE: # Write tools require pre-commit attestation bound to current epoch. if att is None: raise ResidencyViolation( f"write dispatch for {grant.handle} has no pre-commit attestation" ) if not att.signature_valid: raise ResidencyViolation( f"attestation for {grant.handle} failed signature check" ) if att.resolution_epoch != grant.router_epoch: raise ResidencyViolation( f"attestation epoch {att.resolution_epoch} != router epoch " f"{grant.router_epoch} for {grant.handle}; possible re-shard" ) if att.region != grant.expected_region: raise ResidencyViolation( f"attestation region {att.region} != expected " f"{grant.expected_region} for {grant.handle}" ) return "allow" # Read-only: cached attestation acceptable if unexpired and epoch-current. if att is None: raise ResidencyViolation( f"read dispatch for {grant.handle} has no attestation" ) if grant.now - att.issued_at > grant.ttl_seconds: raise ResidencyViolation( f"attestation for {grant.handle} expired " f"({grant.now - att.issued_at:.0f}s > {grant.ttl_seconds:.0f}s)" ) if att.resolution_epoch != grant.router_epoch: raise ResidencyViolation( f"stale-epoch read attestation for {grant.handle}; force re-attestation" ) return "allow" ```