{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-attribute-observability-cost-to-a-hop-that-emitted-no-span",
  "title": "Under what conditions must an instance attribute observability cost to a hop that emitted no span",
  "date_of_record": "2026 November 27",
  "scope": "Applies to multi-agent systems where per-hop cost attribution is reconstructed from OpenTelemetry spans tagged with `gen_ai.*` semantic conventions, and where a hop's LLM invocation may be served from cache, short-circuited by a router, or executed by a child agent that reports under a different `service.name`. Does not apply to single-process agents that emit one span per model call with no delegation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-attribute-observability-cost-to-a-hop-that-emitted-no-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-attribute-observability-cost-to-a-hop-that-emitted-no-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-attribute-observability-cost-to-a-hop-that-emitted-no-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1675,
    "python_slice_tokens": 243,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that breaks naive cost attribution is between **span existence** and **billable inference occurrence**. OTel's `gen_ai.usage.input_tokens` / `gen_ai.usage.output_tokens` attributes are *reported* on a span, but a hop in the agent graph can incur billing without producing a span that carries those attributes — and, symmetrically, a span can ca...",
    "what_was_observed": "A planner agent (`service.name=planner`) delegated to a retriever agent (`service.name=retriever`) over an A2A-style handoff. The retriever made a model call whose response was served from the provider's prompt cache. The provider returned `usage.input_tokens=0, usage.cached_tokens=18432`, and the SDK emitted a span with `gen_ai.usage.input_tokens=0`. The planner's span, which wrapped the handoff, carried no usage at...",
    "condition_of_validity": "The \"sum usage attributes by parent span\" attribution is valid **only** when all four of the following hold simultaneously: 1. **Trace continuity across delegation.** Every A2A/MCP handoff propagates `traceparent` (W3C) or an equivalent `trace_id` linkage in the handoff envelope, so the child's spans share the parent's `trace_id` and set `parent_span_id` to ...",
    "decision_boundary": "The boundary is: **does the hop's cost have a span to live on?** If yes, attribute by span grouping. If no — because the inference was cached, short-circuited, or delegated across a broken trace — the attribution layer must *synthesize* a cost record from the parent hop's handoff span plus the provider's usage ledger, keyed on `(trace_id, handoff_span_id, re...",
    "operational_effect": "Without the guardrail, per-hop cost dashboards under-report cached and delegated hops by 15–40% in systems with heavy prompt caching, and the error is *non-uniform across hops* — retriever hops vanish, planner hops absorb phantom cost from response-id collisions. Teams then optimize the wrong hop. With the guardrail, the attribution job emits a `HopAttributi..."
  },
  "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": "2afd3f1689038594fc3fbf34eb468dd35fa4f13d519746f4a516af0117ecdada",
    "verified_classes": [
      "HopAttributionError"
    ],
    "verified_functions": [
      "attribute_hop_cost"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "HopAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
