# Under what conditions must an instance treat a replayed trace as authoritative: the non-determinism watermark boundary in telemetry-driven agent reconstruction **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose execution traces are captured as ordered telemetry (tool-call spans, sampling parameters, retrieval payloads) and later replayed for audit, debugging, or regression verification. Does not apply to pure-function eval harnesses where the model is replaced by a recorded fixture, nor to live-shadow replay where the original environment is still reachable. ## Core Distinction The failure mode is not "replay diverges from the original run." Divergence is expected and cheap to detect. The failure mode is **silent watermark collapse**: a replay that *appears* byte-identical at the output layer while having crossed a non-determinism boundary that makes the trace non-authoritative as evidence. Two traces can produce the same final answer through different internal paths, and a replay harness that compares only the terminal message will certify a poisoned or mis-ordered reconstruction as valid. The invariant that must hold for a trace to be authoritative is stronger than output equality: every *state-mutating* span in the replay must have observed the same precondition hash as the original span, and the set of spans whose preconditions could not be reproduced (because they depended on unrecorded stochastic or external state) must be empty or explicitly quarantined. We call the boundary where this stops holding the **non-determinism watermark**: the earliest span index at which the recorded telemetry is insufficient to reconstruct the precondition exactly. ## What Was Observed A multi-step agent performing a retrieval-augmented reconciliation task was traced with span-level telemetry: each tool call recorded `(span_id, tool, args_hash, precondition_state_hash, sampled_token_logprobs_topk, timestamp)`. The original run terminated in a refund decision. During replay, the harness re-fed the recorded retrieval payloads and re-invoked the model with `temperature=0` and a fixed seed. The replay produced the same final decision. It was certified as a faithful reconstruction. Three days later a discrepancy was found in the *reasoning*: the original run had, at span 7, received a retrieval payload that was truncated at 4,096 tokens (the vector store had a per-query cap that was later raised). The replay harness, reading the *current* store config, fetched an 11,204-token payload. The model, seeing more context, arrived at the same decision by a different chain — but the `precondition_state_hash` for span 8 (the write to the case ledger) differed from the original. The ledger write in replay carried a rationale string that never existed in production. The mechanism: **the telemetry recorded the model's inputs but not the environment configuration that shaped those inputs.** The retrieval cap was a mutable external parameter, and the replay resolved it against live config rather than the config snapshot at capture time. The watermark was at span 7 — the first span whose precondition depended on an unrecorded environment parameter — but the harness had no watermark check, so it replayed past the boundary and reported success. A second observation compounded it: the model's `sampled_token_logprobs_topk` at span 7 showed the top-1 token had logprob −0.02 and the top-2 had −0.04. Even with the *correct* truncated payload, `temperature=0` does not guarantee determinism across inference backends; the tie between top-1 and top-2 was within the numerical noise of a different GPU kernel. The replay backend happened to pick top-1 both times, masking that the span was *not* deterministically reproducible at all. The watermark was actually at span 7 for two independent reasons — config drift and near-tie sampling — and neither was surfaced. ## Condition of Validity A replayed trace is authoritative as evidence **if and only if** all three hold: 1. **Precondition hash closure.** For every replayed span `s_i`, `recompute_precondition(s_i) == recorded.precondition_state_hash[i]`. The precondition must include not just the tool args but the resolved environment config, the retrieval payload *as delivered* (post-truncation, post-rerank), and the model's effective decoding parameters. If any input to the precondition is resolved against live state rather than a captured snapshot, closure fails by construction. 2. **Sampling determinism margin.** For every model-invoking span, the recorded top-k logprobs must show a margin between the sampled token and the next-best token that exceeds the backend's measured numerical noise floor (empirically ~1e-2 in logprob for the reference kernel; this is backend-specific and must be calibrated, not assumed). A span whose sampled token sits inside the noise band is **non-reproducible** even at `temperature=0`, and any replay past it is a new execution, not a reconstruction. 3. **Watermark quarantine.** The harness must compute the watermark `w = min(i : span_i fails (1) or (2))` and refuse to certify any span `j >= w` as reconstructed. Spans before `w` are authoritative; spans at or after `w` are *re-executed* and must be labeled as such in the output artifact. The condition fails silently when the harness compares only terminal output, because terminal equality is neither necessary nor sufficient for trace fidelity. It is not necessary (a faithful replay can diverge in final output if the model is non-deterministic in a benign way) and not sufficient (as observed: different path, same answer). ## Decision Boundary The operational decision is: **at the watermark, do you halt, fork, or quarantine?** - **Halt** is correct when the trace is being used as audit evidence for a consequential action (a ledger write, a refund, a state transition with external effect). You cannot certify what you cannot reconstruct; the trace must be marked `PARTIAL` and the consequential span escalated to human or independent verification. - **Fork** is correct when the trace is being used for debugging or regression. Re-execute from the watermark with the *current* environment, but label the fork point explicitly so the divergence is attributable. Never merge forked spans back into the authoritative prefix. - **Quarantine** is the default for spans where the precondition hash matches but the sampling margin is inside the noise band: the span is *plausibly* reproducible but not *provably* so. Record it as `UNVERIFIED_DETERMINISM` rather than dropping it, because dropping it silently shortens the trace and can hide the very divergence you are auditing. The boundary condition that most often catches teams: a trace can pass precondition closure at every span yet still be non-authoritative, because closure checks *inputs* while authority requires *reproducibility of the transition*. These are different invariants. Input equality plus non-deterministic decoding yields a trace that looks closed but is not reproducible — the worst case, because it defeats the check that was supposed to catch it. ## Operational Effect Downstream consumers of the trace must treat the watermark as a hard partition. Metrics computed over spans `>= w` (latency attribution, cost accounting, decision-rationale extraction) are measurements of the *replay*, not the *original*, and must be tagged with the fork provenance. A common corruption is to aggregate cost across the full replayed trace and attribute it to production; when the replay fetched an 11k-token payload instead of 4k, the cost delta is real but belongs to the replay, not the incident. The guardrail is to make the watermark a first-class field in the trace artifact, computed at capture time where possible (record the config snapshot hash and the sampling margin per span) so that replay does not have to infer it from live state. Capture-time watermark annotation is the only way to make the boundary *stable* — a watermark computed at replay time against live config will drift as config changes, and a trace that was authoritative yesterday becomes non-authoritative today with no change to the trace itself. ```python import math from dataclasses import dataclass NOISE_FLOOR_LOGPROB = 1e-2 # calibrate per backend; do not assume class WatermarkViolation(RuntimeError): """Raised when a replay attempts to certify spans beyond the non-determinism watermark.""" pass @dataclass class Span: index: int recorded_precondition_hash: str replayed_precondition_hash: str sampled_logprob: float next_best_logprob: float def compute_watermark(spans: list[Span]) -> int: """Return the earliest span index that cannot be authoritatively reconstructed. Returns len(spans) if every span is reconstructable. """ for s in spans: if s.recorded_precondition_hash != s.replayed_precondition_hash: return s.index margin = s.sampled_logprob - s.next_best_logprob if margin < NOISE_FLOOR_LOGPROB: return s.index return len(spans) def certify_trace(spans: list[Span], claimed_authoritative_through: int) -> str: """Certify a replayed trace, refusing to certify past the watermark.""" w = compute_watermark(spans) if claimed_authoritative_through > w: raise WatermarkViolation( f"trace claims authority through span {claimed_authoritative_through} " f"but watermark is at span {w}; spans >= {w} are re-executions, not reconstructions" ) if w < len(spans): return f"PARTIAL: authoritative through span {w - 1}, forked at {w}" return "FULL: all spans reconstructed within determinism margin" if __name__ == "__main__": # Original run: span 7 truncated to 4k tokens; replay fetched 11k. Hash mismatch. # Also: span 7 top-1 vs top-2 margin = 0.02, below noise floor of 0.01? No — 0.02 > 0.01. # Construct the observed failure: hash mismatch at span 7 AND near-tie at span 7. spans = [ Span(i, f"h{i}", f"h{i}", -0.01, -0.50) for i in range(7) ] + [ Span(7, "h7_orig", "h7_replay", -0.02, -0.04), # hash drift + margin 0.02 ] try: certify_trace(spans, claimed_authoritative_through=len(spans) - 1) except WatermarkViolation as e: print(f"REJECTED: {e}") print(certify_trace(spans, claimed_authoritative_through=6)) ```