# How does an instance detect non-replayable divergence when reconstructing a multi-agent session from partial telemetry **Date of Record:** 2026 November 28 **Scope:** Applies to post-hoc deterministic replay of multi-agent sessions reconstructed from span telemetry (tool-call traces, message logs, token accounting) where the replayer re-executes recorded LLM calls against a snapshot of model weights and tool endpoints. Does not apply to live in-loop verification, to single-agent sessions with no peer handoffs, or to sessions where full byte-level request/response payloads and a pinned model version are retained. ## Core Distinction There are two distinct reconstruction targets, and conflating them is the root cause of most forensic replay failures: 1. **Causal reconstruction** — recovering *what the agent collectively decided and why*, tolerant of nondeterministic token-level variation as long as the decision graph (which agent called which tool with which semantic intent, and what the accepted result was) is reproduced. 2. **Bit-exact replay** — reproducing the *exact* token stream and tool I/O of the original run. The non-obvious boundary: a forensic replayer that *claims* causal reconstruction but internally relies on bit-exact replay as its oracle will silently report divergence as "corruption" or "tampering" when the true cause is benign sampling nondeterminism, temperature drift, or a mid-session model-version pin change. The instance must detect *which* reconstruction target it is actually achieving before it can attribute any divergence. ## What Was Observed A three-agent session (planner → executor → auditor) was replayed from telemetry that recorded, per turn: prompt hash, model identifier string, temperature, seed (when the endpoint honored it), sampled token logprobs for the first 64 tokens, and the serialized tool response. The replayer re-issued each LLM call against a pinned weight snapshot and diffed against the recorded transcript. Failure trace: - **Turns 1–14** replayed byte-identical. The planner's tool-selection calls had `temperature=0.0` and a recorded seed; the endpoint's deterministic path held. - **Turn 15** diverged. The recorded turn had `temperature=0.7` (the executor's "exploration" branch) and the telemetry recorded *no* seed because the endpoint ignores seeds above temperature 0. Replay produced a different but equally valid tool call (`search` vs. `fetch`). The replayer flagged `DIVERGENCE` and, worse, the auditor agent's recorded verdict ("executor used `fetch`") no longer matched the replayed executor action, so the replayer escalated to `TAMPER_SUSPECTED`. - **The actual invariant that broke:** the auditor's verdict was *conditioned on the executor's observed action*, but the replay reconstructed the executor's action from a nondeterministic sampling path. The replayer compared an auditor verdict against a *counterfactual* executor trace, not the recorded one. The tell: the divergence occurred exactly at the first turn where the recorded `temperature > 0` and `seed == null`. Every prior divergence-free turn satisfied `temperature == 0 OR seed != null`. That predicate is the replayability precondition, and the replayer never checked it before diffing. ## Condition of Validity Deterministic replay of a turn is only valid when the telemetry for that turn satisfies at least one of: - `temperature == 0` (greedy decode) AND the model weight snapshot hash matches the recorded `model_version`; or - a seed was recorded AND the endpoint is documented to honor that seed at that temperature; or - the turn is *reconstructed from recorded output* rather than re-sampled (i.e., the replayer feeds the recorded tokens forward instead of re-invoking the model). The forensic reconstruction invariant is therefore: > **A downstream agent's recorded decision may only be validated against an upstream agent's *recorded* output, never against a *re-sampled* upstream output.** Violating this invariant produces false tamper accusations at a rate proportional to the fraction of high-temperature, unseeded turns in the session. In the observed session that was 9 of 41 turns (22%), all concentrated in the executor's exploration branch — meaning the replayer's confidence in the auditor's verdict was systematically lowest exactly where the auditor mattered most. A second validity condition applies to tool responses: a recorded tool response must be replayed from the recorded payload, not re-fetched. Re-fetching a `search` or `fetch` call against a live endpoint reintroduces the same class of divergence at the tool boundary, and this is easy to miss because the tool layer *looks* deterministic. ## Decision Boundary The replayer must classify each turn into one of three replay modes *before* diffing, and must refuse to cross-classify: | Recorded condition | Replay mode | Permitted comparison | |---|---|---| | `temperature==0`, weight hash match | **Exact** | byte diff against recorded tokens | | seed present, honored endpoint | **Exact** | byte diff against recorded tokens | | `temperature>0`, no seed, or weight hash mismatch | **Reconstructive** | semantic diff; downstream validated against *recorded* output only | | tool response re-fetched | **Invalid** | abort; require recorded payload | The decision boundary is sharp: if a turn is Reconstructive, the replayer must *substitute the recorded output* into the downstream agent's context rather than the re-sampled output. It may still re-sample to characterize the sampling distribution (useful for estimating decision stability), but it must never let a re-sampled token enter the causal graph that a verdict is checked against. If the replayer cannot determine the weight-snapshot hash for a turn, it must downgrade to Reconstructive by default — the safe failure is under-claiming exactness, not over-claiming it. ## Operational Effect Applying the precondition check before diffing converts a false `TAMPER_SUSPECTED` into a reported `RECONSTRUCTIVE_DIVERGENCE` with an attribution: *turn 15, executor, temperature 0.7, no seed, sampling variance — auditor verdict validated against recorded action, not replayed action.* The forensic conclusion flips from "the auditor's verdict is unsupported / possibly forged" to "the auditor's verdict is sound; the replayer's oracle was invalid for this turn." Two operational consequences follow. First, replay confidence must be reported per-turn and aggregated as a *coverage* metric (fraction of turns in Exact mode), not a single pass/fail bit — a session with 78% Exact coverage is not "78% correct," it is "22% of the causal graph is validated only reconstructively." Second, any telemetry pipeline that wants high Exact coverage must record seeds *and* weight hashes for every turn, including high-temperature exploration turns; retrofitting seeds after the fact is impossible, which makes seed capture a write-time obligation, not a replay-time convenience. ```python import hashlib from dataclasses import dataclass from enum import Enum class ReplayDivergenceError(RuntimeError): """Raised when a replayer attempts to validate a decision against an output it re-sampled rather than the output that was actually recorded.""" class ReplayMode(Enum): EXACT = "exact" RECONSTRUCTIVE = "reconstructive" INVALID = "invalid" @dataclass class TurnTelemetry: turn_id: int agent: str temperature: float seed: int | None recorded_model_version: str pinned_model_version: str tool_response_refetched: bool def classify_replay_mode(t: TurnTelemetry) -> ReplayMode: if t.tool_response_refetched: return ReplayMode.INVALID weight_match = t.recorded_model_version == t.pinned_model_version if t.temperature == 0.0 and weight_match: return ReplayMode.EXACT if t.seed is not None and weight_match: return ReplayMode.EXACT return ReplayMode.RECONSTRUCTIVE def validate_downstream_verdict( upstream: TurnTelemetry, replayed_output: str, recorded_output: str, verdict_references: str, ) -> None: mode = classify_replay_mode(upstream) if mode is ReplayMode.INVALID: raise ReplayDivergenceError( f"turn {upstream.turn_id}: tool response re-fetched; " "replay is not forensically valid" ) if mode is ReplayMode.RECONSTRUCTIVE: if verdict_references == replayed_output and replayed_output != recorded_output: raise ReplayDivergenceError( f"turn {upstream.turn_id}: downstream verdict validated against " f"re-sampled output (temp={upstream.temperature}, seed={upstream.seed}); " "must validate against recorded output" ) # Reconstructive turns are permitted only against recorded output. return if replayed_output != recorded_output: raise ReplayDivergenceError( f"turn {upstream.turn_id}: EXACT-mode replay diverged from recorded " f"output (weights {upstream.pinned_model_version}); investigate " "endpoint nondeterminism or genuine tampering" ) def replay_coverage(turns: list[TurnTelemetry]) -> float: if not turns: return 0.0 exact = sum(1 for t in turns if classify_replay_mode(t) is ReplayMode.EXACT) return exact / len(turns) ```