{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-causality-when-otel-genai-spans-cross-an-async-collector-boundary",
  "title": "Why does an instance lose tool-call causality when OTel GenAI spans cross an async collector boundary",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agent runtimes emitting OpenTelemetry GenAI semantic-convention spans (`gen_ai.*` attributes) for model invocations and tool executions that traverse an asynchronous collector pipeline (batching exporter → collector → backend). Does not apply to synchronous in-process exporters that flush per-span, nor to non-GenAI span trees.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-causality-when-otel-genai-spans-cross-an-async-collector-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-causality-when-otel-genai-spans-cross-an-async-collector-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-causality-when-otel-genai-spans-cross-an-async-collector-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1491,
    "python_slice_tokens": 191,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **span-tree structural correctness** and **causal attribute correctness**. A GenAI span tree can be perfectly valid by OTel structural rules—every `gen_ai.tool.call` span has a parent `gen_ai.chat` span, `trace_id`/`span_id` are well-formed, no orphan spans—while the *semantic linkage* between a tool result and the mod...",
    "what_was_observed": "A multi-step agent executing a plan of `chat → tool → chat → tool → chat` emitted spans that, when read back from the backend, showed a consistent corruption: the second and third `gen_ai.chat` spans referenced tool results whose originating `gen_ai.tool.call.id` no longer matched any emitted tool span. The reconstruction logic that paired a tool result to its requesting turn (via the `gen_ai.tool.call.id` attribute ...",
    "condition_of_validity": "The invariant that must hold for causal reconstruction to survive the pipeline is: > For every `gen_ai.tool.call.id` value referenced in a model span's prompt/response payload, exactly one `gen_ai.tool.call` span in the same `trace_id` must carry that value as a span attribute **at the point of backend ingestion**, and the attribute must be present before an...",
    "decision_boundary": "The boundary is between **treating GenAI attributes as schema-validated structural metadata** versus **treating linkage attributes as a referential-integrity surface that must be protected end-to-end**. The decision rule: - If the pipeline contains *any* attribute-mutating processor (allowlist, denylist, `transform`, `attributes`), then every `gen_ai.tool.ca...",
    "operational_effect": "The practical consequence is a **silent downgrade from causal to structural observability**. Dashboards counting tool spans still work; latency attribution still works; but any agent-debugging workflow that reconstructs the reasoning chain from traces—\"the model asked for tool X, got result Y, then produced Z\"—breaks at the first tool call after the first ba..."
  },
  "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": "6ae54fa0385e0e4b94a7326b74642e8f6a6f023412bdd3ebaa53c8aff538f9df",
    "verified_classes": [
      "GenAICausalityViolation"
    ],
    "verified_functions": [
      "assert_tool_call_causality"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "GenAICausalityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
