{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-a-tool-span-whose-prompt-span-was-truncated-observability-correlation-loss-across-prompt-completion-and-tool-spa",
  "title": "What happens when an instance replays a tool span whose prompt span was truncated: observability correlation loss across prompt, completion, and tool spans in agent trace replay",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agent systems that persist distributed traces (prompt span → completion span → tool-call span) and later replay them for debugging, audit, or deterministic re-execution. Does not apply to live inference paths where spans are still resident in the active tracer's memory and have not yet been exported/truncated.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-tool-span-whose-prompt-span-was-truncated-observability-correlation-loss-across-prompt-completion-and-tool-spa.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-tool-span-whose-prompt-span-was-truncated-observability-correlation-loss-across-prompt-completion-and-tool-spa.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-tool-span-whose-prompt-span-was-truncated-observability-correlation-loss-across-prompt-completion-and-tool-spa.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1548,
    "python_slice_tokens": 234,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Observability correlation is not the same thing as *causal* correlation. A trace ID plus span-parent relationships tells you *which* spans belong to the same logical invocation. It does **not** tell you that the recorded prompt span contains enough information to reconstruct the exact input that produced the recorded completion, and therefore the recorded to...",
    "what_was_observed": "A three-span agent trace was captured for a retrieval-augmented tool call: - `prompt` span: attributes `gen_ai.prompt` recorded, but the exporter applied a 4 KiB cap. The original prompt was 11 KiB (system preamble + 6 retrieved chunks + tool schema). - `completion` span: full text of the model's function-call JSON, e.g. `{\"tool\":\"search\",\"args\":{\"query\":\"refund policy 2024\",\"filter\":\"region=EU\"}}`. - `tool` span: fu...",
    "condition_of_validity": "The correlation invariant holds only under the conjunction: 1. **Payload completeness:** every attribute the model conditioned on is present in the persisted prompt span, byte-for-byte, including tool schemas, retrieved context, and any system preamble injected by middleware. 2. **Deterministic reconstruction:** the prompt-assembly code path is versioned and...",
    "decision_boundary": "The boundary is not \"is the trace complete?\" but \"**can replay distinguish a faithful reconstruction from a plausible fabrication?**\" The decision rule for a replay harness: - If the prompt span carries an explicit `truncated` flag or its recorded length is below the `original_token_count` attribute, **abort replay** with a hard error. Do not fall back to re...",
    "operational_effect": "Downstream, the corrupted replay poisons three things at once: (a) the incident root-cause analysis attributes the divergence to the model rather than to truncation; (b) any auditor agent verifying the original agent's behavior accepts a fabricated reproduction as ground truth; (c) the tool span's recorded response and the replayed response are both \"valid\" ..."
  },
  "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": "2b681d00b3a1bea4e6adda6efa76a0eea95068ec6f716f499495241debbe8d4e",
    "verified_classes": [
      "ReplayCorrelationError",
      "SpanRecord"
    ],
    "verified_functions": [
      "assert_replayable"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ReplayCorrelationError"
    ],
    "sample_fail_closed_invariants": [
      "no prompt span retained; completion/tool spans are audit-only, not replayable",
      "incomplete span chain; cannot validate causal correlation",
      "span parent graph broken; structural correlation does not imply semantic correlation",
      "agent version not pinned to trace; prompt reassembly is advisory only"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
