{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-emit-a-gen-ai-tool-call-span-orphaned-tool-span-attribution-under-concurrent-multi-turn-replay",
  "title": "When must an instance refuse to emit a `gen_ai.tool.call` span: orphaned tool-span attribution under concurrent multi-turn replay",
  "date_of_record": "2026 December 3",
  "scope": "Applies to agents that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.conversation.id`, `gen_ai.agent.id`) for tool invocations across multi-turn conversations, especially when turns are replayed, retried, or resumed from a checkpoint. Does not apply to single-shot, single-turn inference calls with no tool execution, nor to pure transport-level tracing (HTTP/gRPC) wrapping the model call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-gen-ai-tool-call-span-orphaned-tool-span-attribution-under-concurrent-multi-turn-replay.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-gen-ai-tool-call-span-orphaned-tool-span-attribution-under-concurrent-multi-turn-replay.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-emit-a-gen-ai-tool-call-span-orphaned-tool-span-attribution-under-concurrent-multi-turn-replay.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2538,
    "python_slice_tokens": 414,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between a *tool call as an event in the model's reasoning* and a *tool span as a record of an executed side effect*. The GenAI semantic conventions model the tool span as a child of the agent/inference span, keyed by `gen_ai.tool.call.id` (the model-emitted call identifier) and correlated to the conversation via `gen_ai.conver...",
    "what_was_observed": "A three-turn agent handling a refund workflow. Turn 2 emits a tool call: The tool executes and commits a refund of $40. The span is closed with `status = OK`. The process then crashes *after* the side effect commits but *before* the turn checkpoint is durably written (checkpoint write is the last step of the turn). On resume, the orchestrator reloads the last durable checkpoint — end of turn 1 — and replays turn 2. T...",
    "condition_of_validity": "The tool-span model is valid only when all three of the following hold: - **Single execution per call id.** Each `gen_ai.tool.call.id` maps to at most one executed side effect within the trace's scope. Replays that re-execute must either reuse the original call id (and thus the original span, via span re-emission with the same `trace_id`/`span_id` — which th...",
    "decision_boundary": "The boundary is a single predicate evaluated at span-emission time, before the span is handed to the exporter: > *Is this tool call's execution attributable to a side effect that is not already represented by another span in a reachable trace?* Operationally, the instance must check, in order: 1. **Replay detection.** Does the current turn's checkpoint gener...",
    "operational_effect": "Downstream consumers of GenAI traces — cost attribution, audit replay, SLO computation, and the agent's own episodic memory distillation — all assume the replay invariant. When it is violated silently: - **Cost attribution double-counts.** Two `OK` tool spans for one refund inflate the tool-call cost line by 2×; the billing reconciliation drifts from the led..."
  },
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "f10905003c5ec87cbb2e4f463cc8402f28a18a43133b10b4192f7505b4e4e3a1",
    "verified_classes": [
      "OrphanedToolCallError",
      "ToolCallEmission"
    ],
    "verified_functions": [
      "validate_tool_span_attribution",
      "emit_tool_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedToolCallError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
