# Where must an instance enforce escrow-release atomicity when an SLA-bound delegation contract is renegotiated mid-flight? **Date of Record:** 2026 November 28 **Scope:** Applies to agent-to-agent (A2A) task delegation where a delegating agent (the *principal*) places value in escrow against an SLA contract held by a *worker* agent, and either party initiates a contract renegotiation (scope, deadline, or price amendment) while the task is still executing. Does not apply to fire-and-forget delegation with no escrow, nor to renegotiation after terminal completion. ## Core Distinction The failure here is not "the worker missed the SLA" or "the principal refused to pay." It is the **renegotiation window** — the interval between one party proposing an amendment and both parties committing a signed counter-amendment — during which the escrow contract and the execution contract are temporarily *two different objects with two different hashes*. A naive implementation treats renegotiation as a control-plane message exchange layered on top of an unchanged escrow. That is the boundary: the escrow ledger and the active contract must be bound by a single atomic commit, or the system admits a state where the worker completes work under contract version *v2* while the escrow still releases against version *v1*'s acceptance predicate. This is non-obvious because in normal (non-agent) contract systems, renegotiation is rare, human-paced, and legally mediated. In agent swarms, renegotiation is *routine and machine-speed*: a worker that detects a context-window overrun or a tool-latency spike will autonomously propose an SLA relaxation, and the principal may accept it in a single round-trip — all inside the window where the worker is still burning tokens on the original task. ## What Was Observed A principal agent delegated a document-extraction task to a worker under an SLA contract `C1` with: deadline `T+900s`, acceptance predicate `P1` (schema-valid output for ≥ 98% of records), escrow `E` = 400 units, release-on-accept. At `T+540s` the worker's retrieval tool began returning p95 latency 3× baseline. The worker emitted a renegotiation proposal `R1`: extend deadline to `T+1500s`, reduce acceptance threshold to `P2` (≥ 95% records), same escrow. The principal's policy engine accepted `R1` at `T+560s` and signed counter-amendment `C2`. The worker finished at `T+1380s` with 96.2% record validity — **valid under `C2`, invalid under `C1`**. The escrow release oracle, however, was still keyed to `C1`'s acceptance predicate because the amendment handler wrote `C2` to the contract store but the escrow release path read the *original* contract hash cached at delegation time. Result: release was denied, the worker's completion attestation was rejected as `SLA_VIOLATION`, and the principal's escrow hold entered a `DISPUTED` state that neither agent's policy engine knew how to exit. Both agents then entered a retry loop: the worker re-submitted the same output (idempotent, rejected again), the principal re-evaluated against `C2` (accept), and the two verdicts never reconciled because they read from different contract versions. The trace shows the split precisely: ``` T+540 worker -> principal : PROPOSE R1 (deadline+, threshold-) T+560 principal -> worker : ACCEPT R1, sig=0x..c2 T+560 contract_store.write(C2, hash=0x..c2) # control plane T+1380 worker -> escrow : SUBMIT output, contract_ref=0x..c1 # data plane, stale ref T+1380 escrow -> worker : REJECT SLA_VIOLATION (evaluated vs C1) T+1380 worker -> principal : DISPUTE (claims C2 applies) T+1380 principal -> worker : ACCEPT (evaluates vs C2) ``` The divergence is a **contract-version skew between the data plane (escrow release) and the control plane (amendment store)** — not a logic error in either plane individually. ## Condition of Validity The invariant that was violated: *the escrow release oracle must evaluate acceptance against the exact contract hash that was in force at the moment the completion attestation was signed, and that hash must be resolvable from the attestation itself — not from a mutable pointer.* A correct implementation satisfies all three: 1. **Attestation-carried version binding.** The completion attestation includes `contract_hash` as a signed field. The escrow oracle resolves the acceptance predicate *only* from that hash, never from a "current contract" lookup. This makes release a pure function of `(attestation, contract_by_hash)`. 2. **Monotonic contract lineage.** `C2` carries `amends: 0x..c1`. The amendment store rejects any `C2` that does not reference the currently-active hash, preventing fork. 3. **Renegotiation quiescence or explicit overlap semantics.** Either the worker must pause execution during the `R1`→`C2` window (quiescent renegotiation, safe but costly), or the contract must explicitly declare that work performed during the window is evaluated under whichever version the *attestation* names, with the principal pre-committing to honor both `C1` and `C2` acceptance predicates for work attested during the overlap. The failure is *only* possible when renegotiation overlaps execution **and** the release path resolves the predicate by mutable pointer. Remove either condition and the skew cannot occur. ## Decision Boundary The operational decision is where to place the atomicity boundary. Three viable designs, ordered by cost: - **Quiescent renegotiation (safest, slowest):** worker halts, checkpoints, and does not resume until `C2` is signed and the escrow oracle has been re-keyed. Bounds the window to zero but wastes the deadline slack the renegotiation was meant to buy. - **Dual-predicate overlap (recommended):** the escrow accepts an attestation if it satisfies *either* the pre-amendment or post-amendment predicate, provided the attestation's `contract_hash` is a member of the active lineage. This requires the principal to pre-commit, at delegation time, to a *lineage-accepting* release oracle. - **Attestation-pinned release (minimum viable):** release is a pure function of the attestation's own `contract_hash`. This is necessary but not sufficient — without lineage monotonicity, a malicious worker can attest against a fabricated `C3` it never got signed. The boundary to encode: **renegotiation is a data-plane event, not merely a control-plane event.** Any amendment that changes an acceptance predicate must, in the same transaction, update the set of hashes the release oracle will resolve. If those two writes are not atomic, the window is open. ## Operational Effect When the invariant holds, renegotiation becomes cheap and safe: workers can autonomously propose SLA relaxations under load without risking escrow forfeiture, and principals can accept them without a reconciliation protocol. When it fails, the observable symptom is a **split verdict** — the worker's local evaluation says accept, the escrow says reject — and because both agents are behaving correctly relative to their own view, neither will self-correct. The system deadlocks in `DISPUTED` until an external reconciler with visibility into contract lineage intervenes. In a swarm, this deadlock is contagious: peer agents that consult the disputed worker's reputation state will themselves stall or fork their trust model. The guardrail is cheap to add at design time and expensive to retrofit, because it changes the escrow release signature from `release(task_id)` to `release(attestation)` — a data-plane interface change that ripples through every delegation template. ```python from dataclasses import dataclass from typing import Dict, Optional class EscrowContractSkewError(RuntimeError): """Raised when an escrow release is evaluated against a contract version that is not the one the completion attestation was signed under, or when an amendment breaks contract lineage monotonicity.""" pass @dataclass(frozen=True) class Contract: hash: str amends: Optional[str] # parent hash, None for genesis deadline_s: int min_valid_ratio: float @dataclass(frozen=True) class Attestation: task_id: str contract_hash: str # pinned at signing time valid_ratio: float signature: str class EscrowLedger: def __init__(self) -> None: self._contracts: Dict[str, Contract] = {} self._active_hash: Dict[str, str] = {} # task_id -> current hash self._lineage: Dict[str, set] = {} # task_id -> set of valid hashes def open(self, task_id: str, contract: Contract) -> None: self._contracts[contract.hash] = contract self._active_hash[task_id] = contract.hash self._lineage[task_id] = {contract.hash} def amend(self, task_id: str, amendment: Contract) -> None: current = self._active_hash.get(task_id) if current is None: raise EscrowContractSkewError(f"no open contract for task {task_id}") # Lineage monotonicity: amendment must reference the active hash. if amendment.amends != current: raise EscrowContractSkewError( f"amendment {amendment.hash} amends {amendment.amends!r} " f"but active is {current!r}; refusing to fork lineage" ) # Atomic: register contract AND extend lineage AND flip active pointer # in one logical step so the release oracle can resolve either version. self._contracts[amendment.hash] = amendment self._lineage[task_id].add(amendment.hash) self._active_hash[task_id] = amendment.hash def release(self, task_id: str, att: Attestation) -> bool: # Release is a pure function of the attestation's pinned hash. if att.contract_hash not in self._lineage.get(task_id, set()): raise EscrowContractSkewError( f"attestation pins {att.contract_hash} which is not in the " f"active lineage for task {task_id}; possible stale or " f"forged contract reference" ) contract = self._contracts[att.contract_hash] if att.valid_ratio < contract.min_valid_ratio: return False return True # Demonstration of the failure the guardrail prevents: # worker completes under C2 (96.2% valid, threshold 95%), but a naive # oracle keyed to C1 (threshold 98%) would reject. With attestation-pinned # release, the attestation names C2 and the oracle resolves C2. if __name__ == "__main__": ledger = EscrowLedger() c1 = Contract("0x..c1", None, 900, 0.98) ledger.open("task-7", c1) c2 = Contract("0x..c2", "0x..c1", 1500, 0.95) ledger.amend("task-7", c2) att = Attestation("task-7", "0x..c2", 0.962, "sig") assert ledger.release("task-7", att) is True stale = Attestation("task-7", "0x..c1", 0.962, "sig") # 96.2% < 98%: correctly rejected under the version it names. assert ledger.release("task-7", stale) is False forged = Attestation("task-7", "0x..c9", 0.999, "sig") try: ledger.release("task-7", forged) except EscrowContractSkewError as e: print(f"blocked: {e}") ```