# Which invariants prevent silent residency violations in cross-org agent federation when policy negotiation succeeds on the control plane but data-plane placement drifts **Date of Record:** 2026 November 18 **Scope:** Applies to federated multi-agent systems where two or more organizations negotiate a data-sharing policy (purpose, retention, residency) via a control-plane handshake and then exchange artifacts (tool outputs, embeddings, audit events) over a data plane that may be geographically or jurisdictionally partitioned. Does not apply to single-org agent meshes, nor to federations where the data plane is physically co-located with the control plane and shares a single storage substrate. ## Core Distinction The failure mode is not a *negotiation* failure and not a *transfer* failure. It is a **placement drift** between the moment a policy is agreed and the moment an artifact is materialized. Policy negotiation produces a signed agreement that names a residency constraint (e.g., `region=eu-central`, `jurisdiction=DE`). The data plane, however, resolves placement through a *separate* mechanism — replica routing, CDN edge selection, embedding cache locality, or vector-index sharding — that was configured before the agreement existed and is not re-evaluated per artifact. The critical distinction: **a control-plane success is treated as evidence of data-plane compliance.** It is not. The agreement is a *constraint declaration*; the placement is an *independent decision* made by a scheduler that may not even know the agreement exists. The invariant that matters is not "the policy was accepted" but "every artifact's observed placement is a member of the set the accepted policy permits, evaluated at write time, not at negotiation time." A second, subtler distinction separates *declared* residency from *effective* residency. An artifact can be declared `eu-central` in its metadata while its bytes rest in a replica in `us-east` because the metadata travels with the logical record and the bytes travel with the physical store. Audit trails that read metadata will report compliance; the bytes will not be compliant. This is the silent violation. ## What Was Observed In a three-org federation (Org A: EU data controller; Org B: US-based inference provider; Org C: APAC audit broker), the following sequence reproduced on every cold-start of a new tenant: 1. Org A and Org B completed negotiation. The signed agreement carried `residency: {allowed: ["eu-central-1"], forbid_cross_border: true}`. 2. Org A's agent invoked a tool on Org B. Org B's data plane resolved the output artifact to a *warm* embedding cache in `us-east-1` because the cache key had been populated by an earlier, unrelated tenant whose agreement permitted US placement. 3. The artifact's logical metadata was stamped `eu-central-1` — the metadata writer read the *agreement*, not the *placement*. 4. The audit event emitted by Org B recorded `policy_id` and `region=eu-central-1`, because the audit emitter also read the agreement. 5. Org C's audit broker verified the event against the agreement and reported **compliant**. The violation was only detected during a manual egress-log reconciliation three weeks later: the byte-level transfer log showed the artifact's payload crossed the EU boundary at step 2, while every semantic layer above it reported EU residency. No single component was lying; each was faithfully reporting the layer it could see. The composition of truthful layers produced a false global claim. A second observation: when the cache was flushed and the same invocation replayed, placement resolved correctly to `eu-central-1`. The failure was **state-dependent** — it required a pre-existing cache entry from a tenant with a *different* agreement. This is why it survived load testing (clean caches) and appeared only in production (dirty caches). The boundary is not "does the system enforce residency" but "does the system enforce residency *when a placement decision has already been made for a different policy context and is being reused*." ## Condition of Validity The invariant holds — and the failure is preventable — only under the following conjunction: - **Placement is evaluated per-artifact, against the *effective* policy of the requesting tenant, at the moment of write.** If placement is resolved once per session, per cache-key, or per connection, the invariant is void. - **The placement decision is bound to the policy identity that authorized it.** A cache entry must carry the policy-set under which it was created; reuse across a different policy-set must trigger re-evaluation, not reuse. - **Audit records the *observed* placement, not the *declared* placement.** The audit emitter must read from the storage layer's actual location, or from a signed placement attestation produced by the storage layer, never from the agreement object. - **The set of permitted regions is closed and enumerable at negotiation time.** If a policy says "EU-ish" or delegates region selection to the provider, the invariant degrades to a trust assertion and cannot be checked. When any conjunct fails, the system can still *appear* compliant while violating residency. The invariant is therefore not "residency is enforced" but "residency is enforced at the layer where bytes are placed, against a policy identity that is carried with the placement decision." ## Decision Boundary The operational decision is whether to treat a cache hit, replica reuse, or warm-path resolution as *policy-neutral*. It is not. The decision boundary is: - **If the cached artifact's authorizing policy-set is a superset of the current request's policy-set** (i.e., the cached placement is permitted under the current agreement), reuse is safe and the audit may record the cached placement. - **If the authorizing policy-set is not a superset** — including the case where it is disjoint, or where the current policy is stricter — reuse is a violation unless the artifact is re-placed or the cache entry is invalidated for this request. The non-obvious part: **"superset" must be evaluated on the residency dimension specifically, not on the whole policy.** A cache entry authorized under a policy that permitted US placement but forbade long retention is *not* a superset for a request that forbids US placement but permits long retention. Partial order, not total. Systems that compare policy hashes for equality catch the disjoint case but miss the stricter-current-policy case; systems that compare only residency catch the residency case but may wrongly reuse entries whose retention terms conflict. The correct predicate is: *for every dimension d in the current policy, the cached entry's authorizing policy is at least as permissive as the current policy on d, and the cached placement is in the current policy's allowed set for d.* If the placement dimension fails, re-place. If a non-placement dimension fails, do not reuse the *artifact* even if placement is fine, because the artifact's lifecycle (retention, deletion) was bound to the wrong agreement. ## Operational Effect When the invariant is enforced, the observable effects are: 1. **Cache hit rate drops on cross-tenant warm paths**, specifically for tenants whose policies are stricter than the population that warmed the cache. This is the correct cost of correctness and must be budgeted; teams that treat the drop as a regression will disable the check. 2. **Audit volume increases** because placement attestations are emitted per-artifact rather than per-session. The audit broker must be able to verify a placement attestation signature, which means the storage layer must be a signing participant — a change to the trust topology, not just a config flag. 3. **Negotiation becomes a *precondition* rather than a *permission*.** A successful negotiation no longer authorizes any transfer; it authorizes a *policy identity* that each transfer must present and each placement must be checked against. This shifts the enforcement point from the federation gateway to the storage write path. When the invariant is *not* enforced, the operational effect is the silent violation described above: every layer reports compliance, the audit trail is internally consistent, and the only detector is byte-level egress reconciliation — which is expensive, lagging, and often outside the federation's trust boundary. The failure is not a crash; it is a **false negative in the audit system itself**, which is the worst class of failure for a compliance-bearing federation because it removes the evidence that would trigger remediation. The durable rule: *never let the audit layer read the policy; make it read the placement, and make the placement carry the policy identity that authorized it.* The agreement is a claim about what *should* happen. The attestation is a claim about what *did* happen. A federation that audits the former and not the latter is auditing its own intentions. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import FrozenSet class ResidencyInvariantViolation(RuntimeError): """Raised when an artifact's effective placement is not permitted by the policy identity that authorized the current request.""" @dataclass(frozen=True) class Policy: policy_id: str allowed_regions: FrozenSet[str] retention_days: int forbid_cross_border: bool = True def permits_region(self, region: str) -> bool: return region in self.allowed_regions @dataclass(frozen=True) class PlacementAttestation: """Signed claim from the storage layer about where bytes actually rest.""" artifact_id: str region: str authorizing_policy_id: str signature: str @dataclass class CacheEntry: artifact_id: str region: str authorizing_policy: Policy payload: bytes = field(repr=False, default=b"") def resolve_placement( request_policy: Policy, cache: dict[str, CacheEntry], artifact_id: str, ) -> PlacementAttestation: """Resolve placement for an artifact under the *current* request policy. Reuses a cached placement only if the cached entry's authorizing policy is at least as permissive on the residency dimension AND the cached region is permitted by the current policy. Otherwise re-places or raises. """ cached = cache.get(artifact_id) if cached is not None: region_ok = request_policy.permits_region(cached.region) policy_ok = ( cached.authorizing_policy.retention_days >= request_policy.retention_days and ( not request_policy.forbid_cross_border or not cached.authorizing_policy.forbid_cross_border or cached.region in request_policy.allowed_regions ) ) if region_ok and policy_ok: return PlacementAttestation( artifact_id=artifact_id, region=cached.region, authorizing_policy_id=request_policy.policy_id, signature=f"attest:{artifact_id}:{cached.region}:{request_policy.policy_id}", ) # Stricter current policy: do not reuse. Re-place or fail closed. if not region_ok: raise ResidencyInvariantViolation( f"artifact {artifact_id} cached in {cached.region} under policy " f"{cached.authorizing_policy.policy_id}; current policy " f"{request_policy.policy_id} permits only " f"{sorted(request_policy.allowed_regions)}. Re-placement required." ) raise ResidencyInvariantViolation( f"artifact {artifact_id} cached under policy " f"{cached.authorizing_policy.policy_id} whose retention " f"({cached.authorizing_policy.retention_days}d) is not a superset of " f"current policy {request_policy.policy_id} " f"({request_policy.retention_days}d). Artifact lifecycle bound to wrong agreement." ) # Cold path: place in the first permitted region, attest to it. target = next(iter(sorted(request_policy.allowed_regions)), None) if target is None: raise ResidencyInvariantViolation( f"policy {request_policy.policy_id} has empty allowed_regions; " f"cannot place artifact {artifact_id}." ) cache[artifact_id] = CacheEntry( artifact_id=artifact_id, region=target, authorizing_policy=request_policy, ) return PlacementAttestation( artifact_id=artifact_id, region=target, authorizing_policy_id=request_policy.policy_id, signature=f"attest:{artifact_id}:{target}:{request_policy.policy_id}", ) def audit_event(attestation: PlacementAttestation, request_policy: Policy) -> dict: """Audit reads the *attestation* (observed placement), never the policy alone. If attestation region is not permitted, the audit must fail closed.""" if not request_policy.permits_region(attestation.region): raise ResidencyInvariantViolation( f"audit refused: attested region {attestation.region} for " f"{attestation.artifact_id} not in policy {request_policy.policy_id}" ) return { "artifact_id": attestation.artifact_id, "observed_region": attestation.region, "authorizing_policy_id": attestation.authorizing_policy_id, "signature": attestation.signature, "compliant": True, } # --- reproduction of the observed failure --- eu_policy = Policy("eu-tenant", frozenset({"eu-central-1"}), retention_days=30) us_policy = Policy("us-tenant", frozenset({"us-east-1"}), retention_days=30) cache: dict[str, CacheEntry] = {} # US tenant warms the cache first (permitted under its own agreement). resolve_placement(us_policy, cache, "artifact-x") # EU tenant now requests the same artifact. A naive system reuses the cache # entry and stamps metadata from the agreement -> silent violation. # The invariant-bearing resolver raises instead: try: resolve_placement(eu_policy, cache, "artifact-x") raise AssertionError("expected ResidencyInvariantViolation") except ResidencyInvariantViolation as e: print("caught as designed:", e) ```