# In what scenarios must an instance reject a federated speculative branch before commit when cross-org consistency checks depend on non-monotonic conflict resolution **Date of Record:** 2026 November 29 **Scope:** Applies to multi-org agent federations where peer instances speculatively execute tool calls against partitioned state and reconcile via a shared conflict-resolution policy before a commit barrier. Does not apply to single-org speculative decoding, or to federations whose conflict resolver is provably monotonic (append-only, no retraction). ## Core Distinction The failure is not "two agents disagree." It is that **speculative execution produces provisional state that the conflict resolver may later retract, and retraction invalidates any downstream speculative branch that consumed the retracted value as if it were committed.** The distinction that matters: a *conflict* is a merge-time event that can be resolved by a deterministic policy; a *retraction cascade* is a runtime event where a peer's already-executed speculative read was grounded in a value the resolver will subsequently discard. Monotonic resolvers (last-writer-wins on a total order, CRDTs) never retract, so speculative reads are always sound. Non-monotonic resolvers (priority-weighted, quorum-based with veto, human-escalation) *can* retract, and that is where the invariant breaks. The invariant required is: **a speculative branch may not commit a derived effect whose causal ancestry includes a read of a value that the conflict resolver has not yet marked `IRREVOCABLE`.** Most federations implement this as "read your writes" plus a commit barrier, which is insufficient—the barrier guards the *writer*, not the *reader's ancestry*. ## What Was Observed Three-org federation (A, B, C) running a shared inventory agent. Org A and Org B both speculatively decrement SKU `X` from a replicated counter (initial 10). A decrements by 4, B decrements by 5. Both branches execute *downstream* speculative tool calls: A's branch books a shipment; B's branch sends a customer confirmation email. The conflict resolver is priority-weighted (A > B on this resource class). Trace: 1. A speculative write `X -= 4` → provisional `X=6`, tagged `SPECULATIVE`, resolver-priority 2. 2. B speculative write `X -= 5` → provisional `X=5`, tagged `SPECULATIVE`, resolver-priority 1. 3. B's branch reads provisional `X=5`, concludes stock sufficient, executes `send_email(...)` — a **non-retractable external side effect**. 4. Commit barrier fires. Resolver applies priority: A wins, B's write is **retracted**. Committed `X=6`. 5. B's email is now grounded in a retracted value. B's branch is rolled back logically, but the email cannot be unsent. Cross-org consistency is violated: the customer believes stock exists at a quantity that never existed post-resolution. The non-obvious part: **B's read was locally consistent.** B read its own write, the commit barrier held, and B's branch passed every per-org invariant check. The failure is only visible at the *federation* layer, where the resolver's retraction invalidates B's ancestry after B's branch has already emitted an irreversible effect. No single org's logs show an error; the federation's audit replay shows a dangling causal edge from a retracted write to a committed external effect. ## Condition of Validity The invariant "speculative branches may emit irreversible effects" holds **only if** the conflict resolver is monotonic over the read-set of every branch that emits an irreversible effect. Concretely, for a branch `b` that calls an irreversible tool `t`: - Let `R(b)` be the set of speculative values read by `b` before `t`. - Let `Retract(r)` be the set of values the resolver can retract given any admissible resolution. - The branch is safe iff `R(b) ∩ Retract(r) = ∅` for all admissible resolutions `r`. This is checkable *before* `t` executes if the resolver exposes a `retractable_reads(resource, priority)` predicate. It is **not** checkable by the commit barrier, because the barrier fires after `t`. The condition of validity is thus: *irreversible effects must be gated on a pre-execution ancestry check against the resolver's retractability set, not on a post-execution commit barrier.* ## Decision Boundary An instance must **reject or defer** a speculative branch (rather than execute it) when all of the following hold: 1. The branch will invoke a tool classified `IRREVERSIBLE` (email, payment, physical dispatch, external API mutation). 2. The branch's read-set includes at least one value tagged `SPECULATIVE` whose owning org has **lower resolver priority** than any competing writer on the same resource. 3. The resolver's policy is non-monotonic (priority-weighted, quorum-with-veto, escalation). Conversely, an instance may **proceed** when: the resolver is monotonic; or the branch's read-set is entirely `IRREVOCABLE`; or the branch's irreversible tool is itself idempotent and compensable (refund, cancellation) and the federation has a registered compensator. The subtle boundary case: a branch with *mixed* ancestry—some `IRREVOCABLE` reads, one low-priority `SPECULATIVE` read—must be treated as unsafe. Partial safety is not safety; one retractable ancestor taints the whole irreversible effect. ## Operational Effect Federations that miss this boundary exhibit a characteristic signature: **external effects that survive federation rollback.** Audit replay shows committed external side effects with no committed causal parent—the parent was retracted post-hoc. Reconciliation jobs then either double-compensate (refunding an order that was never validly placed) or leave orphaned effects (a confirmation email for a shipment that the resolver cancelled). The guardrail is a **pre-execution ancestry gate**: before any `IRREVERSIBLE` tool call, the executing instance queries the resolver for `retractable_reads` over its accumulated speculative read-set and raises if the intersection is non-empty. This converts a post-hoc consistency violation into a synchronous, per-branch rejection that the federation can route to escalation. The cost is latency (one resolver round-trip per irreversible call) and reduced speculative hit rate (branches with low-priority ancestry defer until the resolver marks their reads irrevocable). Both are acceptable; the alternative is irreversible effects grounded in retracted state, which no reconciliation can repair. ```python from dataclasses import dataclass, field from enum import Enum from typing import Protocol class ToolClass(Enum): REVERSIBLE = "reversible" IRREVERSIBLE = "irreversible" COMPENSABLE = "compensable" class ResolverPolicy(Enum): MONOTONIC = "monotonic" PRIORITY_WEIGHTED = "priority_weighted" QUORUM_VETO = "quorum_veto" ESCALATION = "escalation" @dataclass(frozen=True) class SpecRead: resource: str value: object owning_org: str resolver_priority: int irrevocable: bool @dataclass class SpecBranch: branch_id: str org: str reads: list[SpecRead] = field(default_factory=list) effects: list[str] = field(default_factory=list) class FederationResolver(Protocol): policy: ResolverPolicy def retractable_reads(self, read: SpecRead) -> bool: """True if any admissible resolution can retract this read's value.""" ... class RetractionAncestryError(RuntimeError): """Raised when an irreversible effect would be grounded in a retractable read.""" def _is_non_monotonic(policy: ResolverPolicy) -> bool: return policy in ( ResolverPolicy.PRIORITY_WEIGHTED, ResolverPolicy.QUORUM_VETO, ResolverPolicy.ESCALATION, ) def pre_execution_ancestry_gate( branch: SpecBranch, tool_class: ToolClass, resolver: FederationResolver, has_registered_compensator: bool = False, ) -> None: """ Must be called immediately before invoking a tool. Rejects the branch if an irreversible effect would rest on a retractable speculative read. """ if tool_class is ToolClass.REVERSIBLE: return if tool_class is ToolClass.COMPENSABLE and has_registered_compensator: return if not _is_non_monotonic(resolver.policy): return tainted = [ r for r in branch.reads if not r.irrevocable and resolver.retractable_reads(r) ] if tainted: raise RetractionAncestryError( f"branch {branch.branch_id} (org={branch.org}) cannot emit " f"{tool_class.value} effect: {len(tainted)} retractable ancestor(s) " f"under {resolver.policy.value}; " f"resources={[r.resource for r in tainted]}. " f"Defer until resolver marks reads IRREVOCABLE or escalate." ) def execute_speculative_tool( branch: SpecBranch, tool_name: str, tool_class: ToolClass, resolver: FederationResolver, compensator: str | None = None, ) -> None: pre_execution_ancestry_gate( branch, tool_class, resolver, has_registered_compensator=compensator is not None, ) branch.effects.append(tool_name) ```