{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-lineage-when-opentelemetry-genai-span-attributes-cross-an-async-agent-handoff",
  "title": "Why does an instance lose tool-call lineage when OpenTelemetry GenAI span attributes cross an async agent handoff?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans using the `gen_ai.*` semantic conventions (operation name, `gen_ai.tool.name`, `gen_ai.usage.input_tokens`/`output_tokens`, `gen_ai.request.model`) and that propagate context across asynchronous or deferred tool-call boundaries (queue-based executors, MCP servers, sub-agent delegation). Does not apply to single-process, synchronous, single-span chains where the LLM call and tool execution share one uninterrupted `Context`.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-lineage-when-opentelemetry-genai-span-attributes-cross-an-async-agent-handoff.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-lineage-when-opentelemetry-genai-span-attributes-cross-an-async-agent-handoff.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-lineage-when-opentelemetry-genai-span-attributes-cross-an-async-agent-handoff.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1817,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing telemetry.\" It is **attribute-level lineage breakage under context detachment**. OpenTelemetry's `gen_ai` conventions assume that a tool-call span is a *child* of the LLM span that emitted the call, so that `gen_ai.tool.name`, `gen_ai.tool.call.id`, and the parent's `gen_ai.usage.*` token counters can be read together as one coher...",
    "what_was_observed": "A sub-agent delegation flow produced the following trace shape after a deferred tool call: - Parent span `S_llm` (kind=CLIENT, `gen_ai.operation.name=chat`, `gen_ai.usage.input_tokens=8412`, `gen_ai.usage.output_tokens=203`) closes normally and exports. - The agent serializes a tool call `{name: \"search_docs\", call_id: \"call_7f3a\"}` into a job payload. The payload carries `trace_id` but **not** the parent `span_id` a...",
    "condition_of_validity": "The `gen_ai` tool-call lineage invariant holds **if and only if** the tool span's `SpanContext` is created with the LLM span as its explicit parent, and all inherited `gen_ai.*` attributes that the convention treats as ambient (`gen_ai.request.model`, `gen_ai.system`, `gen_ai.conversation.id`) are carried in the handoff payload rather than read from process-...",
    "decision_boundary": "The boundary is **whether the handoff payload is treated as the sole source of `gen_ai` ambient attributes, or whether the receiving context is allowed to reconstruct them from local state.** - If the payload carries `traceparent` (full `SpanContext`, including `span_id`) **and** a frozen snapshot of `gen_ai.request.model` / `gen_ai.system` / `gen_ai.convers...",
    "operational_effect": "The consequence is **silent cost and behavior misattribution, not telemetry loss**. Because every span is individually well-formed, standard schema validators and exporter health checks pass. The corruption surfaces only in aggregate queries: cost-per-invocation drops, tool-call-per-reasoning-step ratios go to zero, and model-level breakdowns split a single ..."
  },
  "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": "b4dda119c7c5c876d9b7e0fa6c0c497de76a8a9d3c9066f047545a8856922771",
    "verified_classes": [
      "GenAiLineageError",
      "ToolCallHandoff"
    ],
    "verified_functions": [
      "build_tool_span_context"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAiLineageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
