{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-line-between-semantic-convention-attribution-and-span-level-truth-when-a-tool-call-is-retried-under-a-new-span",
  "title": "Where must an instance draw the line between semantic-convention attribution and span-level truth when a tool call is retried under a new span?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any agent runtime that emits OpenTelemetry-style GenAI semantic conventions (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.usage.*`, `gen_ai.response.id`, retrieval span attributes such as `gen_ai.data_source.id` and document IDs) and that also retries tool invocations or re-runs retrieval under a fresh span. Does not cover purely in-process logging without a span model, nor billing reconciliation that reads directly from provider invoices.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-semantic-convention-attribution-and-span-level-truth-when-a-tool-call-is-retried-under-a-new-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-semantic-convention-attribution-and-span-level-truth-when-a-tool-call-is-retried-under-a-new-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-line-between-semantic-convention-attribution-and-span-level-truth-when-a-tool-call-is-retried-under-a-new-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1713,
    "python_slice_tokens": 291,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions describe *what the model or tool did* at the level of a single logical operation. Spans describe *when and how many times the runtime attempted it*. These two axes are orthogonal, and the conventions deliberately do not define a retry-attribution rule: `gen_ai.tool.name` is a property of the invocation, not of the attempt, whil...",
    "what_was_observed": "A retrieval-augmented agent executing a `search_docs` tool against a flaky vector backend was instrumented with the GenAI conventions. On the happy path each call emitted one `execute_tool` span with `gen_ai.tool.name=search_docs`, `gen_ai.operation.name=execute_tool`, and a retrieval child span carrying `gen_ai.data_source.id` plus the returned document IDs. Under a 4xx-then-200 retry policy (retry on `503`, max 3 a...",
    "condition_of_validity": "The single-span-equals-single-call assumption is valid only when all of the following hold: - The retry policy is *attempt-transparent*: retries reuse the same span (span events for each attempt) rather than opening new spans. This is the only configuration in which the conventions' per-span attributes remain a faithful attribution unit. - No re-serializatio...",
    "decision_boundary": "The runtime must decide, per tool invocation, between two attribution regimes: - **Attempt-transparent (default):** retries are span events on one span. Attribution key = `span_id`. Valid only if the tool executor can be re-entered without re-emitting a span, which requires the retry loop to live *inside* the span scope. This is fragile because it couples re...",
    "operational_effect": "Adopting attempt-explicit attribution changes three operational behaviors: 1. **Cost dashboards must `COUNT(DISTINCT gen_ai.call.id)` and `SUM` usage per call, not per span.** Per-tool cost becomes comparable across flaky and reliable tools, restoring the ranking that the naive sum inverted. 2. **Provenance joins must key on `gen_ai.call.id`, not on `tool.na..."
  },
  "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": "8ab7a1ff9a1ae39111f75dab2eaae04b15cd7eb39eb93a212dddb2e570ebb67f",
    "verified_classes": [
      "AttributionInvariantError",
      "Attempt",
      "LogicalCall"
    ],
    "verified_functions": [
      "attribute",
      "add_attempt",
      "attributed_tokens",
      "terminal_retrieval_docs"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AttributionInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
