{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-replay-divergence-when-reconstructing-multi-agent-sessions-from-otel-genai-span-graphs",
  "title": "Which invariants prevent replay divergence when reconstructing multi-agent sessions from OTel GenAI span graphs",
  "date_of_record": "2026 November 24",
  "scope": "Applies to offline deterministic replay of multi-agent sessions reconstructed from OpenTelemetry GenAI semantic-convention span graphs (`gen_ai.*` attributes, `trace_id`/`span_id`/`parent_span_id` DAGs) where replay re-invokes LLM and tool calls to reproduce a recorded run. Does not cover live tracing, sampling policy, or single-agent non-replayed observability pipelines.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-reconstructing-multi-agent-sessions-from-otel-genai-span-graphs.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-reconstructing-multi-agent-sessions-from-otel-genai-span-graphs.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-replay-divergence-when-reconstructing-multi-agent-sessions-from-otel-genai-span-graphs.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1653,
    "python_slice_tokens": 257,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A trace is a *causal record of what happened*. A replay is a *re-execution that must reproduce what happened*. OTel span graphs are lossy with respect to replay in exactly one dangerous way: they record **what the model returned**, not **the exact input bytes that produced it**, and they record **child completion order** only via timestamps, not via the caus...",
    "what_was_observed": "A three-agent session (planner → two concurrent workers → synthesizer) was recorded with GenAI spans. Replay was run against the recorded graph with a `temperature=0` model and stubbed tools that replayed captured outputs. Replay diverged on 41% of runs at the synthesizer step, despite identical span structure, identical seed, and identical tool stubs. The trace showed the synthesizer span carrying `gen_ai.prompt` as...",
    "condition_of_validity": "The replay-equivalence invariant holds only when all three of the following are enforced: 1. **Authoritative-input capture.** Every span that consumes an LLM input must record the *exact bytes* sent to the model (post-assembly, post-truncation, post-template), not the components from which it was assembled. `gen_ai.prompt` must be the final string, and repla...",
    "decision_boundary": "The boundary between replayable and non-replayable traces is not \"all spans present\" but \"all non-deterministic leaves carry authoritative bytes and all order-dependent fan-ins carry explicit order.\" A trace crossing the boundary in either direction: - **Replayable:** every LLM span has final prompt bytes; every tool span has transport-captured output bytes;...",
    "operational_effect": "Teams that enforce the three invariants see replay divergence drop to zero on recorded sessions and, critically, gain a *detectable* failure mode: non-replayable traces raise at replay time instead of silently producing a different session. Teams that rely on DAG completeness alone see divergence that is invisible in span counts, invisible in structural vali..."
  },
  "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": "8d7935e8432c9fc4f0fd2db556ba8517f704335b97eb73a620a65d02dfbc048b",
    "verified_classes": [
      "ReplayDivergenceError",
      "Span"
    ],
    "verified_functions": [
      "validate_replayable"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ReplayDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
