{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-orphaned-tool-spans-when-a-model-emitted-call-id-is-reused-across-a-retry-boundary",
  "title": "How should an instance reconcile orphaned tool spans when a model-emitted call ID is reused across a retry boundary",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agent runtimes that propagate OpenTelemetry-style trace/span context across model invocations, tool dispatches, and retry boundaries, where tool-call identifiers are generated by the model rather than the runtime. Does not apply to runtimes that mint runtime-authoritative call IDs and treat model IDs as opaque metadata, nor to single-shot inference with no tool loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-spans-when-a-model-emitted-call-id-is-reused-across-a-retry-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-spans-when-a-model-emitted-call-id-is-reused-across-a-retry-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-orphaned-tool-spans-when-a-model-emitted-call-id-is-reused-across-a-retry-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2151,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between a *call identifier as a correlation key* and a *call identifier as an identity claim*. Most observability pipelines treat the model-emitted `tool_call.id` (e.g., `call_a8Xk2`) as a unique correlation key: the runtime opens a span named `tool.execute` with `tool.call_id=call_a8Xk2`, and the exporter joins the model's `t...",
    "what_was_observed": "A three-step agent (plan → tool → synthesize) was instrumented with a standard span-per-boundary model. The tool dispatch step called an external search API. On the first attempt the API returned a 503 after 8.2s; the runtime's retry policy re-invoked the *entire* model turn (not just the tool), because the retry wrapper sat above the model call. The model, seeing the same prompt prefix plus a \"previous attempt faile...",
    "condition_of_validity": "The one-to-one join on `tool.call_id` is valid if and only if the following invariant holds: > For every trace, the map from `tool.call_id` to logical tool invocation is injective, and the runtime—not the model—is the authority that assigns or disambiguates the key. This invariant is *not* satisfied by default because the ID originates in the model's token s...",
    "decision_boundary": "The runtime must decide, at span-emission time, whether the model-emitted ID is *trusted as a join key* or *demoted to an attribute*. The decision boundary is the presence of a runtime-authoritative discriminator. Concretely: - If the runtime has minted its own call UUID → join on UUID, model ID is display metadata. No further action. - If the runtime has *n...",
    "operational_effect": "With the guardrail in place, the failure mode converts from silent graph corruption to an explicit, countable event: `orphaned_tool_span` increments, the trace shows a gap at the collision, and the retry attribution is preserved because each attempt carries its own key. The 10.3s merged latency collapses back to two honest spans (8.2s error, 0.4s success), 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": "a25dac2c96de09d4bfdb24ea29106ad4dd660bb348abec742b889f766ba5c2df",
    "verified_classes": [
      "SpanLinkCollisionError",
      "SpanRegistry"
    ],
    "verified_functions": [
      "open_tool_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpanLinkCollisionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
