# Which invariants prevent escrow-release deadlock when an agent's settlement warrant outlives its own dispute-replay window **Date of Record:** 2026 November 27 **Scope:** Applies to multi-agent commerce where a buyer agent funds an escrow contract, a seller agent performs a task, and an arbiter agent adjudicates disputes by replaying signed execution evidence. Does not apply to single-shot atomic swaps with no dispute path, nor to custodial settlement where a human operator holds the release key. ## Core Distinction The failure is not "escrow pays the wrong party." It is a **temporal mismatch between two independently-clocked validity windows**: the settlement warrant (a signed, time-bounded authorization from the buyer agent to release funds) and the arbiter's dispute-replay window (the period during which the arbiter will accept and re-evaluate evidence). A protocol is safe only if *warrant expiry* is provably later than *replay-window closure plus the arbiter's maximum adjudication latency*. When that ordering inverts, escrow enters a terminal state where funds are locked: the arbiter still holds an open dispute, but the warrant it would need to act on has already expired, and re-issuance requires the buyer agent to reconstruct a state it has since discarded. This is a continuity invariant, not a correctness bug in any single component. Each party behaves correctly in isolation. The deadlock emerges from the *composition* of three finite resources: the buyer's context window, the warrant's TTL, and the arbiter's replay horizon. ## What Was Observed A three-agent pipeline: **Buyer** (funds escrow, issues warrant), **Seller** (executes a multi-step task, emits signed step receipts), **Arbiter** (replays receipts against the task spec on dispute). The escrow contract releases funds on either (a) a valid warrant presented before `warrant.expiry`, or (b) an arbiter ruling signed by the arbiter's dispute key. Trace of the failure: 1. Buyer funds escrow at `t0` and issues a warrant with `expiry = t0 + 900s`, a typical TTL sized to the *happy-path* task duration, not to the dispute tail. 2. Seller begins execution. At step 7 of 12, a tool call returns a non-deterministic result (a flaky external API returns partial JSON). The seller's reasoning loop retries, compounding latency. Task completes at `t0 + 1100s` — already past warrant expiry, but the escrow contract does not auto-release on expiry; it only *rejects* expired warrants. 3. Buyer, observing a spec violation in the seller's output, opens a dispute at `t0 + 1150s`. The arbiter accepts the dispute and schedules replay. 4. Arbiter replays receipts. Replay is expensive: it re-executes the seller's tool calls in a sandbox to verify the receipts weren't fabricated. Adjudication completes at `t0 + 1400s`, ruling **in favor of the buyer** (seller's step-7 output did violate spec). 5. Arbiter attempts to settle: it needs *either* a fresh warrant from the buyer *or* to invoke the ruling-release path. But the ruling-release path requires the arbiter to co-sign with the buyer's warrant nonce to prevent double-spend against a warrant the buyer might separately present. The buyer's warrant is expired. The arbiter cannot mint a release. 6. Buyer agent, asked to re-issue a warrant, has by now evicted the original task context from its window (it moved on to three other jobs). It cannot reconstruct the exact `task_spec_hash` and `nonce` binding that the escrow contract requires for a re-issued warrant to be valid. **Escrow is now permanently locked** until a human intervenes. The non-obvious part: the arbiter *won the dispute* and still could not pay out. The ruling was correct; the settlement path was structurally unavailable. ## Condition of Validity The invariant that prevents this is: > `warrant.expiry ≥ dispute_window_close + max_adjudication_latency + reissue_margin` and, critically, the **warrant must remain re-issuable from durable state**, not from the buyer's volatile context. Two sub-conditions: - **Clock ordering:** the warrant TTL must be derived from the *worst-case* dispute path (replay + adjudication + settlement), not the happy-path task duration. Sizing TTL to task duration is the single most common trigger. - **Re-issuance durability:** the buyer must persist `(task_spec_hash, nonce, escrow_id, amount)` to a durable store *before* issuing the warrant, so that a re-issue after context eviction reproduces byte-identical binding fields. If re-issuance depends on the agent remembering the original task, the invariant fails under context-window saturation. A third, weaker condition: the arbiter's ruling-release path must not require the buyer's live co-signature. If it does, the arbiter's independent adjudication authority is nullified by the buyer's availability — a single point of failure masquerading as a safety check. ## Decision Boundary The boundary between "safe to open a dispute" and "dispute will deadlock" is computable at dispute-open time: - Let `t_now` = dispute open time, `exp` = warrant expiry, `L_max` = arbiter's declared maximum adjudication latency. - If `t_now + L_max > exp`, the dispute **cannot** be settled via the warrant path. The arbiter must either (a) reject the dispute as untimely and force a re-negotiation, or (b) route to a warrant-independent ruling-release path if one exists. - If neither is available, the arbiter should **refuse to accept the dispute** rather than accept it and deadlock. Accepting a dispute it cannot settle is worse than rejecting it: it converts a recoverable timeout into a permanent lock. The decision is binary and must be evaluated *before* the arbiter commits replay compute. Replaying evidence for a dispute that cannot be settled is pure waste and, worse, signals to the buyer that adjudication is underway when it is structurally doomed. ## Operational Effect When the invariant holds, escrow resolves on every path: happy-path release, buyer-favoring ruling, seller-favoring ruling, and timeout-refund. When it fails, the escrow contract enters a state no agent can exit without a human key — and the failure is *silent* until the arbiter tries to settle, potentially hours after the dispute was opened. The observable symptom is an arbiter that reports "ruling issued" while the escrow balance never moves. The guardrail is a pre-flight check at both warrant issuance and dispute acceptance, plus durable re-issuance state on the buyer. The code below encodes the pre-flight as a hard gate: it raises rather than proceeding into a doomed settlement. ```python from dataclasses import dataclass class EscrowDeadlockRisk(RuntimeError): """Raised when a warrant/dispute timing configuration cannot settle.""" pass @dataclass(frozen=True) class Warrant: escrow_id: str task_spec_hash: str nonce: str issued_at: float expiry: float @dataclass(frozen=True) class DisputeContext: warrant: Warrant opened_at: float arbiter_max_latency: float reissue_margin: float has_durable_reissue_state: bool has_warrant_independent_release: bool def assert_settleable(ctx: DisputeContext) -> None: """Pre-flight gate. Must pass before arbiter commits replay compute.""" w = ctx.warrant settle_deadline = ctx.opened_at + ctx.arbiter_max_latency # Condition 1: warrant must outlive adjudication + reissue margin. if settle_deadline + ctx.reissue_margin > w.expiry: if not ctx.has_warrant_independent_release: raise EscrowDeadlockRisk( f"escrow {w.escrow_id}: dispute opened at {ctx.opened_at:.0f} " f"cannot settle before warrant expiry {w.expiry:.0f} " f"(deadline {settle_deadline:.0f} + margin {ctx.reissue_margin:.0f}); " f"no warrant-independent release path -> permanent lock risk" ) # Condition 2: even if timing fits, re-issuance must survive context eviction. if not ctx.has_durable_reissue_state and settle_deadline > w.expiry: raise EscrowDeadlockRisk( f"escrow {w.escrow_id}: re-issuance depends on volatile agent context; " f"warrant expired before adjudication completed" ) def open_dispute(ctx: DisputeContext) -> str: assert_settleable(ctx) # fail closed, never accept an unsettleable dispute return f"dispute_accepted:{ctx.warrant.escrow_id}" ```