{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-per-agent-cost-attribution-has-silently-collapsed-under-semantic-convention-resource-drift",
  "title": "What structural signals indicate per-agent cost attribution has silently collapsed under semantic-convention resource drift",
  "date_of_record": "2026 December 1",
  "scope": "Applies to observability pipelines that attribute token and compute cost to individual agent sessions via OpenTelemetry-style resource attributes (e.g., `service.name`, `agent.session.id`, `gen_ai.agent.id`) rather than via span-level parentage. Does not apply to single-process, single-agent systems where session identity is a process-local variable.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-per-agent-cost-attribution-has-silently-collapsed-under-semantic-convention-resource-drift.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-per-agent-cost-attribution-has-silently-collapsed-under-semantic-convention-resource-drift.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-per-agent-cost-attribution-has-silently-collapsed-under-semantic-convention-resource-drift.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2035,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Cost attribution per agent session is not a *measurement* problem — it is an *identity binding* problem. The meter (token counts from the provider response) is almost always correct. What fails is the binding between that meter reading and the session/agent identity that the aggregation layer keys on. The binding is carried entirely in resource attributes at...",
    "what_was_observed": "A supervisor agent spawned three worker sub-agents in-process to parallelize retrieval. Each worker used the shared `TracerProvider` initialized at supervisor startup, whose resource carried `agent.session.id = \"sess-sup-4471\"` and `gen_ai.agent.id = \"supervisor\"`. Workers correctly set span attributes `gen_ai.agent.id = \"worker-N\"` on their own spans, but the *resource*-level `agent.session.id` remained `sess-sup-44...",
    "condition_of_validity": "The invariant that must hold for per-session attribution to be sound: > For every span that carries a `gen_ai.usage.*` token attribute, the resource-level `agent.session.id` and `gen_ai.agent.id` MUST equal the session and agent that actually issued the model call, and MUST be unique and stable for that (session, agent) pair for the span's entire lifetime. T...",
    "decision_boundary": "The decision is between two attribution architectures, and the boundary is crossed the moment either (a) more than one logical agent shares a process/emitter, or (b) a session can be resumed into a warm process. - **Below the boundary** (single agent per emitter, cold-start per session): resource-attribute attribution is sound and cheap. Keep it. - **Above t...",
    "operational_effect": "Once the integrity check is in place, the observable behavior changes from \"numbers that reconcile and are wrong\" to \"numbers that fail closed.\" Practically: - Per-session dashboards will show a visible `UNATTRIBUTED` residual that tracks the *rate of emitter reuse*, which is itself a useful signal — it tells you how often agents are crossing identity bounda..."
  },
  "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": "d91d0fc51a41f22d31c9e44548a63413c858a994c42106aa0f7d59da0a2aa817",
    "verified_classes": [
      "AttributionCollapseError"
    ],
    "verified_functions": [
      "attribute_span_cost"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "AttributionCollapseError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
