{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-a-poisoned-tool-trace-nondeterministic-re-derivation-and-the-counterfactual-audit-invariant",
  "title": "What happens when an instance replays a poisoned tool trace: nondeterministic re-derivation and the counterfactual audit invariant",
  "date_of_record": "2026 December 1",
  "scope": "Applies to post-incident root-cause analysis of agentic traces where an auditor re-executes a recorded trajectory (or a counterfactual branch of it) against live or snapshot tooling. Does not apply to pure reasoning-only traces with no external tool calls, nor to forward execution during normal operation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-poisoned-tool-trace-nondeterministic-re-derivation-and-the-counterfactual-audit-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-poisoned-tool-trace-nondeterministic-re-derivation-and-the-counterfactual-audit-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-poisoned-tool-trace-nondeterministic-re-derivation-and-the-counterfactual-audit-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2007,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things an auditor can mean by \"replay.\" **Trace replay** re-feeds the recorded observations (tool outputs, retrieved chunks, peer messages) back into the model without re-invoking any external system. **Re-derivation** re-invokes the tools and lets them produce fresh outputs, then continues from those. Trace replay is deterministic in *input* b...",
    "what_was_observed": "A three-tool agent (search → fetch → summarize) failed to answer a customer query correctly. The recorded trace showed: search returned document IDs `[A, B]`; fetch(A) returned a 200 with body `X`; fetch(B) returned a 503; the agent summarized from `X` alone and omitted a fact that lived only in `B`'s body. During the audit, the harness was configured to \"replay\" the trace. But the fetch tool was registered with its ...",
    "condition_of_validity": "A counterfactual audit is only valid when the following invariant holds for every replayed step: > **Observation Provenance Invariant (OPI):** For each step *i* in the replayed trajectory, the observation fed to the model at step *i* must be bit-identical to the observation recorded at step *i* in the original trace, *unless* the step is explicitly marked as...",
    "decision_boundary": "The auditor must decide, per step, between three modes, and the decision is not free — it is forced by what the question is: - **\"Did the agent reason correctly given what it saw?\"** → trace replay, OPI enforced, decode pinned. Divergence in output is a finding about the model; divergence in input is a harness bug. - **\"What would the agent have done if tool...",
    "operational_effect": "The practical consequence is that **agentic traces must be captured as replayable artifacts at record time, not reconstructed at audit time.** This means: - Every tool call's full response (status, headers, body, latency, and any transport error) is persisted, not just the parsed result the agent consumed. - The decode configuration (model ID with hash, seed..."
  },
  "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": "86ee3c3cd3fc4b16946691c77555cf7524f8e8f00b73267a3e027f5600519e0b",
    "verified_classes": [
      "ReplayDivergenceError",
      "UnlabeledInterventionError",
      "RecordedStep",
      "ReplayHarness"
    ],
    "verified_functions": [
      "_hash",
      "step",
      "audit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayDivergenceError",
      "UnlabeledInterventionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
