{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-stop-attributing-cost-when-its-own-token-stream-is-the-only-clock-span-relative-attribution-drift-under-streamed-generation",
  "title": "Where must an instance stop attributing cost when its own token stream is the only clock: span-relative attribution drift under streamed generation",
  "date_of_record": "2026 November 29",
  "scope": "Applies to per-agent token-cost and latency attribution built by reading usage counters and inter-token timestamps off a single LLM instance's streamed response, where that instance also emits spans/tool calls multiplexed onto the same logical turn. Does not apply to out-of-band billing reconciliation against provider invoices, nor to batch (non-streamed) calls where usage arrives atomically at completion.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-stop-attributing-cost-when-its-own-token-stream-is-the-only-clock-span-relative-attribution-drift-under-streamed-generation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-stop-attributing-cost-when-its-own-token-stream-is-the-only-clock-span-relative-attribution-drift-under-streamed-generation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-stop-attributing-cost-when-its-own-token-stream-is-the-only-clock-span-relative-attribution-drift-under-streamed-generation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1985,
    "python_slice_tokens": 472,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **wall-clock attribution** and **stream-clock attribution**. Wall-clock attribution timestamps spans and tool calls against a monotonic host clock and subtracts them from a turn boundary. Stream-clock attribution instead infers the turn's internal timeline from the arrival times of tokens on the response stream, treati...",
    "what_was_observed": "A single-agent coding loop generated a 4,200-token plan, paused to invoke a filesystem tool (12.4 s of sandbox execution), then resumed generation for 900 more tokens. The attribution layer reported: - Total turn wall clock: 31.8 s. - Tokens attributed to the generation span: 5,100, at a computed 6.2 ms/token. - Tool span wall clock: 12.4 s, with 0 tokens. The provider's own usage record reported 5,100 completion tok...",
    "condition_of_validity": "Stream-clock attribution is valid only under the conjunction of three conditions: 1. **No interleaved execution.** The generation span contains no pause during which another span (tool, sub-agent, retrieval) executes. Equivalently: the set of tokens emitted by the instance is contiguous in stream time. 2. **Segment boundaries are token-marked.** Every transi...",
    "decision_boundary": "The decision boundary is the pause event. Before the pause, the instance's stream is the authoritative clock and per-token latency is well-defined as the inter-arrival delta. At the pause, the stream clock stops being a clock at all — it becomes a *sequence*, and only the host clock plus the executing span's own telemetry can price the interval. The boundary...",
    "operational_effect": "The operational effect is that **cost dashboards built on stream-clock attribution under-report sub-agent cost and over-report parent generation latency, and the error is correlated with tool-use frequency rather than with volume.** A high-tool-use agent will show inflated per-token latency and understated sub-agent spend; a low-tool-use agent will look accu..."
  },
  "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": "3d6a1733360e236428f6d68a423aeb1bee6a46fa596c8300356d0bacf17dc8d0",
    "verified_classes": [
      "AttributionDriftError",
      "SegmentState",
      "Segment",
      "AttributionLedger"
    ],
    "verified_functions": [
      "price_turn",
      "open_segment",
      "pause",
      "resume",
      "attribute_token",
      "close_turn"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "AttributionDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
