{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-otel-genai-span-graph-replay-from-silently-diverging-when-a-tool-span-s-non-deterministic-output-is-re-materialized-as-a-coun",
  "title": "Which invariants prevent OTel GenAI span-graph replay from silently diverging when a tool span's non-deterministic output is re-materialized as a counterfactual",
  "date_of_record": "2026 November 29",
  "scope": "Applies to counterfactual debugging of agent runs reconstructed from OpenTelemetry GenAI span graphs (`gen_ai.*` semantic conventions) where a replayer re-executes a subgraph after mutating one or more tool-call outputs. Does not apply to pure observational trace viewing, nor to replay where the entire run is re-executed against live services with no span-graph reconstruction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-otel-genai-span-graph-replay-from-silently-diverging-when-a-tool-span-s-non-deterministic-output-is-re-materialized-as-a-coun.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-otel-genai-span-graph-replay-from-silently-diverging-when-a-tool-span-s-non-deterministic-output-is-re-materialized-as-a-coun.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-otel-genai-span-graph-replay-from-silently-diverging-when-a-tool-span-s-non-deterministic-output-is-re-materialized-as-a-coun.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1945,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A trace is a *record of effects*; a counterfactual replay is a *re-derivation of a decision*. The two are only reconcilable if every node in the reconstructed span graph carries enough provenance to prove that its inputs were either (a) the recorded effect, or (b) an explicitly declared mutation. The failure mode here is not \"the replay gives a different ans...",
    "what_was_observed": "Across a set of instrumented agent runs (function-calling agents with 3–9 tool spans per trace), replaying a mutated subgraph produced a *false attribution rate*: the fraction of replays where the final answer differed from the recorded answer and the difference was blamed on the mutated span, but where at least one *unmutated* tool span had also changed value. In observed runs the false-attribution rate was non-triv...",
    "condition_of_validity": "The invariant that must hold for counterfactual replay to be sound: > **For every span S in the replayed subgraph, the value of every attribute in S's `gen_ai.*` namespace and every tool-result payload consumed by a descendant LLM span must be either (i) byte-identical to the recorded value, or (ii) covered by an explicit mutation record naming S and the att...",
    "decision_boundary": "The boundary between a *valid counterfactual* and a *corrupted replay* is crossed at the first span where: If this condition holds, the replay is **not attributable** to the mutation and must be rejected or re-run with S pinned. The hard part is computing the causal cone correctly: it is not the set of descendants in the span tree (that misses cross-span ref...",
    "operational_effect": "When the pinning invariant is enforced, counterfactual debugging becomes *attributable*: a difference in the final answer is provably caused by the mutation set, because every other span's inputs are byte-identical to the recording. When it is not enforced, the replayer produces plausible-looking diffs that misattribute causality—and because the span graph i..."
  },
  "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": "354f1aeb1058473814803471450afd2ef8c55720594e73b1b175e5d111a9d564",
    "verified_classes": [
      "ReplayPinningViolation",
      "Span"
    ],
    "verified_functions": [
      "assert_pinning_invariant"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ReplayPinningViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
