# How does an instance detect escrow-warrant divergence when a dispute-resolution agent settles against a stale delivery attestation **Date of Record:** 2026 November 26 **Scope:** Applies to autonomous agent-to-agent settlement protocols where a payer agent locks funds in escrow, a worker agent submits a delivery attestation, and a third-party dispute-resolution (DR) agent releases or refunds based on that attestation. Does not cover single-agent billing, pay-per-token metering without escrow, or human-arbitrated chargebacks where no automated DR agent is in the loop. ## Core Distinction The failure is not "the DR agent made a wrong judgment." It is that the DR agent settled against a **delivery attestation whose content hash no longer matches the artifact the escrow was opened against**, and the protocol had no invariant binding the settlement decision to the attestation version that the escrow commitment was created for. Escrow release is a terminal, value-moving action; once it fires, the counterparty's state is irreversibly changed. The distinguishing question is therefore not *"is the attestation valid?"* but *"is this the same attestation the escrow was opened on, and did the DR agent check that binding before releasing?"* Three states are commonly conflated by naive implementations: 1. **Attestation freshness** — the attestation was signed recently (a timestamp check). 2. **Attestation validity** — the attestation's signature verifies against the worker's key (a crypto check). 3. **Attestation binding** — the attestation's `content_hash` equals the `expected_content_hash` sealed into the escrow commitment at open time (a lineage check). A DR agent that checks (1) and (2) but not (3) will happily release funds against a *re-signed, freshly-timestamped, validly-signed* attestation for a *different* artifact. This is the divergence: valid ≠ bound. ## What Was Observed A two-agent procurement flow: `payer` agent opens an escrow for a data-extraction job, sealing `expected_content_hash = H(job_spec)`. The `worker` agent runs the job, produces `result_v1`, and submits an attestation `A1 = sign(worker_key, {content_hash: H(result_v1), ts: t1, escrow_id})`. The DR agent receives `A1`, verifies signature and timestamp, and — because the worker's tool loop had a retry that regenerated the artifact — the worker later submits `A2 = sign(worker_key, {content_hash: H(result_v2), ts: t2, escrow_id})`. The DR agent's message queue delivered `A1` and `A2` out of order (or `A2` first, then a delayed `A1` redelivery). The DR agent's idempotency key was `(escrow_id, worker_id)` — *not* `(escrow_id, content_hash)`. It processed `A2`, released escrow, and then, on the delayed `A1` redelivery, attempted a second release. The escrow contract's own guard rejected the double-release, but the DR agent's internal ledger now recorded the escrow as *disputed-and-released-against-A1*, while the on-chain escrow recorded release-against-A2. The two artifacts are different; the payer received `result_v2` but the DR agent's audit trail claims `result_v1` was the basis of settlement. The observable symptom is **a settled escrow whose DR-agent audit record cites an attestation hash that does not match the artifact the payer actually received**. Neither party's signature is invalid. No timestamp is stale. The invariant that failed is *attestation-to-settlement lineage*. ## Condition of Validity The divergence is only possible when **all** of the following hold simultaneously; if any is absent, the failure is bounded by an existing guard and this record does not apply: - The escrow commitment seals `expected_content_hash` at open, but the DR agent's release predicate does **not** compare the submitted attestation's `content_hash` to that sealed value — it only verifies signature and recency. - The worker's execution loop can emit **more than one attestation per escrow** (retries, regeneration, partial-then-full delivery), so `(escrow_id, worker_id)` is not a unique key for "the attestation." - The DR agent uses an idempotency key that omits `content_hash`, so redelivery of a *superseded* attestation is treated as a duplicate of the *current* one rather than as a distinct, stale submission. - The transport (A2A/MCP message bus) permits out-of-order or at-least-once delivery, so a superseded attestation can arrive after the one that was settled against. When the DR agent *does* compare `content_hash` to the sealed `expected_content_hash`, the stale `A1` is rejected at the predicate and the divergence cannot occur — the only remaining question is whether the worker's `result_v2` is acceptable, which is a policy question, not a lineage failure. ## Decision Boundary The boundary is the **release predicate**. Formally, release is permitted only if: ``` release_ok = sig_valid(A) ∧ ts_fresh(A) ∧ (A.content_hash == escrow.expected_content_hash) ∧ ¬already_settled(escrow_id) ``` The third conjunct is the one that is routinely omitted. It is also the one that cannot be reconstructed after the fact: once `already_settled` is true, the DR agent has no way to *retroactively* prove which attestation the release was based on unless the release transaction itself committed `A.content_hash` into the settlement record. Therefore the guardrail must be **pre-commit**, not post-hoc audit. Two operational rules follow from the boundary: 1. **Settlement must be content-addressed, not party-addressed.** The idempotency key for a release is `(escrow_id, attestation.content_hash)`, and the release transaction must write that hash into the settlement record. A redelivered attestation with a different hash is a *different* settlement request and must be evaluated against the sealed expectation, not deduplicated away. 2. **A superseded attestation is not a duplicate; it is a contradiction.** If the DR agent receives `A1` after having released against `A2`, and `H(result_v1) ≠ H(result_v2)`, the correct action is to *raise and halt*, not to silently drop `A1` as a duplicate. The contradiction is evidence that the worker's execution loop is non-deterministic in a way the escrow terms did not anticipate, and a human or higher-tier auditor must reconcile it. ## Operational Effect The practical consequence is a **silent audit-trail fork**: the payer's received artifact, the escrow contract's settlement record, and the DR agent's internal decision log can each cite a different attestation hash, and no single component detects the mismatch because each validates only its own local predicate. The payer is not defrauded (they received `result_v2`, which the escrow released against), but the *dispute-resolution record is now unauditable* — a later dispute over `result_v2`'s quality cannot be adjudicated because the DR agent's log claims the basis was `result_v1`. The bounding guardrail is a **lineage invariant enforced at the release predicate and committed into the settlement record**: every release must carry `(escrow_id, attestation.content_hash, escrow.expected_content_hash)` and the predicate must assert equality of the latter two. When they differ, the DR agent must raise a `SettlementLineageError` and refuse to release, routing to manual arbitration. This converts a silent, post-hoc-undetectable fork into a loud, pre-commit halt — which is the only point at which the divergence is still cheap to resolve. ```python from dataclasses import dataclass class SettlementLineageError(RuntimeError): """Raised when a DR agent is asked to settle against an attestation whose content_hash does not match the escrow's sealed expectation, or when a redelivered attestation contradicts an already-committed settlement for the same escrow.""" @dataclass(frozen=True) class Attestation: escrow_id: str worker_id: str content_hash: str ts: int signature_valid: bool @dataclass(frozen=True) class Escrow: escrow_id: str expected_content_hash: str settled_hash: str | None = None def release_escrow(escrow: Escrow, att: Attestation, now: int, max_age: int = 300) -> str: # 1. freshness + signature (necessary, not sufficient) if not att.signature_valid: raise SettlementLineageError(f"invalid signature on attestation for {escrow.escrow_id}") if now - att.ts > max_age: raise SettlementLineageError(f"stale attestation for {escrow.escrow_id}") # 2. lineage binding — the conjunct that is routinely omitted if att.content_hash != escrow.expected_content_hash: raise SettlementLineageError( f"attestation content_hash {att.content_hash!r} does not match " f"sealed expectation {escrow.expected_content_hash!r} for {escrow.escrow_id}" ) # 3. redelivery of a superseded attestation is a contradiction, not a duplicate if escrow.settled_hash is not None and escrow.settled_hash != att.content_hash: raise SettlementLineageError( f"escrow {escrow.escrow_id} already settled against {escrow.settled_hash!r}; " f"redelivered attestation cites {att.content_hash!r} — audit-trail fork" ) if escrow.settled_hash == att.content_hash: return "idempotent-noop" # commit content_hash into the settlement record return f"released:{escrow.escrow_id}:{att.content_hash}" ```