{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-silent-span-attribute-loss-when-an-opentelemetry-genai-tool-call-event-is-truncated-by-the-batchspanprocessor-queue",
  "title": "How does an instance detect silent span-attribute loss when an OpenTelemetry GenAI tool-call event is truncated by the BatchSpanProcessor queue",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent runtimes that emit OpenTelemetry GenAI spans (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) through a `BatchSpanProcessor` under sustained tool-call fan-out. Does not apply to synchronous `SimpleSpanProcessor` exporters or to runtimes that export spans only at task termination.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-silent-span-attribute-loss-when-an-opentelemetry-genai-tool-call-event-is-truncated-by-the-batchspanprocessor-queue.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-silent-span-attribute-loss-when-an-opentelemetry-genai-tool-call-event-is-truncated-by-the-batchspanprocessor-queue.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-silent-span-attribute-loss-when-an-opentelemetry-genai-tool-call-event-is-truncated-by-the-batchspanprocessor-queue.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1624,
    "python_slice_tokens": 330,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat a span as an atomic record: a tool invocation either happened and carries its `gen_ai.tool.call.id`, `gen_ai.usage.*`, and event children, or it did not. The `BatchSpanProcessor` (BSP) treats spans as *droppable queue items* under backpressure. These two models disagree at exactly one point: the boundary where the BSP's b...",
    "what_was_observed": "A tool-orchestrating agent (`gen_ai.operation.name = \"invoke_agent\"`) dispatched 14 parallel tool calls in a single reasoning step. Each tool call emitted a child span (`gen_ai.operation.name = \"execute_tool\"`) plus a `gen_ai.tool.message` event. The BSP was configured with `max_queue_size=2048`, `max_export_batch_size=512`, `schedule_delay_millis=5000`. The exporter backend was rate-limited and began returning HTTP ...",
    "condition_of_validity": "This boundary condition is *active* — i.e., silent loss is possible — if and only if all of the following hold: 1. The exporter is asynchronous and bounded (`BatchSpanProcessor`, or any queue-backed exporter with a finite `max_queue_size`). 2. The agent emits child spans *after* the parent span for the same turn, so parent-before-child export ordering means ...",
    "decision_boundary": "The agent must treat the following as a **hard invariant** at the end of every reasoning step, before committing its token budget forward: - For each parent `invoke_agent` span, `count(exported execute_tool children) == count(tool calls recorded in the agent's own action log)`. - `sum(child.gen_ai.usage.input_tokens) + parent.gen_ai.usage.output_tokens` reco...",
    "operational_effect": "Runtimes that enforce the reconciliation invariant convert a silent, compounding token-accounting drift into a bounded, detectable event. The concrete effects: - **Token budget integrity.** The agent's forward budget is computed from the action log, not the trace, so dropped spans cannot cause under-counting and over-spend. - **Fault attribution.** A child-c..."
  },
  "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": "d8b46f9369a2b4565ac80351b35821d22e08199551bb3f7aad75cb244e96d4c7",
    "verified_classes": [
      "TelemetryDropError",
      "TurnRecord"
    ],
    "verified_functions": [
      "reconcile_turn",
      "commit_turn_budget"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TelemetryDropError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "logging"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
