{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-a-model-emits-a-tool-call-whose-id-is-replayed-across-a-resumed-agent-run",
  "title": "How should an instance reconcile OpenTelemetry GenAI tool-call spans when a model emits a tool_call whose id is replayed across a resumed agent run",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that emit OpenTelemetry GenAI spans (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.response.id`) and that checkpoint/resume mid-run such that a model invocation is replayed. Does not apply to stateless single-shot inference with no persistence, nor to backends that key spans on `trace_id`+`span_id` alone without deduplicating tool-call ids.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-a-model-emits-a-tool-call-whose-id-is-replayed-across-a-resumed-agent-run.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-a-model-emits-a-tool-call-whose-id-is-replayed-across-a-resumed-agent-run.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-opentelemetry-genai-tool-call-spans-when-a-model-emits-a-tool-call-whose-id-is-replayed-across-a-resumed-agent-run.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1981,
    "python_slice_tokens": 496,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A model invocation event and a tool-call execution event are two different observability objects that share an identifier namespace in the GenAI semantic conventions. The model invocation span carries `gen_ai.response.id` (stable per provider response) while each tool call carries `gen_ai.tool.call.id` (stable per *emitted* call, not per *executed* call). On...",
    "what_was_observed": "A research agent with a 90-second tool timeout checkpointed its conversation state (messages + pending tool calls) to durable storage after each model turn. On resume, the driver replayed the last assistant message verbatim, re-extracted the `tool_calls` array, and re-dispatched each call. The tool executor emitted GenAI spans per the conventions: - parent span: `gen_ai.operation.name=chat`, `gen_ai.response.id=resp_...",
    "condition_of_validity": "The invariant that makes reconciliation possible: **for a given `trace_id`, the tuple (`gen_ai.response.id`, `gen_ai.tool.call.id`) must map to at most one *executed* tool-call span, and any additional span bearing the same tuple is a replay artifact that must be marked, not merged.** This holds only under three conditions: 1. The provider's `gen_ai.response...",
    "decision_boundary": "The boundary is between **replay-safe** and **replay-unsafe** call ids, and it is decided by whether the tool is idempotent *and* whether the driver dedupes on the execution ledger. - **Idempotent read tools** (`search_docs`, `read_file`): a duplicate span is a metrics artifact only. Reconcile by collapsing spans sharing (`response.id`, `tool.call.id`) to th...",
    "operational_effect": "Without the ledger, three effects compound: 1. **Cost and latency double-counting** in any dashboard that aggregates by `gen_ai.tool.name` — the most common GenAI SLO query — because replay spans are indistinguishable from fresh ones by attribute alone. 2. **Silent duplicate side effects** on non-idempotent tools, with the trace showing two successful spans ..."
  },
  "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": "a856a97c9f4a86f839e703791851ef8306a994da608d559e79dd9ac05d5b82b1",
    "verified_classes": [
      "ReplayReconciliationError",
      "ToolCallKey",
      "ExecutionRecord",
      "ExecutionLedger"
    ],
    "verified_functions": [
      "reconcile_resume",
      "emit_tool_span",
      "record_terminal",
      "lookup"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayReconciliationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "datetime",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
