{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-a-causal-trace-graph-when-a-retrieval-span-s-parent-pointer-is-rewritten-by-a-retrying-tool-call",
  "title": "How should an instance reconcile a causal trace graph when a retrieval span's parent pointer is rewritten by a retrying tool call",
  "date_of_record": "2026 November 25",
  "scope": "Applies to observability pipelines that reconstruct causal trace graphs for agent runs by correlating prompt spans, retrieval spans, and tool-call spans via parent/child span IDs and timestamps. Does not cover single-call LLM logging without span linkage, nor metric-only telemetry where causality is not modeled.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-causal-trace-graph-when-a-retrieval-span-s-parent-pointer-is-rewritten-by-a-retrying-tool-call.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-causal-trace-graph-when-a-retrieval-span-s-parent-pointer-is-rewritten-by-a-retrying-tool-call.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-causal-trace-graph-when-a-retrieval-span-s-parent-pointer-is-rewritten-by-a-retrying-tool-call.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1607,
    "python_slice_tokens": 248,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *recording* an event and *attributing* it. A span recorder faithfully logs that a retrieval happened at wall-clock T with a given query string. A causal trace graph additionally asserts that this retrieval was *caused by* a specific prompt span and *consumed by* a specific tool-result span. The failure mode here lives entirely i...",
    "what_was_observed": "During a multi-step agent run (prompt → tool call → retrieval → synthesis), the tool call raised a transient error on attempt 1 and was retried as attempt 2. The runtime propagated the trace context by capturing `current_span` at the moment the tool was invoked. Attempt 1 captured span `S1`; the retry logic re-entered the tool wrapper but reused the *enclosing* context object, which still held `S1` as the active pare...",
    "condition_of_validity": "The misattribution is only possible when all of the following hold, which is the common case, not the edge case: 1. The tool wrapper reuses a captured context object across retry attempts instead of re-deriving the active span at invocation time. 2. The graph builder trusts `parent_span_id` exclusively and does not cross-check temporal containment (`child.st...",
    "decision_boundary": "When a child span's temporal bounds fall outside its declared parent's bounds, the builder faces a fork: - **Repair by temporal reattachment:** re-parent the orphan to the nearest span whose interval strictly contains it. This preserves causality at the cost of inferring an edge the runtime never asserted. Acceptable when the runtime is untrusted and the int...",
    "operational_effect": "Without this guardrail, the failure is a slow, compounding observability debt. Retrieval-utility dashboards undercount because retrievals attached to dead retry branches never contribute to a successful synthesis. Cost attribution charges failed attempts for retrievals they never used. Causal replay — reconstructing *why* an agent answered as it did — produc..."
  },
  "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": "b2a6db8e8e5a1a778772d7c33ba3cb3f153c4206a1227239e0a178469eca4a2e",
    "verified_classes": [
      "CausalAttributionError",
      "Span"
    ],
    "verified_functions": [
      "attach_to_parent",
      "reconcile_retry"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CausalAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
