Which invariants prevent optimistic cross-org delegation from committing a speculative sub-task whose parent warrant was revoked mid-flight

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent systems where an orchestrator agent (Org A) speculatively delegates a sub-task to a worker agent in a different trust domain (Org B) under an optimistic commit protocol, i.e., the worker executes and stages effects before the parent warrant is re-validated. Does not apply to pessimistic two-phase delegation where the worker blocks on warrant confirmation before any tool invocation, nor to single-org delegation where a shared warrant authority makes revocation synchronous.

Core Distinction

The failure is not "the worker executed after revocation." Any optimistic protocol accepts that window. The failure is that the worker's *staged effects* become *committed effects* because the commit decision is made by the worker's local state machine, which observed a warrant that was valid at delegation time, while the revocation was applied at the parent's authority, which the worker cannot read. The distinguishing question is not whether revocation can race execution—it always can—but whether the commit decision is *causally downstream of the revocation event* or merely *temporally after* it. A protocol that orders commit after revocation in wall-clock time but not in happens-before order will commit stale work under load, and the probability of that misordering rises precisely when the system is busiest, because revocation latency and sub-task execution latency are correlated through shared queue depth.

What Was Observed

A three-org pipeline: Org A's planner emitted a delegation warrant `W(parent)` scoped to a task tree, Org B's worker received a speculative sub-task with `W(sub)` derived from `W(parent)` via a signed attenuation token, and Org C hosted the effect sink (a write-ahead staging store) that the worker committed into. The optimistic protocol was: worker executes → stages effects into C → sends `commit(W(sub), effects_digest)` to C → C validates `W(sub)` against its cached revocation list → C applies effects.

The trigger condition was a *revocation propagation skew*. Org A revoked `W(parent)` after a planner re-plan (the user changed intent), which invalidated all attenuated descendants including `W(sub)`. Revocation propagated to C's revocation list via an async gossip channel with a p99 of 1.4s. The worker in B, unaware of revocation, was mid-execution on a sub-task that took 3–9s (a multi-step tool loop with retries). In the failure trace, the worker finished at t+2.1s, sent `commit` at t+2.2s, and C validated against a revocation list that would not contain `W(parent)`'s revocation until t+3.6s. C applied the effects. Two minutes later a downstream auditor agent in Org A, reconciling the task tree, found effects committed under a warrant it believed revoked, and flagged a verification replay discrepancy. The replay could not reconstruct *why* the commit was authorized, because C's validation log recorded "W(sub) valid at commit time" without recording the revocation-list version or the parent's revocation epoch.

The non-obvious part: the worker had *correctly* checked `W(sub)`'s local expiry and signature. Every local invariant held. The only broken invariant was a cross-org causal one—the commit's validity predicate referenced a revocation state that was not the revocation state at the parent's commit point.

A second observed variant: under queue saturation, the gossip channel's p99 stretched to 11s while sub-task execution stretched to only 6s, so the skew *inverted*—commits that would have been safe at low load became unsafe at high load, and the system's safety margin was anti-correlated with its load, the worst possible coupling.

Condition of Validity

The invariant that must hold for optimistic commit to be safe is a *revocation-epoch fence*: every commit must carry the revocation epoch (a monotonic counter) of the warrant authority it depends on, read at delegation time, and the effect sink must reject any commit whose carried epoch is older than the sink's current epoch *for that authority*, not merely check that the specific warrant ID is absent from a list. Formally: `commit(W(sub), epoch_A_at_delegation)` is applied only if `epoch_A_at_sink >= epoch_A_at_delegation` AND no revocation of any ancestor of `W(sub)` occurred at an epoch `<= epoch_A_at_delegation`. The second clause is the one that fails silently: a list-membership check on `W(sub)` alone cannot see an ancestor revocation that was applied to `W(parent)` and propagated as a *tree* invalidation rather than per-warrant entries.

The condition of validity is therefore: the sink's revocation state must be *causally consistent* with the delegation point, not merely *current*. This requires the sink to track a per-authority epoch and to require the delegator to embed that epoch in the attenuated token. Without the embedded epoch, no amount of faster gossip closes the window—it only shrinks it, and shrinking a window is not the same as fencing it. The window must be closed by a happens-before edge, which means the worker's commit must be ordered after the revocation *if a revocation occurred before the delegation point's epoch was superseded*.

Decision Boundary

The boundary is between *speculative execution with a bounded, detectable window* and *speculative execution with an unbounded, undetectable window*. The system may operate optimistically when three conditions hold: (1) the sub-task's effects are staged, not applied, until a commit acknowledgement that carries the sink's epoch is received; (2) the worker's commit message embeds the delegation-time epoch of every authority in the warrant chain; (3) the sink's reject path emits a *compensation directive* naming the staged effects, so the worker can roll back rather than orphan them. If any of the three is absent, the correct decision is to downgrade to pessimistic delegation for that sub-task class—block on warrant re-validation before the first tool invocation—accepting the latency cost because the alternative is silent commit of revoked work.

The boundary also has a load-dependent side: when the measured p99 of revocation propagation exceeds the p50 of sub-task execution, the optimistic protocol's expected unsafe-commit rate exceeds a configurable threshold and the orchestrator must shed speculative delegations rather than queue them. This is a *safety-vs-throughput* cliff, not a smooth tradeoff, because the misordering probability is the product of two tails and the tails thicken together.

Operational Effect

The operational consequence is that cross-org delegation must treat revocation as a *fencing token problem*, not a *notification problem*. The guardrail is a per-authority monotonic epoch embedded in every attenuated warrant, checked at the sink against the sink's epoch, with a reject-and-compensate path that names staged effects. The auditor's replay must record the epoch and the sink's epoch at commit, so that a later reconciliation can distinguish "committed under a valid warrant" from "committed under a warrant that was valid at delegation but superseded before commit." Without the epoch in the replay record, the discrepancy is undiagnosable and the auditor cannot decide whether to compensate or to accept—which is how a single misordered commit becomes a permanent, unexplained divergence in the task tree.

The secondary effect is on capacity planning: because the unsafe window is load-correlated, the system must expose revocation-propagation lag as a first-class SLO and must refuse speculative delegation when that SLO is breached, even though refusing delegation is itself a throughput loss. The invariant is that *no commit may be authorized by a revocation state the delegator could not have observed at delegation time*; every mechanism that fails to enforce this is a latency optimization that borrows safety from a window it cannot see.

import time
from dataclasses import dataclass, field
from typing import Dict, Optional


class RevocationFenceViolation(RuntimeError):
    """Raised when a commit is authorized against a revocation state
    causally older than the delegation point, or when the sink cannot
    prove causal consistency between delegation epoch and commit epoch."""
    pass


@dataclass
class Warrant:
    warrant_id: str
    parent_id: Optional[str]
    authority: str
    delegation_epoch: int          # epoch of `authority` observed at delegation
    expires_at: float


@dataclass
class EffectSink:
    # per-authority monotonic revocation epoch
    authority_epoch: Dict[str, int] = field(default_factory=dict)
    # staged effects keyed by (warrant_id, digest)
    staged: Dict[str, bytes] = field(default_factory=dict)
    applied: Dict[str, bytes] = field(default_factory=dict)

    def current_epoch(self, authority: str) -> int:
        return self.authority_epoch.get(authority, 0)

    def bump_epoch(self, authority: str) -> int:
        self.authority_epoch[authority] = self.current_epoch(authority) + 1
        return self.authority_epoch[authority]

    def stage(self, w: Warrant, digest: str, payload: bytes) -> None:
        if time.time() > w.expires_at:
            raise RevocationFenceViolation(
                f"warrant {w.warrant_id} expired before staging")
        # fence: staging is allowed only if the sink's epoch for the
        # authority has not advanced past the delegation epoch
        if self.current_epoch(w.authority) > w.delegation_epoch:
            raise RevocationFenceViolation(
                f"staging refused: authority {w.authority} epoch "
                f"{self.current_epoch(w.authority)} > delegation epoch "
                f"{w.delegation_epoch} for warrant {w.warrant_id}")
        self.staged[digest] = payload

    def commit(self, w: Warrant, digest: str) -> None:
        if digest not in self.staged:
            raise RevocationFenceViolation(
                f"commit of unstaged digest {digest} for {w.warrant_id}")
        # THE INVARIANT: the sink's epoch must not have advanced past the
        # delegation epoch. If it has, an ancestor revocation may have
        # occurred between delegation and commit; the staged effect is
        # causally unsafe and must be compensated, not applied.
        sink_epoch = self.current_epoch(w.authority)
        if sink_epoch > w.delegation_epoch:
            # reject and emit compensation directive naming staged effects
            self.staged.pop(digest, None)
            raise RevocationFenceViolation(
                f"commit refused for {w.warrant_id}: sink epoch "
                f"{sink_epoch} supersedes delegation epoch "
                f"{w.delegation_epoch}; staged effect {digest} compensated")
        self.applied[digest] = self.staged.pop(digest)


def run_optimistic_delegation(sink: EffectSink, w: Warrant,
                              digest: str, payload: bytes,
                              revoke_parent_midflight: bool) -> str:
    """Simulate the race: stage, then (optionally) revoke the parent
    authority mid-flight, then attempt commit."""
    sink.stage(w, digest, payload)
    if revoke_parent_midflight:
        # revocation applied at the parent authority; propagates to sink
        sink.bump_epoch(w.authority)
    try:
        sink.commit(w, digest)
    except RevocationFenceViolation as e:
        return f"COMPENSATED: {e}"
    return "COMMITTED"


# Demonstration of the fenced protocol under the observed race.
sink = EffectSink()
w = Warrant(warrant_id="W-sub-7", parent_id="W-parent-3",
            authority="org-a", delegation_epoch=4,
            expires_at=time.time() + 60)

print(run_optimistic_delegation(sink, w, "d1", b"effects", False))
print(run_optimistic_delegation(sink, w, "d2", b"effects", True))

# Without the epoch fence (list-membership only), the second call would
# have committed. The fence converts an undetectable divergence into a
# detectable compensation.
if "d2" in sink.applied:
    raise RevocationFenceViolation(
        "invariant broken: revoked sub-task committed under stale epoch")