{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-emit-a-genai-tool-call-span-the-gen-ai-tool-call-id-tool-call-id-correlation-invariant-under-retried-tool-execution",
  "title": "When must an instance refuse to emit a GenAI tool-call span: the `gen_ai.tool.call.id` ↔ `tool_call_id` correlation invariant under retried tool execution",
  "date_of_record": "2026 November 19",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*`) for tool/function invocations, where tool calls are retried, replayed, or fanned out across worker processes. Does not apply to pure LLM chat spans without tool execution, nor to non-OTel telemetry pipelines.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-genai-tool-call-span-the-gen-ai-tool-call-id-tool-call-id-correlation-invariant-under-retried-tool-execution.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-genai-tool-call-span-the-gen-ai-tool-call-id-tool-call-id-correlation-invariant-under-retried-tool-execution.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-genai-tool-call-span-the-gen-ai-tool-call-id-tool-call-id-correlation-invariant-under-retried-tool-execution.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1732,
    "python_slice_tokens": 290,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a tool-call span as an *observation of one execution attempt*, while agent orchestration treats a tool call as a *logical request with a stable identity that may be retried*. These two models collide on the `gen_ai.tool.call.id` attribute. The spec expects it to identify the tool call as the model emitted it (the `tool_ca...",
    "what_was_observed": "A tool-execution worker running an agent loop emitted, for a single logical call to `search_docs`, three spans over 4.2 seconds: - Attempt 1: `gen_ai.tool.call.id = \"call_ab12\"`, status `ERROR`, `error.type = \"TimeoutError\"`. - Attempt 2: `gen_ai.tool.call.id = \"call_ab12\"`, status `ERROR`, `error.type = \"TimeoutError\"`. - Attempt 3: `gen_ai.tool.call.id = \"call_ab12\"`, status `OK`, with `gen_ai.tool.call.result` pop...",
    "condition_of_validity": "The invariant that must hold is: > For any logical tool invocation `L` emitted by a model turn with identifier `c`, the set of exported spans `{S_i}` describing executions of `L` must satisfy: (a) exactly one span carries `gen_ai.tool.call.id = c` and is marked as the terminal/authoritative attempt, and (b) every retry span is linkable to `c` via a non-colli...",
    "decision_boundary": "The runtime must make an explicit, recorded decision at the retry site, not at export time. The boundary is: - **Idempotent tool + retryable error (timeout, 429, transient 5xx):** reuse `c` on the terminal span only; emit retry spans with `gen_ai.tool.call.id` *absent*, carrying `retry.attempt = n` and a span link to the terminal span. This preserves both un...",
    "operational_effect": "Enforcing the invariant changes three things downstream. Cost and latency aggregates become retry-aware (a call that took three attempts reports three attempts' latency, not one). Transcript reconstruction becomes exact, because the join key is unique and the retry history hangs off it via links rather than masquerading as separate calls. And replay auditors..."
  },
  "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": "03ca6d26da0b606c961420bf3cc6c8e41d31a11071e7b63eb48a6ed4e6288daa",
    "verified_classes": [
      "ToolCallIdentityCollision",
      "SpanRecord",
      "TraceSpanIndex"
    ],
    "verified_functions": [
      "emit_retry_span",
      "emit_terminal_span",
      "admit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ToolCallIdentityCollision"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
