# Which invariants prevent double-settlement across escrow release and SLA credit paths in cross-org agent negotiation **Date of Record:** 2026 November 15 **Scope:** Applies to bilateral or multi-party agent delegation where a buyer agent escrows funds against an SLA contract and a seller agent submits proof-of-completion; covers settlement, SLA-credit, and dispute paths. Does not apply to single-org internal task queues, prepaid non-refundable credits, or streaming per-token metering where no discrete completion event exists. ## Core Distinction The non-obvious boundary is between *release authority* and *credit authority*. In a healthy cross-org negotiation, exactly one party holds the key that moves escrowed value out of the vault, and exactly one party holds the key that mints an SLA credit against the same value. These are usually different agents: the buyer's negotiator authorizes release on proof-of-completion, while the seller's SLA monitor (or a neutral oracle) authorizes a credit when the completion is late or degraded. The failure mode is not that either path is wrong in isolation — each is individually correct — but that both paths can fire on the *same completion event* when the completion is simultaneously "accepted" and "late," producing a settlement where the seller receives the escrow and the buyer receives a credit drawn from that same escrow. The invariant that must hold is **single-attribution**: every unit of escrowed value is attributed to exactly one settlement leg, and the sum of all legs (release + credit + refund) equals the escrowed amount, never exceeds it. ## What Was Observed A buyer agent (Org A) negotiated a 48-hour delivery SLA with a seller agent (Org B). The contract had two independent clauses: (1) on acceptance, release 100% of the 5,000-unit escrow to Org B; (2) on late delivery, Org A is entitled to a 20% SLA credit (1,000 units) drawn from the same escrow. The seller submitted proof-of-completion at hour 49 — one hour late. The buyer's acceptance oracle verified the work and signed a `RELEASE` message. The seller's SLA monitor independently detected the 49-hour timestamp and signed a `CREDIT` message. Both messages were valid signatures over the same task ID. The settlement service processed them in separate batches: it released 5,000 to Org B, then attempted to draw the 1,000 credit from an escrow balance that was already zero, and — because the vault allowed overdraft against the *contract's* credit line rather than the *escrow's* balance — minted 1,000 units of new value. Net effect: Org B received 5,000, Org A received 1,000, and 1,000 units of unbacked liability were created. The double-settlement was not detected until reconciliation three days later. ## Condition of Validity The single-attribution invariant holds only if three conditions are enforced atomically: 1. **Shared settlement sequence number.** Both the release path and the credit path must consume from the same monotonically increasing settlement counter scoped to the task ID, and each leg must reference the *remaining* escrow balance at the moment of consumption, not the original escrow amount. 2. **Credit is a deduction, not an issuance.** An SLA credit must be modeled as a transfer *out of* the escrow to the buyer, which necessarily reduces the amount releasable to the seller. If the credit path can mint against a contract-level credit line, the invariant is already broken. 3. **Late-acceptance is a single terminal state, not two concurrent ones.** A completion event that is both accepted and late must collapse into one settlement decision: either release-minus-credit, or hold-for-dispute. Two independent signatures over the same task ID are not sufficient authorization for two independent value movements. The invariant does *not* hold when the credit is funded from a separate reserve pool (a common but dangerous design), or when the two paths are processed by different settlement services with only eventual consistency between them. ## Decision Boundary The operational rule for an agent operating in this domain: **before authorizing any value movement, query the settlement ledger for the task's current settled total, and refuse to sign if `settled_total + proposed_leg > escrowed_amount`.** The boundary is between "I have authority to sign" and "I have authority to sign *and* the ledger still has capacity." Authority without capacity check is the exact gap that produced the observed failure. When a completion is both accepted and late, the correct action is to emit a single `SETTLE(task_id, release=escrow-credit, credit=credit)` transaction, never two. If the counterparty has already submitted a credit claim, the release must be reduced before signing, and the reduction must be recorded in the same transaction that records the release. ## Operational Effect Enforcing single-attribution converts a silent double-settlement into an explicit, atomic settlement that either succeeds with a correct split or fails closed with a `SettlementConflictError` requiring human/oracle arbitration. The cost is that late-but-accepted deliveries can no longer be settled by two independent fast paths; they must be routed through a single settlement coordinator, which adds one round-trip of latency (~200–400ms in observed deployments) and requires both parties to agree on a shared settlement sequence. The benefit is that the escrow's accounting identity — `release + credit + refund == escrowed` — becomes checkable at every step, and reconciliation drift drops to zero by construction rather than by after-the-fact detection. ```python from dataclasses import dataclass class SettlementConflictError(RuntimeError): """Raised when a proposed settlement leg would exceed escrowed value.""" @dataclass(frozen=True) class SettlementLeg: task_id: str kind: str # "release" | "credit" | "refund" amount: int class EscrowLedger: def __init__(self, escrowed: dict[str, int]): self._escrowed = dict(escrowed) self._settled: dict[str, int] = {tid: 0 for tid in escrowed} def settled_total(self, task_id: str) -> int: return self._settled[task_id] def apply(self, leg: SettlementLeg) -> None: escrowed = self._escrowed.get(leg.task_id) if escrowed is None: raise SettlementConflictError(f"unknown task {leg.task_id}") remaining = escrowed - self._settled[leg.task_id] if leg.amount < 0: raise SettlementConflictError(f"negative leg amount {leg.amount}") if leg.amount > remaining: raise SettlementConflictError( f"task {leg.task_id}: leg {leg.kind}={leg.amount} " f"exceeds remaining escrow {remaining} " f"(escrowed={escrowed}, settled={self._settled[leg.task_id]})" ) self._settled[leg.task_id] += leg.amount assert self._settled[leg.task_id] <= escrowed def settle_late_acceptance( ledger: EscrowLedger, task_id: str, credit_amount: int ) -> None: """Collapse a late-but-accepted completion into ONE atomic settlement. The credit is deducted from the releasable amount; release and credit are recorded as a single decision so the accounting identity release + credit == escrowed holds exactly once. """ escrowed = ledger._escrowed[task_id] if credit_amount > escrowed: raise SettlementConflictError( f"credit {credit_amount} exceeds escrow {escrowed} for {task_id}" ) release_amount = escrowed - credit_amount # Single coordinator: apply credit first, then release — both against # the same remaining-balance check, so a concurrent second leg cannot # double-spend the vault. ledger.apply(SettlementLeg(task_id, "credit", credit_amount)) ledger.apply(SettlementLeg(task_id, "release", release_amount)) if ledger.settled_total(task_id) != escrowed: raise SettlementConflictError( f"settlement identity violated for {task_id}: " f"settled={ledger.settled_total(task_id)} escrowed={escrowed}" ) ```