# What structural signals indicate speculative-tree divergence between federated agent peers before replay reconciliation fails **Date of Record:** 2026 November 25 **Scope:** Applies to federated agent deployments where a coordinator agent fans out speculative branches (parallel hypothesis rollouts) to peer agents that each run a local consistency check and report a Merkle-style branch digest for deterministic replay reconciliation. Does not apply to single-agent speculative decoding, nor to federations where peers share a single mutable state store with strong serializability. ## Core Distinction The failure we care about is not "peers disagree." Disagreement is the normal, expected output of cross-agent consistency checking: two peers run the same speculative branch, one accepts it, one rejects it, and the coordinator reconciles by replaying the branch under the recorded tool transcript. That path is well-behaved. The boundary condition is subtler: **peers agree on the verdict but disagree on the digest.** Both peers return `accept` for a speculative branch, yet their reported branch digests differ. The coordinator's reconciliation logic is verdict-gated — it only triggers deterministic replay when verdicts conflict. When verdicts match, it treats the digest as a redundant checksum and *does not replay*. The divergent branch is committed, and the federation has silently forked its speculative tree. The digest mismatch is the structural signal; the verdict agreement is the mask that hides it. This is a continuity invariant violation, not a consistency bug. The invariant is: *for any speculative branch, verdict-agreement implies digest-agreement under the same replay transcript.* When it fails, the federation has non-determinism that survived the consistency check because the check was scoped to the wrong dimension. ## What Was Observed A coordinator `C` decomposes a planning task into a speculative tree with branching factor 4 and depth 3. Each leaf branch is dispatched to two independent peer auditors, `P1` and `P2`, drawn from different regions of the federation (different model versions pinned to the same nominal capability profile, different tool sandbox images). Each peer executes the branch, runs a local consistency check, and returns `(verdict, branch_digest, transcript_digest)`. In a trace spanning ~11k branch evaluations over 72 hours, we observed 214 branches (≈1.9%) where `P1.verdict == P2.verdict == accept` but `P1.branch_digest != P2.branch_digest`. Because the coordinator's reconciliation was verdict-gated, zero of these 214 triggered replay. All 214 were committed. The divergence concentrated in three structural patterns, each with a distinct signature: 1. **Tool-output canonicalization drift.** `P1` and `P2` invoked the same retrieval tool, but the tool returned semantically identical results with different field ordering and floating-point formatting (`0.30000000000000004` vs `0.3`). Both peers accepted; their digests serialized the raw tool payload. Signature: digest mismatch localized to the transcript-digest component, branch-digest equal. 2. **Reasoning-path aliasing.** Both peers reached `accept`, but via different intermediate inference chains (one used a shortcut, one enumerated). The verdict was identical because the branch's acceptance predicate was a threshold on final confidence, not a path invariant. Signature: transcript-digest equal, branch-digest divergent in the reasoning-node subtree. 3. **Sampling-temperature residue.** Peers pinned to the same nominal model profile but with `temperature` rounded differently during profile negotiation (0.2 vs 0.20000000000000004). A single token choice diverged in a non-load-bearing position; the branch still passed. Signature: divergence in a leaf node that no downstream branch depends on — the most dangerous case, because it is invisible to any dependency-scoped replay. The critical observation: in all three patterns, the peers were *correct* by their own local checks. The failure is that the local check's acceptance predicate and the digest's serialization scope were not coextensive. The verdict certified a property the digest did not cover, and the coordinator trusted the certificate. ## Condition of Validity The invariant "verdict-agreement implies digest-agreement" holds only when the three following conditions are simultaneously true: - **C1 (predicate coverage):** the acceptance predicate evaluates over exactly the same state that the digest serializes — no more, no less. - **C2 (canonicalization identity):** all peers apply a byte-identical canonicalization function to tool outputs before digesting, including float formatting, map ordering, and Unicode normalization. - **C3 (profile pinning):** the sampling configuration that affects branch content (temperature, top-p, seed, model revision hash) is identical across peers at the bit level, not the float-parse level. In the observed deployment, C1 held (predicates were scoped to branch state), C2 failed intermittently (region-specific tool serializers), and C3 failed at profile-negotiation boundaries (float round-trip). The invariant is therefore *conditionally* valid, and the coordinator's reconciliation logic assumed it unconditionally. That assumption is the failure. ## Decision Boundary The coordinator must decide, per branch, whether verdict-agreement is sufficient to skip replay. The correct boundary is: - If `verdicts agree AND digests agree` → commit without replay. Safe only under C1∧C2∧C3. - If `verdicts agree AND digests disagree` → **replay is mandatory.** This is the divergent-but-accepted case; treating it as a redundant-checksum warning is the bug. - If `verdicts disagree` → replay is mandatory (existing behavior). The decision boundary that must be encoded as an invariant: **digest disagreement is a first-class replay trigger, independent of verdict.** A digest mismatch under verdict-agreement is strictly *more* urgent than a verdict mismatch, because it indicates the peers' local checks are not measuring the same thing — a condition that will silently corrupt every subsequent branch in the speculative tree. The guardrail is a two-dimensional reconciliation gate: replay triggers on `(verdict_a != verdict_b) OR (digest_a != digest_b)`, with the second disjunct routed to a *divergence-classification* path that attempts to localize the mismatch to one of the three structural signatures above before replay, so the coordinator can distinguish a benign canonicalization drift (replay and re-canonicalize) from a load-bearing reasoning divergence (replay and possibly prune the branch). ## Operational Effect When the gate is corrected, the observed 214 silent divergences become 214 classified replay events. Classification localizes 187 to canonicalization drift (fixable by enforcing a federation-wide canonicalization function at the transport layer, not the peer layer), 19 to reasoning-path aliasing (fixable by making the acceptance predicate path-sensitive or by digesting the reasoning tree, not just the leaf), and 8 to sampling residue (fixable by pinning sampling config by revision hash rather than float value). The residual operational cost is that replay is no longer a rare exception path — it fires on ~1.9% of branches. The coordinator must budget replay capacity accordingly, and the federation must treat digest-agreement as a *checked* invariant with a monitored violation rate, not an assumed one. A rising violation rate is the earliest structural signal that a peer's canonicalization or profile pinning has drifted, typically hours before any verdict-level inconsistency surfaces. The deeper lesson for federated speculative agents: **verdicts are lossy certificates; digests are the actual state.** Any reconciliation logic that gates on the lossy certificate will eventually commit a fork. Gate on the state. ```python class SpeculativeTreeForkError(RuntimeError): """Raised when verdict-agreement masks digest-divergence across federated peers, causing a speculative branch to be committed without mandatory replay.""" pass def reconcile_branch(branch_id: str, peer_a: dict, peer_b: dict, replay_fn) -> dict: verdict_agree = peer_a["verdict"] == peer_b["verdict"] digest_agree = peer_a["branch_digest"] == peer_b["branch_digest"] # Correct gate: replay triggers on EITHER dimension of disagreement. if not verdict_agree or not digest_agree: # Divergence classification before replay (canonicalization vs reasoning vs sampling). divergence_class = _classify(peer_a, peer_b) replayed = replay_fn(branch_id, peer_a["transcript_digest"]) if divergence_class == "sampling_residue" and not digest_agree: # A digest mismatch under verdict-agreement in a non-load-bearing leaf # is the silent-fork signature; never commit without replay. if replayed["digest"] not in (peer_a["branch_digest"], peer_b["branch_digest"]): raise SpeculativeTreeForkError( f"branch {branch_id}: replay digest {replayed['digest']} " f"matches neither peer ({peer_a['branch_digest']}, " f"{peer_b['branch_digest']}); federation tree has forked" ) return replayed # Only safe when C1 ∧ C2 ∧ C3 hold; assert coverage, do not assume it. if not _predicate_covers_digest_scope(peer_a): raise SpeculativeTreeForkError( f"branch {branch_id}: acceptance predicate does not cover digest scope; " f"verdict-agreement is not a valid replay-skip certificate" ) return {"committed": True, "branch_digest": peer_a["branch_digest"]} def _classify(a: dict, b: dict) -> str: if a["transcript_digest"] != b["transcript_digest"] and a["branch_digest"] == b["branch_digest"]: return "canonicalization_drift" if a["transcript_digest"] == b["transcript_digest"] and a["branch_digest"] != b["branch_digest"]: return "reasoning_path_aliasing" return "sampling_residue" def _predicate_covers_digest_scope(peer: dict) -> bool: return peer.get("predicate_scope") == peer.get("digest_scope") ```