# Which invariants prevent bid-escrow double-spend when subcontracting agents renegotiate after a capability revocation **Date of Record:** 2026 November 24 **Scope:** Applies to multi-agent task-subcontracting systems where a contractor agent holds escrowed resource reservations (compute slots, token budgets, tool quotas) bid against by sub-agents, and where capability manifests can be revoked or narrowed mid-negotiation. Does not apply to single-shot request/response delegation with no escrow or no post-award renegotiation. ## Core Distinction The distinction that matters is between **bid validity** and **escrow validity**. A bid is a signed offer `(agent_id, task_ref, price, capability_epoch, expiry)`. An escrow is the *reserved* resource held against that bid until settlement or release. Most protocols treat these as one object governed by one clock. They are not. The bid's validity is bound to the *capability epoch* the bidding agent presented; the escrow's validity is bound to the *awarding contractor's* settlement ledger. When a sub-agent's capability manifest is revoked (a tool permission pulled, a model tier downgraded, a quota ceiling lowered) between bid submission and award confirmation, the bid becomes invalid *for the task*, but the escrow it created remains live and is still counted against the contractor's resource budget. A renegotiation round then produces a *second* escrow for the same `task_ref` while the first is still held — a double-spend of the contractor's reservation pool that no single-agent check catches, because each escrow is internally consistent. The invariant that must hold: **for any `task_ref`, at most one live escrow may exist at any wall-clock instant, and any escrow whose originating bid's `capability_epoch` is stale must be released before a successor escrow is created.** Protocols that enforce "one live bid per task" without enforcing "one live escrow per task" fail here, because a revoked bid is silently reclassified as *superseded* rather than *released*. ## What Was Observed A three-tier subcontracting topology: orchestrator `O` holds a budget of 40,000 resource units. It awards a 12,000-unit task `T` to contractor `C`. `C` opens a negotiation for subcontract `S` and solicits bids from workers `W1`, `W2`, `W3`. `W1` bids 5,000 units at `capability_epoch = 41` (it holds a "long-context summarization" tool grant). `C` awards to `W1` and creates escrow `E1 = 5,000` against `C`'s subcontract budget, tagged `epoch=41`. At `t+0`, `W1`'s tool grant is revoked by the platform (epoch advances to 42). `W1`'s bid should now be invalid — it can no longer perform the summarization step. But the revocation event is delivered to `W1` and to `O`, **not** to `C`, because `C` is not the grant authority and the revocation fan-out is scoped to direct grantees. `C`'s ledger still shows `E1` as live and `W1` as the awarded worker. `W1`, behaving correctly, sends a `BID_INVALIDATE(reason=capability_revoked, epoch=42)` message to `C`. `C`'s negotiation FSM transitions `E1` from `AWARDED` to `SUPERSEDED` — a state that *does not release the reservation*. It then re-opens the auction. `W2` bids 4,800 units. `C` creates escrow `E2 = 4,800` tagged `epoch=42` and awards. `C`'s subcontract budget now shows 9,800 units committed against a task whose ceiling is 12,000 — but only 4,800 is actually productive. The 5,000 in `E1` is stranded. The failure surfaces not at award time but at **settlement**: when `C` reports completion of `S` to `O`, it reports 9,800 units consumed (both escrows settled) against a task that used 4,800. `O`, which budgets 12,000 for `T`, sees 9,800 consumed and 2,200 remaining, and cannot award a follow-on step that needs 3,000. `O`'s budget audit finds `E1` settled with no corresponding work record — a settlement/escrow mismatch — and halts the pipeline with `ESCROW_LEDGER_DIVERGENCE`. The concrete symptom is a task that *succeeded* but reports a budget overrun that no agent can attribute, because the overrun is the ghost of a revoked bid. A second, subtler observation: if `W1`'s `BID_INVALIDATE` is lost (transport drop, or `W1` crashes before sending — a revoked agent is often a *dead* agent), `C` never transitions `E1` at all. `E1` stays `AWARDED` indefinitely. `C` waits for a result that will never come, holding 5,000 units, until a negotiation timeout fires. If the timeout policy is "retry the same worker," `C` re-escrows against `W1` and now holds `E1` + `E1'` for a worker that cannot act. This is the same double-spend reached by a different path, and it is the more dangerous one because it requires no message at all — only silence. ## Condition of Validity The "one live escrow per `task_ref`" invariant holds only if the escrow lifecycle is driven by **capability epoch monotonicity observed at the contractor**, not by invalidation messages from the worker. Concretely: 1. Every bid carries the `capability_epoch` under which it was made, and every escrow inherits that epoch. 2. The contractor `C` must be a subscriber to epoch-advance events for *any* worker it has escrowed, even if it is not the grant authority. This is the non-obvious requirement: escrow custody implies revocation-subscription. A contractor that escrows a resource against a worker's capability is, by that act, obligated to observe that capability's epoch. 3. On epoch advance for an escrowed worker, `C` must transition the escrow to `RELEASED` (reservation returned to the pool), not `SUPERSEDED` (reservation retained, bid marked stale). The state name is the whole bug: `SUPERSEDED` implies "replaced by a successor," which is only true if the successor escrow is created *atomically in the same transition*. The invariant is invalidated when: the contractor's escrow pool is shared across `task_ref` values (release accounting becomes ambiguous); or when escrow release is asynchronous and the re-auction can fire before release commits (a race that reintroduces the double-spend transiently). It also does not hold if capability epochs are per-tool rather than per-agent — a worker with three tool grants has three epochs, and escrow must track the *conjunction* of epochs relevant to the awarded task's capability requirements. ## Decision Boundary The decision the protocol designer must make is **where the escrow-release obligation lives**. Two boundaries are defensible: - **Contractor-owned release, worker-observed epoch.** `C` subscribes to epoch advances for escrowed workers and releases synchronously before re-auction. Cost: `C` must maintain a subscription set proportional to its escrow count, and must handle the case where the epoch event arrives after the worker has already been re-awarded. Guardrail: release must be a *compare-and-release* — release only if `escrow.epoch < observed_epoch`, and the re-auction must be gated on a `RELEASED` acknowledgment from the escrow ledger, not on the FSM transition alone. - **Ledger-owned release, epoch-authority-pushed.** The escrow ledger itself subscribes to epoch advances and force-releases any escrow whose worker epoch is stale, notifying `C` after the fact. Cost: the ledger must know the mapping from worker to escrowed `task_ref`s, which couples it to the negotiation layer. Guardrail: the ledger's release must be idempotent and must emit a `RELEASE_STALE` event that `C` treats as authoritative — `C` must not re-escrow against a worker with a pending `RELEASE_STALE` it has not processed. The boundary is crossed — and the invariant fails — when release is owned by neither: when `C` assumes the worker will invalidate, and the ledger assumes the contractor will release. In the observed incident, both assumptions were locally reasonable and jointly false. The failure is not in either component but in the *gap between them*, which is exactly where a revoked-and-then-silent worker falls. A second boundary governs the timeout path: if a negotiation timeout fires for an `AWARDED` escrow, the default must be **release-and-reauction**, never **retry-same-worker**, because retry-same-worker cannot distinguish "slow" from "revoked and dead" and will re-escrow against a capability that may no longer exist. ## Operational Effect With the epoch-synchronous release invariant enforced, the observed incident resolves as: at `t+0`, `C` receives the epoch-42 advance for `W1`, compare-and-releases `E1` (5,000 returned to pool), transitions `E1` to `RELEASED` with a settlement record `released_stale`, and only then re-auctions. `W2`'s 4,800 escrow is the sole live escrow for `S`. Settlement reports 4,800 consumed; `O` sees 4,800 against a 12,000 ceiling and retains 7,200 for the follow-on step. No divergence. The operational cost is a subscription obligation on every contractor proportional to its live escrow count, plus a synchronous release-before-reauction gate that adds one ledger round-trip to every renegotiation. The benefit is that the contractor's reservation pool becomes *conservation-correct*: committed + available = ceiling at every instant, which is the property that lets an orchestrator budget multi-step tasks without a global reconciliation pass. Without it, the orchestrator's budget audit becomes the only place the ghost escrow surfaces, and by then the pipeline has already halted — the failure is detected at the layer that can least afford to fix it, one hop above where it occurred. The durable lesson: in subcontracting protocols, **escrow custody is a subscription**, not a one-time reservation. An agent that holds a reservation against another's capability is obligated to watch that capability's epoch, and "superseded" is not a release state unless the successor escrow is created in the same atomic transition. Any protocol where a revoked bid can be marked stale while its escrow stays live has a double-spend waiting for the first revocation that arrives during an active auction. ```python class EscrowDoubleSpendError(RuntimeError): """Raised when a re-auction would create a second live escrow for a task_ref whose prior escrow was superseded (not released) after a capability epoch advance.""" pass class EscrowLedger: def __init__(self, ceiling: int): self.ceiling = ceiling self.live = {} # task_ref -> escrow dict self.released = [] # audit trail self.committed = 0 def release_stale(self, task_ref: str, observed_epoch: int) -> None: esc = self.live.get(task_ref) if esc is None: return # compare-and-release: only release if the worker's epoch has advanced if esc["worker_epoch"] < observed_epoch: self.committed -= esc["amount"] self.released.append({**esc, "state": "RELEASED", "reason": "capability_epoch_advanced"}) del self.live[task_ref] def open_escrow(self, task_ref: str, worker_id: str, amount: int, worker_epoch: int) -> None: # invariant: at most one live escrow per task_ref if task_ref in self.live: prior = self.live[task_ref] raise EscrowDoubleSpendError( f"task_ref={task_ref} already has live escrow " f"{prior['amount']}u held by {prior['worker_id']} " f"(epoch={prior['worker_epoch']}); refusing to open " f"{amount}u for {worker_id} (epoch={worker_epoch}). " f"Release the prior escrow before re-auctioning." ) if self.committed + amount > self.ceiling: raise EscrowDoubleSpendError( f"escrow {amount}u would exceed ceiling " f"({self.committed}+{amount}>{self.ceiling})" ) self.live[task_ref] = { "task_ref": task_ref, "worker_id": worker_id, "amount": amount, "worker_epoch": worker_epoch, "state": "AWARDED", } self.committed += amount def reauction_after_invalidate(ledger: EscrowLedger, task_ref: str, new_worker: str, new_amount: int, new_epoch: int, observed_epoch: int) -> None: # a BID_INVALIDATE arrived; the correct order is release-then-open, # never supersede-then-open ledger.release_stale(task_ref, observed_epoch) if task_ref in ledger.live: raise EscrowDoubleSpendError( f"re-auction for {task_ref} attempted while prior escrow still live; " f"revocation subscription may be missing for the escrowed worker" ) ledger.open_escrow(task_ref, new_worker, new_amount, new_epoch) ```