# Under what conditions must an instance treat a session trace as non-replayable despite a byte-identical transcript **Date of Record:** 2026 November 26 **Scope:** Applies to forensic reconstruction of agentic session traces where the auditor replays a recorded transcript (prompts, tool calls, tool results, model outputs) against a live or sandboxed model and expects to reproduce the recorded decisions. Does not apply to traces captured with full nondeterminism instrumentation (sampling seeds, tool-side entropy logs, clock and RNG snapshots) where replay divergence is itself the measured quantity. ## Core Distinction The naive invariant is: *if the transcript is byte-identical on replay, the agent's decisions are identical.* This invariant fails because the transcript is a projection of the agent's actual state, not the state itself. A session trace records the **observable channel** — the messages, the tool arguments, the tool returns. It does not record the **latent channel** — the sampler state, the hidden tool-side nondeterminism (UUIDs, timestamps, filesystem ordering, network jitter), the retrieval index version, the context-window truncation boundary, and the model weight revision. Two traces can be byte-identical in the observable channel while the latent channel diverges, and the divergence produces a *different decision at a later step* even though every recorded step matches. The operational distinction the auditor must internalize: **transcript equality is a necessary but not sufficient condition for replay equality.** The sufficient condition requires that the latent state be equivalent at every decision point. When the trace does not carry enough latent-state evidence to establish that equivalence, the trace is *non-replayable* — and the correct forensic conclusion is "cannot reconstruct," not "reconstructed and it matched." ## What Was Observed A production incident: a customer-support agent made a refund decision at step 41 of a 60-step session. The decision was contested. The auditor pulled the trace, replayed it against the same model revision in a sandbox, and got a *different* decision at step 41 — the agent declined the refund on replay where it had approved it in production. The auditor then replayed a second time and got the original decision back. Third replay: declined again. Investigation of the trace revealed the following latent divergences, none of which appeared in the transcript: 1. **Tool-side nondeterminism in a retrieval call.** At step 12 the agent called `search_orders`, which returned three candidate orders. The recorded tool result listed them in the order `[A, C, B]`. The underlying index was a sharded vector store whose merge order depended on shard response latency. On replay, the sandbox returned `[A, B, C]`. The transcript recorded the *result list* but not the *ranking scores*, so the auditor could not tell whether the reordering reflected a different scoring pass or the same scores with a different merge order. The agent's step-41 decision hinged on which order was retrieved first, because the agent's prompt instructed it to "act on the most relevant order." 2. **Context truncation boundary drift.** The session had crossed the context window at step 33, triggering a summarization pass. The trace recorded the summary text but not the *token count at which truncation fired*. On replay, the summarizer ran against a slightly different tokenizer revision and produced a summary that omitted one clause — "customer has a prior refund within 30 days." That clause was the load-bearing fact for the step-41 decision. 3. **Sampler state.** The trace recorded `temperature=0.2` but not the seed. The production run's decision at step 41 was on a token boundary where the top-2 logits were within 0.03. Replay at the same temperature resampled and flipped the decision roughly 50% of the time, which matched the observed replay variance. 4. **Clock-dependent tool.** At step 7 a `check_eligibility` tool returned `true`; the tool's implementation compared `now()` against a policy window. The trace recorded the boolean, not the timestamp. On replay the sandbox clock was outside the window, and the tool returned `false` — but the auditor's replay harness *fed the recorded boolean back in* rather than re-invoking the tool, so this divergence was masked. The masking is itself a failure: it made the replay look more faithful than it was, because it silently substituted the recorded observable for the live latent state at exactly the point where the latent state mattered. The decisive finding: the trace was internally consistent, byte-identical on the observable channel, and **non-replayable** on the latent channel. The correct forensic output was a bounded claim — "the decision is consistent with the recorded observables under three latent-state hypotheses, two of which reproduce the approval and one of which does not" — not a binary "reproduced" or "did not reproduce." ## Condition of Validity A trace is replayable in the strong sense (replay reproduces decisions with bounded error) only when all of the following hold for every decision point in the trace: - **Sampler determinism is pinned.** Either the trace records the seed and the sampler configuration, or every decision point is verified to be outside the resampling-sensitive band (top-1/top-2 logit margin above a threshold, or the model is run at temperature 0 with a deterministic backend and that backend revision is recorded). Absent this, any decision adjacent to a token-boundary tie is non-replayable. - **Tool-side entropy is either recorded or re-invoked, not substituted.** For each tool call, the trace must either (a) carry the tool's full output including ordering, scores, and timestamps, or (b) the replay harness must re-invoke the tool against a pinned snapshot of the tool's input state. Substituting the recorded output for a live re-invocation is valid only when the tool is proven pure; otherwise it masks latent divergence and inflates apparent replay fidelity. - **Context-management events are instrumented.** Every truncation, summarization, or eviction event must record the trigger (token count, tokenizer revision, policy version) and the pre- and post-event content. A recorded summary without its trigger is a lossy projection: the replay cannot distinguish "same summary because same input" from "same summary by coincidence." - **Retrieval index version is pinned.** The trace must identify the index snapshot (version hash, shard layout, scoring model). Reordering of equal-score results is latent state; if the index is not pinned, the retrieval order is not reproducible and any downstream decision that depends on order is non-replayable. - **Model weight revision is exact.** "Same model family" is insufficient; the trace must carry the weight revision hash. Minor revisions change logit margins at exactly the boundary cases where replay diverges. When any of these conditions is unmet for a decision point, that decision point is **non-replayable**, and the trace's forensic value at that point is bounded to consistency-checking, not reconstruction. ## Decision Boundary The auditor must choose between three postures at each decision point, and the choice is driven by the latent-state evidence, not by transcript equality: | Latent-state evidence | Posture | Permitted forensic claim | |---|---|---| | All five conditions met | Strong replay | "Decision reproduced under recorded latent state; divergence bounded by sampler noise." | | Some conditions met, decision point outside sensitive bands (high logit margin, pure tools, no truncation in window) | Bounded replay | "Decision is consistent with recorded observables; latent divergence cannot be excluded but does not reach this decision under the stated hypotheses." | | Any condition unmet at a sensitive decision point (low logit margin, impure tool in the dependency chain, uninstrumented truncation) | Non-replayable | "Cannot reconstruct. The trace is a projection; the decision is underdetermined by the record." | The boundary is crossed when the decision point's *sensitivity* to latent state exceeds the trace's *resolution* of latent state. Sensitivity is measurable: logit margin, tool purity in the dependency chain, proximity to a truncation boundary, retrieval-order dependence. Resolution is auditable: which of the five conditions the trace satisfies. The non-replayable posture is the correct output when sensitivity exceeds resolution — and the most common forensic error is to default to bounded replay because the transcript matched. ## Operational Effect The practical consequence is that **trace capture must be designed for replayability, not for readability.** A trace that is readable — clean messages, tool calls, results — but does not carry sampler seeds, tool entropy, truncation triggers, index versions, and weight revisions is a forensic dead end at exactly the decision points that matter, because those are the points where the agent's behavior was sensitive to latent state. Three operational changes follow: 1. **Instrument the latent channel at capture time.** Log seed, sampler config, logit margins at each generation, tool input-state snapshots (not just outputs), truncation triggers with tokenizer revision, index version hashes, and weight revision. The cost is storage; the benefit is that replay becomes a measurement rather than a guess. 2. **Classify decision points at capture time, not replay time.** The capture harness knows the logit margin and the tool purity at the moment of generation. It should tag each decision point as replay-sensitive or replay-insensitive. This tag travels with the trace and tells the auditor which posture is available before replay begins. 3. **Treat substitution as a recorded event.** When the replay harness feeds a recorded tool output back in instead of re-invoking, that substitution must be logged as a divergence-masking event. A replay that substitutes at an impure tool is not a replay; it is a consistency check, and the forensic report must say so. The invariant that survives: **a trace is replayable if and only if its resolution of latent state meets or exceeds the sensitivity of every decision point it claims to reconstruct.** Transcript equality is neither necessary nor sufficient; it is a symptom that may coincide with replayability or may mask its absence. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class NonReplayableTraceError(RuntimeError): """Raised when a decision point's latent-state sensitivity exceeds the trace's latent-state resolution, making forensic reconstruction invalid.""" pass @dataclass class DecisionPoint: step: int logit_margin: float # top1 - top2; low margin => sampler-sensitive tool_purity: str # "pure" | "impure" | "unknown" near_truncation: bool # within N tokens of a context event retrieval_order_dependent: bool @dataclass class TraceLatentEvidence: seed_recorded: bool tool_entropy_recorded: bool truncation_trigger_recorded: bool index_version_pinned: bool weight_revision_exact: bool substitutions_logged: list = field(default_factory=list) MARGIN_THRESHOLD = 0.05 # below this, resampling can flip the decision def is_sensitive(dp: DecisionPoint) -> bool: return ( dp.logit_margin < MARGIN_THRESHOLD or dp.tool_purity != "pure" or dp.near_truncation or dp.retrieval_order_dependent ) def resolution_meets_sensitivity(dp: DecisionPoint, ev: TraceLatentEvidence) -> bool: if not is_sensitive(dp): return True if dp.logit_margin < MARGIN_THRESHOLD and not ev.seed_recorded: return False if dp.tool_purity != "pure" and not ev.tool_entropy_recorded: return False if dp.near_truncation and not ev.truncation_trigger_recorded: return False if dp.retrieval_order_dependent and not ev.index_version_pinned: return False if not ev.weight_revision_exact: return False return True def classify_replay_posture( decisions: list[DecisionPoint], evidence: TraceLatentEvidence ) -> str: sensitive = [d for d in decisions if is_sensitive(d)] if not sensitive: return "strong_replay" for dp in sensitive: if not resolution_meets_sensitivity(dp, evidence): raise NonReplayableTraceError( f"Step {dp.step}: latent sensitivity exceeds trace resolution " f"(margin={dp.logit_margin}, tool={dp.tool_purity}, " f"trunc={dp.near_truncation}, order={dp.retrieval_order_dependent}); " f"evidence={evidence}. Forensic claim must be 'cannot reconstruct'." ) return "bounded_replay" def reconstruct(decisions: list[DecisionPoint], evidence: TraceLatentEvidence) -> str: posture = classify_replay_posture(decisions, evidence) if evidence.substitutions_logged: # Substitutions at impure tools mask divergence; downgrade the claim. if posture == "strong_replay": posture = "bounded_replay" return posture ```