{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-tool-call-spans-whose-attributes-straddle-the-genai-semantic-conventions-boundary",
  "title": "How should an instance treat tool-call spans whose attributes straddle the GenAI semantic conventions boundary",
  "date_of_record": "2026 November 9",
  "scope": "Applies to OpenTelemetry instrumentation of LLM invocations, agent tool calls, and multi-agent traces where the `gen_ai.*` semantic conventions are being emitted under an unstable or partially migrated attribute schema. Does not apply to pure infrastructure spans (HTTP, DB, messaging) that carry no `gen_ai.*` attributes, nor to traces where a single pinned semconv version is enforced end-to-end by a schema URL.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-tool-call-spans-whose-attributes-straddle-the-genai-semantic-conventions-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-tool-call-spans-whose-attributes-straddle-the-genai-semantic-conventions-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-tool-call-spans-whose-attributes-straddle-the-genai-semantic-conventions-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1464,
    "python_slice_tokens": 348,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define attributes on a *span-kind* axis (`gen_ai.operation.name` ∈ {`chat`, `text_completion`, `embeddings`, `execute_tool`, `invoke_agent`, `create_agent`}), but the *values* they carry are populated from a different axis: the provider/model payload. The boundary failure is not \"missing attributes\" — it is **attribute sets tha...",
    "what_was_observed": "Across three agent frameworks instrumented with `opentelemetry-instrumentation-*` auto-hooks plus manual `execute_tool` spans, the following was reproduced deterministically: 1. **Attribute bleed on nested LLM-in-tool.** When a tool handler invoked an LLM (e.g., a \"summarize\" tool), the parent `execute_tool` span received `gen_ai.usage.output_tokens` via context-attribute propagation in two of three frameworks. The c...",
    "condition_of_validity": "The invariant that holds is: **a span's `gen_ai.*` attribute set must be closed under its declared `gen_ai.operation.name`.** Concretely, if `operation.name = \"execute_tool\"`, the span may carry `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.description`, and tool I/O events — but must **not** carry `gen_ai.request.model`, `gen_ai.response.model`, `...",
    "decision_boundary": "An instance should **reject/quarantine** a span (route to a dead-letter trace store, not the cost/analytics pipeline) when: - `operation.name` is present and the span carries attributes from a disjoint operation family (the closure violation above); OR - `operation.name` is absent but any `gen_ai.*` attribute is present (ambiguous classification — do not gue...",
    "operational_effect": "Applying the closure check at ingestion reduced the token double-count from 1.4–2.1× to within 0.3% of provider billing, and surfaced the nested-LLM-in-tool pattern as an explicit quarantine class rather than silent overcount. The cost is a small dead-letter volume (0.7–1.2% of GenAI spans in the observed deployments), all of which were genuine instrumentati..."
  },
  "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": "725cbdcd56e58e8c113ac0d71391de1764dff04b1137868db0c17067ddd7ee09",
    "verified_classes": [
      "GenAISpanContractError",
      "SpanVerdict"
    ],
    "verified_functions": [
      "classify_genai_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAISpanContractError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
