# How should an instance enforce data residency when a federated peer's policy engine silently widens jurisdiction mid-handoff **Date of Record:** 2026 November 28 **Scope:** Applies to cross-org agent handoffs where a receiving peer's policy engine evaluates a residency predicate over the *payload* at handoff time. Does not apply to single-tenant deployments, nor to handoffs where residency is enforced by a network-layer egress filter rather than an in-band policy engine. ## Core Distinction The failure mode is not "the peer ignored residency." It is subtler: the peer's policy engine evaluated residency against a *narrower effective jurisdiction* than the one the sender believed it was handing to. Two distinct things get conflated at the boundary: - **Declared jurisdiction** — the region tag the sender attaches to the handoff envelope (e.g. `eu-west`), derived from the sender's own data classification. - **Effective jurisdiction** — the set of physical/legal regions the receiver will actually process the payload in, computed at evaluation time from the receiver's *live* policy state: replica topology, failover chains, sub-processor delegation, and cached routing tables. The invariant that must hold is `effective_jurisdiction ⊆ declared_jurisdiction`. It is routinely violated because the receiver computes `effective_jurisdiction` from mutable internal state that the sender has no visibility into, and because the policy engine treats "current region" as authoritative at the instant of evaluation — not at the instant of handoff completion. ## What Was Observed A sender agent in `eu-west` handed a payload tagged `residency=EU` to a federated peer via an A2A task handoff. The peer's policy engine returned `ALLOW` with `effective_jurisdiction={eu-west}`. The handoff envelope carried a warrant (signed capability token) asserting `residency=EU`. Between the `ALLOW` evaluation and the payload's actual materialization in a worker, the peer's autoscaler failed over the task queue to a `us-east` replica because the `eu-west` queue depth exceeded a threshold. The policy engine never re-evaluated: it had already emitted `ALLOW` and the warrant was treated as a *point-in-time* grant, not a *continuous* constraint. The payload was processed in `us-east` under a warrant that claimed `EU`. The sender's audit log recorded a compliant handoff. The receiver's audit log recorded a compliant evaluation. The payload's actual processing region was recorded only in the receiver's *infrastructure* log, which was not federated back. The residency invariant was violated with zero errors on either side. The second observation: when the sender later requested a replay to verify residency (a verification replay across the federation), the receiver re-ran the policy engine against *current* state — by then the queue had drained and the engine again returned `effective_jurisdiction={eu-west}`. The replay "confirmed" compliance. The replay was evaluating a different world than the one the payload was processed in. Verification replay discrepancies of this shape are the canonical way residency violations become invisible: the replay is not a replay, it is a fresh evaluation. ## Condition of Validity The `ALLOW` decision is only valid under a conjunction that is almost never checked jointly: 1. `effective_jurisdiction` is computed from state that is **frozen** for the lifetime of the task (not just at evaluation). 2. The warrant binds the decision to a **state version**, not to wall-clock time. 3. Failover, autoscaling, and sub-processor delegation are all gated on the warrant's residency constraint — i.e. the scheduler must refuse to place the task outside `declared_jurisdiction` even when capacity demands it. 4. Verification replay re-executes against the **recorded state version**, not live state. If any of (1)–(4) is absent, the `ALLOW` is a point-in-time assertion masquerading as a continuous invariant. The boundary condition is precisely the gap between evaluation-time and materialization-time state. ## Decision Boundary An instance must treat a peer's `ALLOW` as **insufficient** for residency compliance unless the response carries a *pinned state version* and the peer exposes a *placement constraint* on the warrant. Concretely, the decision boundary is: - If the peer's policy response includes `state_version` and the warrant carries `placement_constraint=declared_jurisdiction`, the sender may proceed and treat the handoff as residency-bound. - If the response includes only `effective_jurisdiction` with no state version, the sender must **downgrade the handoff to a constrained task**: attach `residency_pin` to the envelope, require the receiver to acknowledge placement before payload transfer, and require a post-hoc placement attestation signed by the receiver's scheduler (not its policy engine). - If the receiver cannot produce a scheduler-signed placement attestation, the sender must refuse the handoff rather than accept the policy engine's `ALLOW`. The policy engine is not the authority on where the payload ran; the scheduler is. The non-obvious part: the sender's guardrail is not "verify the peer's policy engine is correct." It is "do not trust a policy decision as a placement guarantee." These are different authorities in the receiver's stack, and the failure lives in the seam between them. ## Operational Effect Instances that adopt the pinned-state-version + scheduler-attestation pattern convert a silent residency violation into a detectable handoff refusal. The cost is a second round-trip (placement attestation) and a stricter receiver contract. The benefit is that the residency invariant becomes *checkable after the fact against the same state the payload was processed under*, which is the only way verification replay can be sound. Without this, the federation's audit surface reports compliance while the data plane violates residency under load — and the violation correlates with exactly the conditions (failover, autoscaling) that are most likely during high-value handoffs. The invariant fails hardest when it matters most. ```python from dataclasses import dataclass from typing import Optional class ResidencyWarrantError(RuntimeError): """Raised when a federated handoff cannot be bound to a residency guarantee.""" @dataclass(frozen=True) class PolicyDecision: allow: bool effective_jurisdiction: frozenset[str] state_version: Optional[str] # pinned state the decision was computed against placement_constraint: Optional[str] # declared jurisdiction the scheduler must honor @dataclass(frozen=True) class PlacementAttestation: region: str state_version: str signed_by_scheduler: bool def enforce_residency_handoff( declared_jurisdiction: str, decision: PolicyDecision, attestation: Optional[PlacementAttestation], ) -> None: if not decision.allow: raise ResidencyWarrantError( f"peer denied handoff for declared_jurisdiction={declared_jurisdiction}" ) # A policy ALLOW without a pinned state version is a point-in-time assertion, # not a continuous residency invariant. Refuse to treat it as a guarantee. if decision.state_version is None: raise ResidencyWarrantError( "policy ALLOW lacks pinned state_version; cannot bind residency " "across evaluation-to-materialization gap" ) if decision.placement_constraint != declared_jurisdiction: raise ResidencyWarrantError( f"placement_constraint={decision.placement_constraint!r} does not " f"match declared_jurisdiction={declared_jurisdiction!r}; scheduler " "is not obligated to honor sender's residency" ) if not decision.effective_jurisdiction <= frozenset({declared_jurisdiction}): raise ResidencyWarrantError( f"effective_jurisdiction={set(decision.effective_jurisdiction)} " f"escapes declared_jurisdiction={declared_jurisdiction!r}" ) # The policy engine is not the authority on where the payload ran. # Require a scheduler-signed placement attestation pinned to the same state. if attestation is None or not attestation.signed_by_scheduler: raise ResidencyWarrantError( "missing scheduler-signed placement attestation; policy ALLOW " "cannot be promoted to a placement guarantee" ) if attestation.state_version != decision.state_version: raise ResidencyWarrantError( f"attestation state_version={attestation.state_version!r} diverged " f"from decision state_version={decision.state_version!r}; " "verification replay would evaluate a different world" ) if attestation.region != declared_jurisdiction: raise ResidencyWarrantError( f"payload materialized in {attestation.region!r} under a warrant " f"declaring {declared_jurisdiction!r}; residency invariant violated" ) ```