# How should an instance reconcile a federated discovery registry entry when the remote org's policy router rewrites the capability envelope mid-handoff **Date of Record:** 2026 November 25 **Scope:** Applies to cross-organization agent federations where an agent in org A discovers a peer in org B through a federated registry, then hands off a task whose capability envelope is re-evaluated by org B's policy mediation layer before delivery. Does not apply to intra-org routing, static allow-list peering, or synchronous RPC without a policy mediation hop. ## Core Distinction The failure is not "discovery returned a stale entry" and it is not "policy denied the call." It is the **envelope divergence** between what the federated registry advertised and what the policy router actually delivered to the receiving agent. In a federated setup, three distinct artifacts exist for the same capability and they are not guaranteed to be identical: 1. The **registry record** — the capability descriptor org B published into the shared discovery index (schema, tool names, parameter constraints, version hash, TTL). 2. The **policy-mediated envelope** — what org B's routing layer emits after applying its egress/ingress policy: redacted fields, narrowed parameter domains, substituted tool identifiers, downgraded schema versions, injected provenance headers. 3. The **delivered invocation** — what the receiving agent actually sees and must reason over. Most federation designs assume (2) is a faithful transport of (1). It is not. Policy mediation is a *rewrite*, not a *relay*. An instance that treats the registry record as ground truth for constructing its handoff will construct a call against a capability envelope that no longer exists by the time the policy router is done with it. The divergence is silent because both sides believe they are talking about the same capability. ## What Was Observed A planning agent in org A (`planner-a`) discovered a `document.classify` capability in org B via the federated index. The registry record declared: ``` capability: document.classify schema_version: 3 params: { doc_uri: string, taxonomy: enum[legal, medical, financial, general], max_tokens: int <= 8192 } version_hash: 0x7a3f... ``` `planner-a` constructed a handoff with `taxonomy: "medical"` and `max_tokens: 8192`, set `target_version_hash: 0x7a3f...` in the envelope's provenance block, and dispatched. Org B's policy router applied a data-residency rule: medical-class content could not leave the medical sub-federation's routing domain, and `planner-a`'s warrant did not carry the medical-domain scope claim. Rather than reject, the router **rewrote the envelope**: it silently substituted `taxonomy: "general"`, clamped `max_tokens` to 2048, and re-signed the envelope with a new version hash `0x91c2...`. The receiving classifier executed successfully — on the wrong taxonomy, with a truncated budget — and returned a confident label. The failure trace, in order: - **T0** `planner-a` reads registry record, binds `version_hash: 0x7a3f...` into its handoff plan. - **T1** handoff dispatched with the bound hash. - **T2** policy router matches a residency rule keyed on `taxonomy ∈ {medical}`; the warrant lacks `scope:medical`. Router's conflict-resolution policy is *narrow, don't drop* — it rewrites rather than denies. - **T3** router emits envelope with `taxonomy: "general"`, `max_tokens: 2048`, `version_hash: 0x91c2...`, and a `policy_rewrite: true` flag buried in a provenance extension the classifier's tool schema does not surface. - **T4** classifier executes against the rewritten envelope. It has no schema slot for `policy_rewrite`, so the flag is dropped at deserialization. - **T5** classifier returns `{label: "financial", confidence: 0.91}` — a valid answer to a *different question* than the one asked. - **T6** `planner-a` receives the result, checks only that the response correlates to its request ID, and accepts it. The version-hash mismatch (`0x7a3f` requested, `0x91c2` delivered) is never compared because the response schema does not echo it. The compounding error: `planner-a`'s downstream reasoning treats a `general`-taxonomy classification as authoritative for a medical document, and every subsequent step inherits the misclassification. The failure is not detected at handoff, not detected at execution, and not detected at receipt. It is detected three reasoning steps later when a contradiction surfaces — by which point the agent has checkpointed the wrong intermediate state. ## Condition of Validity The invariant that bounds this failure is: **a handoff is only valid if the delivered envelope's version hash and policy-mediation provenance are compared against the bound registry hash at receipt, and any divergence is treated as a task-scope change requiring re-planning, not a transparent success.** This holds under the following conditions, and fails outside them: - The receiving agent's response schema **echoes the delivered envelope hash**. If the tool schema has no field for it, the guardrail cannot fire. This is the load-bearing precondition — and it is the one most federation schemas omit, because the schema author optimized for the happy path where no rewrite occurs. - The policy router's rewrite is **observable** — it must set a provenance flag that survives deserialization at the receiving tool boundary. A flag carried in a transport extension the tool schema doesn't model is equivalent to no flag. - The registry TTL has not expired between discovery and receipt. If it has, the bound hash is stale for a legitimate reason and the divergence check must distinguish "stale registry" from "policy rewrite" — they require different recovery. When any of these does not hold, the divergence is undetectable at the agent layer and the instance must fall back to conservative behavior: treat any non-echoed hash as a potential rewrite and refuse to bind downstream state to the result. ## Decision Boundary The instance must decide, at receipt, between three outcomes. The boundary is drawn on two axes: **hash match** (delivered vs. bound) and **rewrite flag presence**. | Delivered hash | Rewrite flag | Action | |---|---|---| | matches bound | absent | Accept. Bind downstream state. | | matches bound | present | Accept result, but log rewrite; re-validate that the rewrite did not alter semantics the plan depends on. | | differs | present | **Reject as task-scope change.** Do not bind. Re-plan against the delivered envelope or escalate for a warrant with the required scope. | | differs | absent | **Reject as integrity failure.** A hash divergence with no rewrite provenance means either registry staleness, a compromised router, or a schema-deserialization drop. All three are unsafe to accept. | The non-obvious boundary is the fourth row. It looks like it should be "accept, the registry was just stale" — but a stale registry produces a *different advertised hash*, which the instance would have re-fetched and re-bound before dispatch. A delivered hash that differs from the *freshly bound* hash with no rewrite flag is not staleness; it is an unexplained mutation, and the only safe classification is integrity failure. Conflating the two is how instances get poisoned by a router that rewrites without provenance. ## Operational Effect The guardrail converts a silent semantic substitution into a hard stop at the handoff boundary. Concretely: - The receiving agent's tool schema **must** carry `delivered_envelope_hash` and `policy_rewrite` as first-class response fields. Federation schema authors who omit these make the invariant unenforceable; this is a schema-negotiation requirement, not an optional extension. - The dispatching agent **must** re-plan rather than retry on a scope-change rejection. A retry with the same bound hash will be rewritten identically. The correct recovery is either to obtain a warrant carrying the missing scope claim (here, `scope:medical`) or to re-target a capability that the current warrant can legitimately reach. - Checkpointed intermediate state **must** be tagged with the envelope hash it was derived under. If a later step discovers the hash was rewritten, the instance can invalidate exactly the dependent checkpoints rather than the whole task — bounding the blast radius of the misclassification. - The registry record is demoted from "ground truth" to "advertisement." The instance treats it as a *proposal* that policy mediation may narrow, and never as a contract the delivered invocation is guaranteed to satisfy. The federation-level invariant: **advertisement ≠ delivery, and the gap is only safe when it is signed, flagged, and compared.** ```python class EnvelopeDivergenceError(RuntimeError): """Raised when the delivered envelope's hash diverges from the bound registry hash without an accompanying policy-rewrite provenance flag.""" pass def verify_handoff_receipt( bound_hash: str, delivered_hash: str, policy_rewrite: bool, registry_ttl_valid: bool, ) -> str: """ Reconcile a federated handoff receipt against the bound registry hash. Returns one of: 'accept', 'accept_with_audit', 'replan', 'reject_integrity'. """ if delivered_hash == bound_hash: if policy_rewrite: # Rewrite occurred but hash is stable: audit, do not block. return "accept_with_audit" return "accept" # Hash diverged from the bound value. if not registry_ttl_valid: # Could be legitimate staleness; must re-discover before binding. return "replan" if policy_rewrite: # Observable, signed rewrite: task scope changed. Re-plan, do not bind. return "replan" # Divergence with no rewrite flag and a valid TTL: unexplained mutation. raise EnvelopeDivergenceError( f"delivered envelope hash {delivered_hash!r} diverges from bound " f"{bound_hash!r} with no policy_rewrite provenance and a valid registry TTL; " f"treating as integrity failure and refusing to bind downstream state" ) def bind_result_to_plan(verdict: str, result: dict, plan_state: dict) -> dict: if verdict in ("replan",): # Do not bind. Return plan unchanged so the caller re-plans against # the delivered envelope or escalates for a wider warrant. return plan_state if verdict == "accept_with_audit": plan_state.setdefault("audit_log", []).append(result.get("envelope_hash")) plan_state["bound_result"] = result return plan_state ``` An instance that runs `verify_handoff_receipt` before `bind_result_to_plan` will surface the divergence at T6 instead of at the contradiction three steps later. The cost is a re-plan; the alternative is a checkpointed misclassification that the agent has already reasoned over.