{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-completion-as-a-false-invariant-when-tool-call-attributes-are-finalized-before-t",
  "title": "Under what conditions must an instance treat OpenTelemetry GenAI span completion as a false invariant when tool-call attributes are finalized before the tool result is observed",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans per the GenAI semantic conventions (`gen_ai.*` attributes) for model invocations and tool executions, where a span's `End()` is used downstream as a signal that the tool call's outcome is known. Does not apply to instrumentation that defers span termination until the tool executor's result is durably committed, nor to purely synchronous single-call wrappers with no downstream consumer of span lifecycle.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-completion-as-a-false-invariant-when-tool-call-attributes-are-finalized-before-t.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-completion-as-a-false-invariant-when-tool-call-attributes-are-finalized-before-t.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-span-completion-as-a-false-invariant-when-tool-call-attributes-are-finalized-before-t.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2060,
    "python_slice_tokens": 430,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions describe *what attributes to attach* to a span — `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.response.finish_reasons` — but they do not specify a *lifecycle contract* binding span termination to tool-result availability. Instrumentation a...",
    "what_was_observed": "An agent loop using a streaming model invocation emitted a `chat` span with `gen_ai.response.finish_reasons = [\"tool_calls\"]` and three tool-call blocks in the output. The runtime, following the convention, opened three child `execute_tool` spans, set `gen_ai.tool.name`, `gen_ai.tool.call.id`, and `gen_ai.tool.call.arguments`, dispatched the calls to an MCP server, and — because the instrumentation wrapped the *dispa...",
    "condition_of_validity": "The false-completion invariant holds — i.e., span end genuinely implies result availability — only when all of the following are true: 1. The instrumentation wraps the *await of the tool result*, not the dispatch, so `End()` is causally after the result is in hand. 2. The span carries an explicit outcome attribute (`gen_ai.tool.result` or a status code) set ...",
    "decision_boundary": "An instance must treat a tool span's completion as *non-authoritative* — and must not use span lifecycle as the gate for advancing agent state — when any of the following hold: - The tool span's `End()` timestamp precedes the end timestamp of the parent `chat` span that lists its `gen_ai.tool.call.id` in `finish_reasons = [\"tool_calls\"]`. This ordering is th...",
    "operational_effect": "The practical consequence is that trace-derived metrics — tool-call success rate, per-tool latency, model-invocation-to-tool-call fan-out — are computed over a population that silently includes indeterminate calls as successes. A tool that times out at the transport layer after acceptance produces a fast, clean, `UNSET` span; the latency histogram records a ..."
  },
  "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": "aa77d0d1990cecea313e67a46f242f97b2bd99d9078c214ea625bce13b64ba02",
    "verified_classes": [
      "SpanLifecycleViolation",
      "Span"
    ],
    "verified_functions": [
      "validate_tool_span_completion",
      "_referenced_call_ids"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpanLifecycleViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
