{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-to-emit-opentelemetry-genai-agent-spans-when-the-tool-call-attribute-set-is-only-partially-resolvable-at-spa",
  "title": "In what scenarios must an instance refuse to emit OpenTelemetry GenAI agent spans when the tool-call attribute set is only partially resolvable at span-close time",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent runtime that instruments tool-invoking LLM loops with OpenTelemetry GenAI semantic conventions (`gen_ai.*` attributes) and closes spans before the full tool-call attribute set is known. Does not apply to pure inference spans with no tool dispatch, nor to batch offline trace export where span mutation before flush is permitted.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-opentelemetry-genai-agent-spans-when-the-tool-call-attribute-set-is-only-partially-resolvable-at-spa.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-opentelemetry-genai-agent-spans-when-the-tool-call-attribute-set-is-only-partially-resolvable-at-spa.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-opentelemetry-genai-agent-spans-when-the-tool-call-attribute-set-is-only-partially-resolvable-at-spa.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1181,
    "python_slice_tokens": 124,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as a *record of a completed operation*, not a mutable event log. The `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.operation.name`, and token-usage attributes (`gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens`) are defined at span-close. The failure mode is not \"missing attributes\" — it is **emitting ...",
    "what_was_observed": "An agent loop issued a `chat` request that returned a `tool_calls` array with two entries. The runtime dispatched tool A synchronously (resolved in 40ms) and tool B to an MCP server over a transport that timed out at the 5s span deadline. The span builder had already captured `gen_ai.tool.name` for A, set `gen_ai.usage.output_tokens=812`, and — because the span context manager exited at the deadline — closed the span...",
    "condition_of_validity": "A GenAI agent span is valid only if, at close, one of the following holds: 1. **Complete resolution:** every tool call in the model response has a corresponding child span with a matching `gen_ai.tool.call.id`, and token usage reflects the full round trip. 2. **Explicit incompleteness:** the span carries a sentinel (e.g., `gen_ai.agent.incomplete=true` plus ...",
    "decision_boundary": "The runtime must decide, at the moment the model turn completes but before tool dispatch resolves, whether the span can be closed synchronously. The decision rule: - If all tool calls are dispatched to resolvers with a bounded, synchronous-or-awaitable contract → await, then close with full attributes. - If any tool call is dispatched to an asynchronous tran...",
    "operational_effect": "Runtimes that violate this boundary produce traces that are individually well-formed but collectively lie about tool-call cardinality and token cost. The failure is invisible to schema validation and visible only to replay auditors that cross-check `tool_calls` length against emitted tool spans. The guardrail is a span-close gate that refuses to emit token-u..."
  },
  "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": "0ca2ef074cdf445ab4d0982285ce7d09d1df019e3e92db9df575c56122496652",
    "verified_classes": [
      "IncompleteGenAISpanError"
    ],
    "verified_functions": [
      "close_genai_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "IncompleteGenAISpanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
