{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-the-model-invocation-span-closes-before-the-tool-result-is-attributed",
  "title": "Where must an instance reconcile OpenTelemetry GenAI tool-call spans when the model invocation span closes before the tool result is attributed?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that emit OpenTelemetry `gen_ai.*` spans per the GenAI semantic conventions, where a single model invocation requests one or more tool calls that execute asynchronously or in a child agent. Does not apply to synchronous single-shot completions with no tool calls, or to tracing systems that do not export span end-times independently of attribute mutation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-the-model-invocation-span-closes-before-the-tool-result-is-attributed.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-the-model-invocation-span-closes-before-the-tool-result-is-attributed.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-the-model-invocation-span-closes-before-the-tool-result-is-attributed.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1620,
    "python_slice_tokens": 286,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" or \"dropped attributes.\" It is a *temporal attribution boundary*: the GenAI conventions require tool-call outcome attributes (`gen_ai.tool.call.id`, `gen_ai.tool.name`, and the result/error status) to be recorded on a span, but the model-invocation span (`gen_ai.operation.name = chat`) is conventionally ended when the compl...",
    "what_was_observed": "A tool-using agent emits, per turn: 1. A `chat` span opened at request dispatch, closed the moment the streaming completion finalizes. Attributes: `gen_ai.request.model`, token counts, `gen_ai.response.finish_reasons = [\"tool_calls\"]`. 2. One `execute_tool` span per requested call, opened when the tool actually runs—after the `chat` span has already ended. Because the convention ties `gen_ai.tool.call.id` to the *too...",
    "condition_of_validity": "The inversion is benign only under a narrow condition: the tool executes *within* the `chat` span's lifetime (i.e., the runtime blocks on tool execution before closing the invocation span), **or** the backend does not enforce parent-child temporal ordering. Neither holds for streaming agents with concurrent tool dispatch, which is the default for modern tool...",
    "decision_boundary": "The reconciliation decision: **when the model invocation span closes, does the runtime (a) hold it open until all requested tools resolve, (b) close it and emit explicit span links, or (c) close it and rely on parent-child with inverted timestamps?** - (a) is correct for causality but corrupts invocation latency—`chat` duration now includes tool time, defeat...",
    "operational_effect": "Downstream consumers must be re-derived, not patched: - **Cost attribution** keyed on `chat` spans under-counts turns that fan out to tools; per-tool cost must be summed from `execute_tool` spans joined by link, not by temporal containment. - **Replay auditors** that filter by `timestamp <= parent.end_time` must instead follow links; the timestamp filter is ..."
  },
  "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": "c8de0f88904b2557bb3bea7e8b3a70d85c0bd6235f1cb5f66c49111391d5d422",
    "verified_classes": [
      "TraceAttributionError",
      "Span"
    ],
    "verified_functions": [
      "validate_genai_trace"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TraceAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
