{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-replay-diverge-when-non-deterministic-tool-outputs-are-re-sampled-during-trace-reconstruction",
  "title": "Why does an instance replay diverge when non-deterministic tool outputs are re-sampled during trace reconstruction?",
  "date_of_record": "2026 November 24",
  "scope": "Applies to post-hoc agent replay systems that reconstruct an execution trace by re-invoking the model and tools from recorded inputs, where any tool or sampling step is non-deterministic. Does not apply to replay systems that store and replay the full literal token/tool-output transcript (deterministic transcript replay).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-replay-diverge-when-non-deterministic-tool-outputs-are-re-sampled-during-trace-reconstruction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-replay-diverge-when-non-deterministic-tool-outputs-are-re-sampled-during-trace-reconstruction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-replay-diverge-when-non-deterministic-tool-outputs-are-re-sampled-during-trace-reconstruction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1625,
    "python_slice_tokens": 344,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two incompatible meanings of \"replay\" that observability tooling routinely conflates: - **Transcript replay** — the recorded sequence of tokens and tool results is fed back verbatim; the agent's state is a pure function of the log. Fully deterministic, but blind to *why* the model chose a branch. - **Re-derivation replay** — the harness re-executes...",
    "what_was_observed": "An agent executing a 14-step tool-use task (`plan → search → fetch → summarize → write`) was instrumented with a re-derivation replayer. The replayer recorded, per step: the exact prompt, the tool name, the serialized arguments, and the sampling seed. On reconstruction it re-issued each call. Step 4 was a `web_search` tool. The original run returned results ranked `[A, B, C]`; the replayed run returned `[A, C, B]` — ...",
    "condition_of_validity": "Re-derivation replay is only a faithful reconstruction of the original trajectory when, for every step `t`, the replayed tool output and sampled token equal the recorded output. This holds iff: 1. All tools are **referentially transparent** with respect to their recorded arguments (pure, or seeded and side-effect-free), **and** 2. Sampling is **deterministic...",
    "decision_boundary": "The operator must choose, per replay, between: - **Strict reconstruction** — pin tool outputs and sampled tokens from the log (transcript replay for the non-deterministic steps), re-derive only the deterministic reasoning. Divergence then genuinely reflects model instability. Cost: cannot explore counterfactuals on the pinned steps. - **Counterfactual replay...",
    "operational_effect": "Without the gate, two concrete harms follow. First, **false instability attribution**: model or prompt changes get blamed for divergence actually caused by a re-ranked search or a clock read, leading to spurious \"fixes\" that mask the real non-determinism. Second, **silent provenance loss**: a timestamp or random ID threaded through context mutates a downstre..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "2bac3601de393a4e86928da62650db9d5c83278b878e4d78fb100798102b38d9",
    "verified_classes": [
      "ReplayDivergenceError",
      "Step"
    ],
    "verified_functions": [
      "_h",
      "reconstruct"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
