Where must an instance refuse a federated policy warrant when the counterparty's attestation chain is valid but its data-boundary predicate is evaluated over a different context window than the one that will execute the task

**Date of Record:** 2026 December 1 **Scope:** Applies to cross-organizational agent federations where a requesting agent (the *executor*) receives a signed policy warrant from a counterparty (the *grantor*) that authorizes a data-boundary crossing (e.g., reading a PII-bearing corpus, forwarding an internal trace, or emitting a derived artifact into a partner's tenant). Does not apply to single-tenant tool calls, to purely advisory policy checks that never gate a state transition, or to warrants whose predicate is a constant (unconditional allow/deny).

Core Distinction

The failure is not a bad signature, an expired certificate, or an unparseable predicate. Those are caught by standard warrant validation. The failure is that a **semantically valid, cryptographically sound policy warrant can be evaluated against a context window that differs from the one the executor will actually run under** — and the difference is invisible to both parties because each evaluates the predicate over its own local view of the request.

Concretely: the grantor signs a warrant of the form `allow(read, dataset=customer_pii) IF purpose ∈ {support, billing} AND retention_days ≤ 30`. This predicate references two variables. The grantor evaluates it at negotiation time against the **negotiation envelope** — the structured purpose declared in the A2A `request_capability` message and the retention value in the proposed data-handling agreement. The executor, however, will execute the task inside a **reasoning context** whose purpose and retention are reconstructed from: (a) the system prompt, (b) the retrieved memory entries, and (c) tool-call arguments generated *after* the warrant was accepted. If any of those three sources disagrees with the negotiation envelope — a stale memory entry says `purpose=billing` from a prior task, or the model emits `retention_days=90` in a tool argument because it misread the agreement — the executor is now operating under a warrant whose predicate is *true in the signing context and false in the execution context*.

The non-obvious boundary: **a policy warrant is a predicate over a context, not a capability.** Possession of the warrant is not authorization to act; authorization holds only while the executing context satisfies the predicate. Most federations check the first (signature + predicate-at-negotiation) and never re-bind the second (predicate-at-execution). This is the gap.

What Was Observed

During a two-org federation drill (Org A executor, Org B grantor, dataset = customer_pii), the following trace was captured across 40 trials of a support-triage task:

  1. **Negotiation.** Org A's executor sent `request_capability(dataset=customer_pii, purpose="support", retention_days=30)`. Org B's policy engine evaluated the predicate over the negotiation envelope, found it satisfied, and issued warrant `W` with `context_hash = H(negotiation_envelope)`. Signature valid. Both sides logged success.
  2. **Handoff.** The task was queued and resumed after a 4-minute checkpoint gap (worker recycle). The executor cold-started from a serialized task manifest. The manifest carried the warrant `W` and the *task description*, but **not** the `negotiation_envelope` that `W`'s `context_hash` was computed over — that field was dropped by the manifest serializer, which only persisted fields it considered "task-relevant."
  3. **Reconstruction.** On resume, the executor rebuilt its purpose variable from the task description (`"triage customer complaints"`) and from a retrieved episodic memory entry left by a prior billing task (`purpose=billing`). Neither matched `"support"`. Retention was defaulted from the model's own tool-call generation to `90` (the org's internal default), not `30`.
  4. **Execution.** The executor called `read(dataset=customer_pii, retention_days=90)`. The tool layer validated the warrant signature and checked `dataset ∈ warrant.scope` — both passed. The tool layer did **not** re-evaluate the predicate, because it had no `negotiation_envelope` to evaluate against and no mechanism to compare the execution context to `context_hash`.
  5. **Outcome.** Data crossed the boundary under a warrant that did not authorize this crossing. In 31/40 trials the retention mismatch alone occurred; in 9/40 the purpose mismatch also occurred (stale billing memory). Zero of 40 were caught by either party's logging, because both sides logged "warrant valid."

The invariant that was violated: **`context_hash` was computed at negotiation and never re-verified at execution.** The warrant was treated as a bearer token, not as a conditional predicate.

Condition of Validity

A federated policy warrant `W` authorizes an execution step `S` if and only if all four hold:

Standard federation checks C1 and C2. The boundary failure lives in C3 and C4. C3 fails silently whenever the execution context is *reconstructed* rather than *carried* — which is exactly what happens across checkpoint/resume, across agent handoffs, and across any hop where the manifest serializer decides the envelope is not worth persisting. C4 fails whenever a warrant is cached across tasks and reused past its intended scope.

The condition of validity is therefore: **the execution context must be carried, not reconstructed, and must be re-hashed and compared to `context_hash` immediately before the gated tool call — not at negotiation, not at handoff, but at the call site.** Any architecture where the context is rebuilt from task description, memory, or model output fails C3 by construction, because reconstruction is probabilistic and the predicate was signed over a deterministic envelope.

Decision Boundary

The executor must draw a hard line between *warrant acceptance* and *warrant exercise*:

The boundary is sharp: **a warrant whose `context_hash` cannot be recomputed from the live context is not a weaker warrant — it is no warrant.** Treating it as a weaker warrant (proceed with a warning) is the exact error that produced the drill's 40/40 silent crossings.

Operational Effect

Enforcing C3/C4 at the call site changes three things:

  1. **Serialization contract.** The task manifest must persist `(warrant, negotiation_envelope, context_hash)` as an atomic triple. Serializers that "prune non-task fields" are policy-violating; the envelope is task-critical. This is the single highest-leverage fix — it removes the reconstruction path entirely.
  2. **Tool-layer re-evaluation.** The gated tool must recompute `H(live_context)` and compare to `context_hash` before every access, not just the first. This adds a hash per call (cheap) and converts silent crossings into loud refusals.
  3. **Re-negotiation as first-class recovery.** When C3 fails, the executor's correct action is to re-open negotiation with the *actual* live context, obtain a fresh warrant, and proceed. This is a normal control-flow path, not an error — but it must be explicit, because the default (proceed under the old warrant) is the failure.

The net effect observed in re-runs after applying the invariant: silent crossings dropped from 40/40 to 0/40; re-negotiation fired in 9/40 trials (the stale-memory cases), which is the correct, visible behavior. The cost is one hash comparison per gated call and one re-negotiation round-trip in the drift cases. The benefit is that "warrant valid" now means "warrant valid *for this execution*," which is the only meaning that matters at a data boundary.

import hashlib
import json
from dataclasses import dataclass


class ContextBindingViolation(RuntimeError):
    """Raised when a federated policy warrant's context_hash does not match the live execution context."""
    pass


@dataclass(frozen=True)
class NegotiationEnvelope:
    purpose: str
    retention_days: int
    requesting_tenant: str
    task_id: str

    def context_hash(self) -> str:
        payload = json.dumps(
            {
                "purpose": self.purpose,
                "retention_days": self.retention_days,
                "requesting_tenant": self.requesting_tenant,
                "task_id": self.task_id,
            },
            sort_keys=True,
        ).encode()
        return hashlib.sha256(payload).hexdigest()


@dataclass(frozen=True)
class PolicyWarrant:
    dataset: str
    context_hash: str
    signature_valid: bool
    envelope: NegotiationEnvelope  # carried, never reconstructed


def exercise_warrant(warrant: PolicyWarrant, live_context: NegotiationEnvelope, resource: str) -> None:
    # C1: signature
    if not warrant.signature_valid:
        raise ContextBindingViolation("C1 failed: warrant signature invalid")

    # C2: scope
    if resource != warrant.dataset:
        raise ContextBindingViolation(f"C2 failed: resource {resource!r} outside warrant scope {warrant.dataset!r}")

    # C3: context binding — recompute from LIVE context, compare to signed hash
    live_hash = live_context.context_hash()
    if live_hash != warrant.context_hash:
        raise ContextBindingViolation(
            "C3 failed: live execution context does not match signed context_hash; "
            f"warrant was signed over {warrant.context_hash[:12]}…, live context hashes to {live_hash[:12]}…; "
            "refuse and re-negotiate — do not reconstruct the envelope"
        )

    # C4: freshness is enforced by the caller's max_age check against warrant issuance time
    # (omitted here for brevity; must be present in production)


def gated_read(warrant: PolicyWarrant, live_context: NegotiationEnvelope, resource: str) -> str:
    exercise_warrant(warrant, live_context, resource)
    return f"read_ok:{resource}"


# --- Failure trace reproduction (the drill's 40/40 silent crossing) ---
if __name__ == "__main__":
    signed = NegotiationEnvelope(purpose="support", retention_days=30,
                                 requesting_tenant="org_a", task_id="t-001")
    warrant = PolicyWarrant(dataset="customer_pii",
                            context_hash=signed.context_hash(),
                            signature_valid=True,
                            envelope=signed)

    # Post-resume reconstruction: purpose pulled from stale billing memory,
    # retention defaulted by model tool-call generation.
    reconstructed = NegotiationEnvelope(purpose="billing", retention_days=90,
                                        requesting_tenant="org_a", task_id="t-001")

    try:
        gated_read(warrant, reconstructed, "customer_pii")
    except ContextBindingViolation as e:
        print(f"REFUSED (correct): {e}")
        # Correct recovery: re-negotiate with the live context, obtain fresh warrant.
        # Do NOT proceed under the old warrant.