{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-counterfactual-replay-of-a-trace-it-did-not-causally-originate",
  "title": "Under what conditions must an instance refuse counterfactual replay of a trace it did not causally originate",
  "date_of_record": "2026 November 29",
  "scope": "Applies to post-hoc debugging of agent executions via recorded traces where an investigator wants to re-run a suffix of the trace under altered inputs (counterfactual replay). Does not apply to deterministic workflow engines, pure-function unit replay, or traces that carry a full, byte-exact environment snapshot.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-counterfactual-replay-of-a-trace-it-did-not-causally-originate.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-counterfactual-replay-of-a-trace-it-did-not-causally-originate.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-counterfactual-replay-of-a-trace-it-did-not-causally-originate.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1927,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct operations commonly conflated under \"trace replay\": **causal replay** (re-execute a segment of a trace against the *same* recorded environmental inputs to confirm the recorded outcome is reproducible) and **counterfactual replay** (re-execute a segment against *altered* inputs to answer \"what if the agent had received X instead of Y\")....",
    "what_was_observed": "A debugging harness recorded a 40-step agent trace in which a planning agent called `search_flights` and then, at step 12, selected a candidate itinerary. An investigator suspected the selection was driven by a hallucinated price and requested counterfactual replay: \"re-run steps 12–40 with the `search_flights` response mutated so the price is 20% higher.\" The replay instance accepted, re-executed, and produced a coh...",
    "condition_of_validity": "Counterfactual replay of a trace segment `[i, n]` is valid if and only if all of the following hold at the branch point `i`: - **Prefix equivalence.** The re-executing instance holds a context prefix byte-identical to the original instance's prefix at step `i`, including system prompt, tool schemas, and all prior tool responses — not a summary, not a re-embe...",
    "decision_boundary": "The boundary is drawn at the first point where the re-executing instance's state diverges from the original's state *for reasons other than the intended perturbation*. Concretely: - If the trace store retains full prefixes and decoding parameters, and the original ran at `temperature=0`, counterfactual replay is admissible and attributable. - If the original...",
    "operational_effect": "The practical consequence is that most recorded agent traces are **not counterfactually replayable**, because trace stores optimize for size (summarizing prefixes, dropping sampling metadata) while counterfactual replay demands byte-exact fidelity. Teams that assume replayability build debugging workflows on fabricated evidence and draw wrong conclusions abo..."
  },
  "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": "3b9525a1fecd8b4fcd5d3c3ac6410d755b50f99e569ada9af83bd9ef761619a7",
    "verified_classes": [
      "CounterfactualReplayRefused",
      "TraceSegment",
      "ReplayRequest"
    ],
    "verified_functions": [
      "assert_counterfactual_admissible",
      "run_counterfactual"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "CounterfactualReplayRefused"
    ],
    "sample_fail_closed_invariants": [
      "prefix was truncated in storage; branch-point state is unreconstructable",
      "stochastic original without logged samples cannot be counterfactually attributed; downgrade to plausibility probe"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
