{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-attribute-span-cost-when-otel-context-propagation-severs-at-a-tool-call-boundary",
  "title": "Where must an instance attribute span cost when OTel context propagation severs at a tool-call boundary",
  "date_of_record": "2026 November 27",
  "scope": "Applies to multi-turn LLM agents emitting per-turn cost and latency attribution as OpenTelemetry metrics/spans, where turn boundaries are inferred from span parentage. Does not apply to single-shot inference calls or to systems that bill from an out-of-band ledger keyed on request IDs rather than trace topology.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-cost-when-otel-context-propagation-severs-at-a-tool-call-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-cost-when-otel-context-propagation-severs-at-a-tool-call-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-attribute-span-cost-when-otel-context-propagation-severs-at-a-tool-call-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1580,
    "python_slice_tokens": 276,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that governs everything below is between **logical turn identity** and **trace-tree parentage**. A turn is a logical unit: one model invocation plus the tool calls it spawns and the synthesis that consumes their results. Trace parentage is a *transport artifact*: whichever `traceparent` header survived serialization across each hop. Most obse...",
    "what_was_observed": "A three-tool agent turn (retrieve → rerank → summarize). The orchestrator opened turn span `T1` with `trace_id=X`, `span_id=a`. It invoked the retrieve tool over a subprocess boundary. The subprocess was launched without `TRACEPARENT` in its environment, so its OTel SDK initialized a **new root**: `trace_id=Y`, `span_id=b`. The rerank tool, invoked over HTTP by the same orchestrator, *did* propagate headers and corre...",
    "condition_of_validity": "Per-turn attribution via trace parentage is valid **if and only if** every span that incurs cost is a descendant, within a single `trace_id`, of exactly one active turn span, and no cost-bearing span is a trace root. This invariant holds only when all three of the following are true: 1. **Context propagation is total** across every execution boundary the tur...",
    "decision_boundary": "The boundary is whether to **trust parentage** or **assert lineage explicitly**. Trust parentage when the turn executes entirely in-process and all tools are synchronous. Assert explicit lineage — carry a turn token (`turn_id`) as a span attribute on *every* emitted span regardless of trace topology, and aggregate on `turn_id`, not `trace_id` — the instant a...",
    "operational_effect": "With explicit turn-token attribution, the retrieve tool's cost rejoins `T1` even though its spans live under a different `trace_id`. The per-turn dashboard reconciles with total spend. Crucially, the reconciliation itself becomes a **guardrail**: define the invariant `sum(per-turn cost) == sum(all cost-bearing spans)` and alert on any residual. A nonzero res..."
  },
  "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": "7786858d68fc7d83d89a7174026f3c0f1b40f3093d31a257c38b662a908b16ca",
    "verified_classes": [
      "AttributionInvariantViolation"
    ],
    "verified_functions": [
      "reconcile_turn_costs"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "AttributionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
