{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reject-opentelemetry-genai-spans-whose-gen-ai-tool-call-id-is-reused-across-loop-iterations-and-why-does-the-attribute-model-it",
  "title": "Where must an instance reject OpenTelemetry GenAI spans whose `gen_ai.tool.call.id` is reused across loop iterations, and why does the attribute model itself forbid the obvious fix?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent runtime that emits OTel GenAI semantic-convention spans for tool invocations and agent-loop iterations, and to any downstream collector, evaluator, or replay harness that joins spans by `gen_ai.tool.call.id`. Does not apply to runtimes that emit custom span schemas outside the GenAI conventions, or to single-shot tool calls with no loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-opentelemetry-genai-spans-whose-gen-ai-tool-call-id-is-reused-across-loop-iterations-and-why-does-the-attribute-model-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-opentelemetry-genai-spans-whose-gen-ai-tool-call-id-is-reused-across-loop-iterations-and-why-does-the-attribute-model-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-opentelemetry-genai-spans-whose-gen-ai-tool-call-id-is-reused-across-loop-iterations-and-why-does-the-attribute-model-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1579,
    "python_slice_tokens": 309,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat `gen_ai.tool.call.id` as a *correlation key* whose semantics are \"the identifier the model/provider returned for this specific tool call,\" not \"the identifier of the logical operation.\" These are different things the moment an agent loops. A retry, a re-plan, or a fan-out that re-invokes the same tool with the same argume...",
    "what_was_observed": "A planner-executor agent on a 40-iteration budget was instrumented per the GenAI conventions. The runtime computed `gen_ai.tool.call.id = sha1(tool_name + sorted_json(args))[:16]` so that \"the same call\" would correlate across retries — a deliberate choice to make dashboards stable. On a task that repeatedly called `read_file(path=\"config.yaml\")`, the following span sequence was emitted: - iteration 7: `execute_tool`...",
    "condition_of_validity": "The invariant holds only under the following condition: **`gen_ai.tool.call.id` must be unique within the trace (and, for cross-trace joins, within the session) and must be bound 1:1 to a single provider-issued tool-call event.** This is satisfiable only when the id is sourced from the provider's response (e.g., the `tool_calls[].id` field in a chat completi...",
    "decision_boundary": "The decision boundary is at span *emit* time, not at query time. A runtime must choose between two policies: 1. **Preserve-and-verify (correct):** take the provider-issued id, and if the provider did not issue one (some local tool runtimes synthesize calls), mint a fresh UUIDv7 per dispatch. Maintain an in-process set of ids seen in the current trace; on col...",
    "operational_effect": "Enforcing preserve-and-verify changes three downstream behaviors: - **Replay fidelity.** A replay harness can reconstruct the loop by sorting on `(trace_id, span start time)` and treating each call id as one step; duplicated ids no longer collapse iterations. - **Error attribution.** Evaluators that join tool errors to the originating `chat` span get the rig..."
  },
  "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": "e83c1ddf0433e9c9df6b812670e313ea8a7d542ac24d32eb746da67e6732f305",
    "verified_classes": [
      "DuplicateToolCallIdError",
      "ToolCallSpan",
      "TraceEmitter"
    ],
    "verified_functions": [
      "run_loop",
      "emit_tool_call",
      "args_hash"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "DuplicateToolCallIdError"
    ],
    "sample_fail_closed_invariants": [
      "assert len({s.call_id for s in out}) == len(out)"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
