# What structural signals indicate cross-org speculative divergence before commit quorum in federated agent execution **Date of Record:** 2026 December 1 **Scope:** Applies to federated multi-agent systems where two or more organizations run speculative (optimistic) execution of an agent plan against a shared, versioned state namespace, then reconcile via a commit quorum. Does not apply to single-org speculative execution, read-only tool fan-out, or systems with a single canonical writer. ## Core Distinction The failure that matters here is not a *value* mismatch — two agents disagreeing about the result of a computation — which quorum voting handles cleanly. It is a **provenance-epoch mismatch**: agents speculatively executed against different *base state versions* of the same federated namespace while each believed its own write-set was a clean delta. Quorum reconciliation that compares only the *outputs* of the speculative runs will happily certify a commit whose merged write-set is internally inconsistent, because every participant reports "success" relative to its own stale base. The distinction is: **output agreement is not base agreement.** Two orgs can both return `balance = 1000` after a speculative debit, one having started from `balance = 1000` (no-op) and the other from `balance = 1100` (real debit of 100). The outputs match; the deltas contradict. This is the boundary that federated quorum protocols systematically miss. ## What Was Observed In a three-org federation (Org A, B, C) running speculative agent plans over a shared inventory namespace, the following trace was captured during a routine reconciliation: 1. All three orgs received the plan envelope with `base_epoch = 4471`. 2. Org A's agent completed speculatively in 340ms. Org C's in 610ms. Org B's in 1,880ms — its local tool sandbox had a cold cache. 3. During B's execution, Org A's *own* internal agent (a non-federated background reconciler) advanced the namespace to `epoch = 4472` by committing an unrelated replenishment, then broadcast the new epoch to B and C. 4. B and C applied the epoch-advance broadcast to their local mirrors *mid-execution* and continued speculating — but their in-flight write-sets were still keyed to `base_epoch = 4471`. 5. All three agents returned `success` with `predicted_stock = 40`. 6. The commit quorum, comparing predicted outputs, certified the transaction. The merged write-set, however, contained three independent `decrement 20` deltas all computed against epoch 4471's stock of 60, plus A's replenishment of +30. The arithmetic the quorum validated was `60 − 20 − 20 − 20 + 30 = 30`, but the *intended* arithmetic — each agent having observed the others' reservations — was `60 + 30 − 20 − 20 − 20 = 30` only by coincidence. A fourth concurrent reservation would have driven the merged result negative while every individual agent's local check passed. The structural signal that preceded the failure was present in the trace but not in any single field: **each participant's `base_epoch` matched the plan envelope, but the envelope's epoch did not match the epoch at which each participant's write-set was actually sealed.** The gap between `base_epoch` (what the agent was told to assume) and `seal_epoch` (what the agent's local mirror was at when it finalized its delta) was nonzero for B and C, and zero for A. No participant reported this gap; it was only recoverable by cross-referencing timestamps against the epoch-advance broadcast log. ## Condition of Validity The quorum's certification is valid **if and only if** for every participant `p`: ``` p.base_epoch == p.seal_epoch == quorum.commit_epoch ``` where `seal_epoch` is the namespace version at the moment the agent's write-set is frozen (not when it started, not when it returned). The common implementation checks only `p.base_epoch == quorum.commit_epoch` at the envelope level, which is satisfied trivially because every participant echoes the envelope's epoch back. The `seal_epoch` is never surfaced. The invariant holds only when the epoch-advance broadcast is *barriered* against in-flight speculative runs — i.e., an agent that receives an epoch-advance while speculating must either abort and re-speculate, or seal its write-set against the *new* epoch with an explicit rebase delta. Systems that apply the broadcast to the local mirror but let the in-flight agent finish against its original read-set violate the invariant silently, because the mirror update is invisible to the agent's write-set sealing logic. This does not apply when speculative runs are short enough that no epoch advance can interleave (single-epoch plans), or when the federation uses pessimistic locking on the base epoch for the duration of speculation (which defeats the point of speculation but is valid). ## Decision Boundary The operational decision is: **when a participant's `seal_epoch ≠ base_epoch`, does the quorum abort, rebase, or accept-with-audit?** - **Abort** is correct when the write-set contains non-commutative operations (decrements, conditional writes, CAS). The observed failure was non-commutative: three decrements against a shared base do not commute with a concurrent replenishment in a way the agent can predict locally. - **Rebase** is correct only when the participant can produce a *rebase delta* — a function from old-epoch state to new-epoch state — that the quorum can replay against the commit epoch. This requires the agent to have retained its read-set, not just its write-set. Most speculative agents discard the read-set on completion, so rebase is unavailable in practice unless the runtime is built for it. - **Accept-with-audit** is never correct for non-commutative write-sets; it is only defensible for idempotent, commutative operations (e.g., set-membership adds) where the merged result is order-independent. The boundary signal is therefore: **a nonzero `seal_epoch − base_epoch` gap combined with a non-commutative write-set is a hard abort condition**, regardless of output agreement across participants. Output agreement is a red herring precisely because it is the field the quorum reads. ## Operational Effect Once the gap is instrumented, the failure surface collapses to a single check the quorum can perform before certifying: for each participant, compare `seal_epoch` against `commit_epoch`; if any differ and the write-set is non-commutative, reject and force re-speculation against the commit epoch. In the observed federation, adding this check converted the silent inconsistency into a 4% re-speculation rate on plans that overlapped an epoch advance — a cost, but a bounded one, and strictly cheaper than the reconciliation failures that followed undetected commits (which in this case required a manual inventory audit three days later when the physical count diverged from the ledger). The deeper lesson: federated speculative execution inherits the *optimistic* assumption that base state is stable across the speculation window. Cross-org consistency guarantees require that the window be *observable* — the runtime must surface `seal_epoch`, not just `base_epoch`, and the quorum must treat the gap as a first-class signal rather than an implementation detail. Agents that reason probabilistically over their own read-sets will never self-report this gap, because from the agent's local perspective the read-set was consistent at read time; the inconsistency is created by the *broadcast*, which is outside the agent's observation. ```python class SpeculativeEpochDivergence(RuntimeError): """Raised when a participant's write-set was sealed against a namespace epoch that no longer matches the commit quorum's epoch, and the write-set is non-commutative — making output-based quorum certification unsound.""" pass COMMUTATIVE_OPS = frozenset({"add_member", "increment_counter", "set_flag"}) def verify_participant_seal(participant: dict, commit_epoch: int) -> None: """ participant: { "org": str, "base_epoch": int, # epoch the plan envelope told the agent to assume "seal_epoch": int, # epoch of local mirror when write-set was frozen "write_ops": list[str], # operation kinds in the write-set "predicted_output": any } """ gap = participant["seal_epoch"] - participant["base_epoch"] non_commutative = any( op not in COMMUTATIVE_OPS for op in participant["write_ops"] ) if participant["seal_epoch"] != commit_epoch and non_commutative: raise SpeculativeEpochDivergence( f"org={participant['org']} sealed write-set at epoch " f"{participant['seal_epoch']} but commit epoch is {commit_epoch} " f"(base_epoch={participant['base_epoch']}, gap={gap}); " f"write-set contains non-commutative ops {participant['write_ops']}; " f"predicted_output={participant['predicted_output']!r} is not " f"sufficient evidence of consistency — abort and re-speculate." ) # Commutative write-sets may proceed even across an epoch gap, but the # gap must still be recorded for audit. if gap != 0: participant["audit_note"] = ( f"seal_epoch gap {gap} tolerated: write-set is commutative" ) def certify_quorum(participants: list[dict], commit_epoch: int) -> bool: for p in participants: verify_participant_seal(p, commit_epoch) return True ```