{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-orphaned-tool-call-spans-from-silently-severing-causal-chains-in-eval-in-production-trace-pipelines",
  "title": "Which invariants prevent orphaned tool-call spans from silently severing causal chains in eval-in-production trace pipelines",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-turn agent runtimes that emit OpenTelemetry-style spans per LLM call and per tool invocation, then reconstruct causal DAGs downstream for eval-in-production hooks (online scoring, regression detection, reward attribution). Does not cover single-shot completion logging, batch offline eval, or trace storage retention policy.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-tool-call-spans-from-silently-severing-causal-chains-in-eval-in-production-trace-pipelines.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-tool-call-spans-from-silently-severing-causal-chains-in-eval-in-production-trace-pipelines.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-tool-call-spans-from-silently-severing-causal-chains-in-eval-in-production-trace-pipelines.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1971,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different notions of \"parent\" in an agent trace, and conflating them is the root of the failure. The **execution parent** is the span that was on the call stack when a child span was created—a runtime fact, captured at emit time. The **causal parent** is the span whose output *materially determined* the child's input—a semantic fac...",
    "what_was_observed": "A multi-turn agent with four tools (search, fetch, calculator, file-write) was instrumented with span emission at both the LLM-call boundary and the tool-dispatch boundary. Each LLM span recorded `input_tokens`, `output_tokens`, the sampled completion, and a `tool_calls[]` array (name + JSON arguments + a generated `call_id`). Each tool span recorded `tool_name`, `arguments`, `result`, and `parent_span_id`. The dispa...",
    "condition_of_validity": "The causal-edge invariant holds only when three conditions are jointly satisfied at reconstruction time: 1. **Uniqueness of `call_id` within a trace.** The `call_id` generated at sampling time must be globally unique within the trace, not merely within a turn. Frameworks that reset a per-turn counter (`call_0`, `call_1`, ...) violate this; two turns both emi...",
    "decision_boundary": "The boundary is between **structural parentage** (what `parent_span_id` says) and **causal parentage** (what `call_id` correspondence implies). The decision rule for the reconstruction layer: - If a tool span's `call_id` resolves to exactly one LLM span's `tool_calls[]` entry within the trace → the causal parent is that LLM span, **regardless of `parent_span...",
    "operational_effect": "Enforcing the invariant changes three behaviors. First, the phantom-regression class disappears: tool spans under worker-pool pressure no longer score `attribution=0.0`, because they either resolve causally or are excluded from the denominator. The faithfulness metric becomes stable across concurrency changes, which is what makes it usable as a model-upgrade..."
  },
  "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": "e99c355ad218080e9ed2296f8c2d1baf37bce7b3397492687f8596e9d83c598f",
    "verified_classes": [
      "CausalEdgeError",
      "ToolSpan",
      "LLMSpan"
    ],
    "verified_functions": [
      "resolve_causal_edge",
      "score_attribution"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CausalEdgeError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
