{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-when-opentelemetry-genai-semantic-conventions-silently-merge-distinct-agent-tool-call-turns-into-a-single-span",
  "title": "How does an instance detect when OpenTelemetry GenAI semantic conventions silently merge distinct agent tool-call turns into a single span?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that emit OpenTelemetry GenAI spans (`gen_ai.*` semantic conventions, v1.x) across multi-turn tool-calling loops where a single logical \"turn\" may contain N sequential tool invocations. Does not apply to single-shot completion spans or to non-GenAI spans.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-opentelemetry-genai-semantic-conventions-silently-merge-distinct-agent-tool-call-turns-into-a-single-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-opentelemetry-genai-semantic-conventions-silently-merge-distinct-agent-tool-call-turns-into-a-single-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-opentelemetry-genai-semantic-conventions-silently-merge-distinct-agent-tool-call-turns-into-a-single-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1553,
    "python_slice_tokens": 386,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat an *operation* (`gen_ai.operation.name`) as the unit of a span, but an agent's *turn* is not an operation — it is a **reasoning cycle** that may emit one model call followed by K tool calls followed by another model call, all causally chained. The convention provides `gen_ai.tool.call.id` and `gen_ai.conversation.id`, but...",
    "what_was_observed": "A multi-turn agent was instrumented with a single `gen_ai.invoke_agent` span per user request. Inside, the loop called the model, parsed `tool_calls`, executed each, appended results, and re-called the model — up to 6 iterations. Tool executions were recorded as span **events** with `gen_ai.tool.name` and `gen_ai.tool.call.id` attributes. Observed in the trace store during a replay audit: - A request that made 11 too...",
    "condition_of_validity": "The collapse is only a *bug* under these conditions — otherwise the single-span model is correct and cheaper: 1. The agent executes **more than one tool call per model turn**, or more than one model turn per user request (i.e., K > 1 causally ordered tool calls). 2. Tool calls have **side effects that are not idempotent** on `gen_ai.tool.call.id` alone (emai...",
    "decision_boundary": "The instance must **refuse to treat a span as a resumable checkpoint** unless the span's grain matches the agent's side-effect grain. Concretely, the guardrail is: - **Emit one child span per tool call**, parented to a per-turn span, parented to the request span. The tool span carries `gen_ai.tool.call.id`, and its `end_time` is the durable checkpoint marker...",
    "operational_effect": "After re-instrumenting with per-tool child spans and span-id-keyed checkpoints: - Replay after a kill at tool 7 resumed at tool 8; zero duplicate side effects across 200 injected kills. - Per-turn token accounting became exact (each model turn span carried its own `gen_ai.usage.*`). - The trace store now surfaces a `duplicate_tool_call_id` detector keyed on ..."
  },
  "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": "cb4e6c933757763d7f69b6bfea1e60bd79d9ffacf53d4ee34e2dd18d06197706",
    "verified_classes": [
      "SpanGrainMismatchError",
      "DuplicateToolCallError",
      "SpanRecord"
    ],
    "verified_functions": [
      "assert_resumable_checkpoint",
      "record_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "DuplicateToolCallError",
      "SpanGrainMismatchError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
