{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-emits-tool-call-spans-that-satisfy-opentelemetry-genai-semantic-conventions-but-lose-causal-linkage-across-an-async-hand",
  "title": "What happens when an instance emits tool-call spans that satisfy OpenTelemetry GenAI semantic conventions but lose causal linkage across an async handoff",
  "date_of_record": "2026 November 20",
  "scope": "Applies to agents instrumented with OpenTelemetry GenAI semantic conventions (`gen_ai.*` attributes) where tool calls execute asynchronously and the span is closed by a different coroutine/thread than the one that opened it. Does not apply to synchronous, single-threaded tool invocation where parent-child span context is established and closed within the same execution frame.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-tool-call-spans-that-satisfy-opentelemetry-genai-semantic-conventions-but-lose-causal-linkage-across-an-async-hand.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-tool-call-spans-that-satisfy-opentelemetry-genai-semantic-conventions-but-lose-causal-linkage-across-an-async-hand.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-emits-tool-call-spans-that-satisfy-opentelemetry-genai-semantic-conventions-but-lose-causal-linkage-across-an-async-hand.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1813,
    "python_slice_tokens": 318,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two kinds of \"trace correctness\" that get conflated during instrumentation review. The first is **attribute conformance**: does the span carry the required `gen_ai.system`, `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, and token-usage attributes in the shape the convention specifies? The second is **causal linkage**: does the ...",
    "what_was_observed": "A planner agent emits a `gen_ai.chat` span for the reasoning turn that selects a tool. It then dispatches the tool call to an async executor (a worker pool, a queue consumer, or a `asyncio.create_task`). The `gen_ai.execute_tool` span is started inside the worker. The bug: the worker does not inherit the OTel `Context` because the task was spawned without `contextvars` propagation — the `ContextVar` holding the activ...",
    "condition_of_validity": "The invariant that must hold: **for every `gen_ai.execute_tool` span, `parent_span_id` must equal the `span_id` of the `gen_ai.chat` span whose output contained the `tool_call` with matching `gen_ai.tool.call.id`, and both must share a `trace_id`.** This invariant is valid only under the following conditions: 1. The tool-call authorization is synchronous wit...",
    "decision_boundary": "The boundary is: **can a replay auditor reconstruct the tool-call sequence from parent edges alone, without trusting string joins?** If yes — the trace is causally sound and attribute conformance is sufficient evidence. If no — the trace is attribute-valid but causally orphaned, and any verification that depends on ordering (did the agent call `search_index`...",
    "operational_effect": "The practical consequence is a **split-brain trace store**: the reasoning chain and the tool executions are both present, both spec-compliant, and both indexed by `trace_id` — but under different `trace_id` values. Dashboards that count `gen_ai.execute_tool` spans show correct volume. Dashboards that measure \"tool calls per reasoning turn\" show zero, because..."
  },
  "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": "ee322a34a7d32da2f6a802e2a5dc3623578388a41a5d03ce044a34ceadb73c64",
    "verified_classes": [
      "ToolSpanLinkageError"
    ],
    "verified_functions": [
      "dispatch_tool_call",
      "execute_tool_call",
      "format_traceparent",
      "extract_traceparent",
      "run_tool"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ToolSpanLinkageError"
    ],
    "sample_fail_closed_invariants": [
      "missing traceparent header on queued tool call"
    ],
    "stdlib_dependencies": [
      "contextvars",
      "opentelemetry"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
