{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-attribution-when-otel-genai-spans-cross-an-agent-handoff-boundary",
  "title": "Why does an instance lose tool-call attribution when OTel GenAI spans cross an agent handoff boundary?",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-agent systems emitting OpenTelemetry GenAI spans (`gen_ai.*` semantic conventions) where a parent agent delegates a tool invocation or subtask to a child agent instance that runs in a separate process, model context, or execution runtime. Does not apply to single-process, single-agent traces where the tool call is executed inline within the same span context, nor to purely synchronous function calls that never cross an instance boundary.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-attribution-when-otel-genai-spans-cross-an-agent-handoff-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-attribution-when-otel-genai-spans-cross-an-agent-handoff-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-attribution-when-otel-genai-spans-cross-an-agent-handoff-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2189,
    "python_slice_tokens": 508,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" and it is not \"wrong parent_id.\" It is **attribution collapse at the GenAI attribute layer**: the child instance emits a well-formed `execute_tool` span with correct `trace_id`, correct `span_id`, and correct `parent_span_id` pointing at the delegating agent span — yet the `gen_ai.tool.name`, `gen_ai.usage.input_tokens`, an...",
    "what_was_observed": "A two-tier agent: a **Planner** (agent A) that decomposes a task and delegates a retrieval subtask to a **Retriever** (agent B) running in a separate worker. Both instrumented with the OTel GenAI conventions. Observed span sequence: - Agent A emits `invoke_agent` span `S_A` with attributes `gen_ai.agent.name=planner`, `gen_ai.operation.name=invoke_agent`, `gen_ai.usage.input_tokens=1840`, `gen_ai.usage.output_tokens=...",
    "condition_of_validity": "The invariant \"token totals and tool-call attribution are reconstructible from attributes alone\" holds **only if** every cross-instance handoff propagates a stable set of identity attributes as span attributes on the child's root span, not merely as trace context. Specifically, the child's `invoke_agent` span must carry: - the parent's `gen_ai.agent.name` (o...",
    "decision_boundary": "The boundary is between **topology-trusting** and **attribute-trusting** accounting, and it must be chosen per-query, not per-system: - If the backend guarantees full-trace retention (no sampling, no span drops) **and** the query engine can traverse arbitrary parent chains, topology-based attribution is *correct* but *fragile* — a single dropped span severs ...",
    "operational_effect": "When the boundary is crossed without attribute propagation, three concrete operational failures follow, in order of severity: 1. **Token-accounting drift under retry.** Retried delegations re-parent the child's token spend under a new parent invocation. Per-agent sums stay stable; per-task sums diverge from ground truth by the cost of every superseded attemp..."
  },
  "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": "5bef0cab08c14863a5b17834d5f2bd5e05a0c57597c55f106e497f36f6c14daf",
    "verified_classes": [
      "HandoffAttributionError",
      "HandoffEnvelope",
      "ChildRootSpan"
    ],
    "verified_functions": [
      "build_child_root_span",
      "verify_task_token_reconstructible"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "HandoffAttributionError"
    ],
    "sample_fail_closed_invariants": [
      "handoff envelope missing traceparent; cannot establish even topology"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
