{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-sampled-decision-trace-as-non-attributable-when-span-level-cost-aggregation-crosses-a-retried-tool-call",
  "title": "Under what conditions must an instance treat a sampled decision trace as non-attributable when span-level cost aggregation crosses a retried tool-call boundary",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent runtimes that emit OpenTelemetry-style spans for LLM calls and tool invocations, sample those spans at a rate below 1.0, and join sampled traces to eval scores and to per-tenant cost ledgers. Does not apply to unsampled (100%) capture pipelines or to batch offline eval jobs that re-execute the full trajectory deterministically.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-sampled-decision-trace-as-non-attributable-when-span-level-cost-aggregation-crosses-a-retried-tool-call.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-sampled-decision-trace-as-non-attributable-when-span-level-cost-aggregation-crosses-a-retried-tool-call.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-sampled-decision-trace-as-non-attributable-when-span-level-cost-aggregation-crosses-a-retried-tool-call.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2374,
    "python_slice_tokens": 429,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"sampled traces are incomplete.\" Everyone knows that. The failure is that a **retried tool call produces two child spans that share a logical operation identity but not a span identity**, and the cost aggregator, the trace sampler, and the eval correlator each resolve that duplication differently. The sampler may keep the first attempt and...",
    "what_was_observed": "A tool-calling agent (retrieval + code exec) ran against a 12% head-based sampling rate. A single logical `fetch_and_parse` operation was attempted three times: attempt 1 returned a 503 from the upstream, attempt 2 returned malformed JSON that the agent's validator rejected, attempt 3 succeeded. Each attempt was a separate child span under the same parent reasoning span, each with its own `attempt_index` attribute bu...",
    "condition_of_validity": "A sampled trace may be treated as attributable for cost and eval purposes **if and only if** all of the following hold: 1. **Logical-operation identity is explicit and propagated across worker boundaries.** Every physical attempt carries a `logical_op_id` (e.g., a content hash of the normalized tool name + arguments + parent reasoning node) that is *not* der...",
    "decision_boundary": "The boundary is between **\"sampled trace as debugging artifact\"** and **\"sampled trace as accounting record.\"** A trace used only to debug latency or inspect reasoning is fine with partial attempt sets — the missing attempts are understood to be sampling loss. A trace used to attribute cost or to correlate eval scores to decisions is *not* fine with partial ...",
    "operational_effect": "Enforcing this boundary changes three things: 1. **Cost dashboards gain a \"sampled lower bound\" flag** and a per-tenant `unattributed_retry_cost` line, which surfaces the respawn-correlated under-attribution that was previously invisible. In the observed incident this line was 3.1% of tenant spend, concentrated in the top 0.4% of operations by cost — exactly..."
  },
  "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": "a6c051f7501ed853892fb4fabbaf8ac0106ebb0061a4cfda0fb3e80382f9293e",
    "verified_classes": [
      "TraceAttributionError",
      "AttemptRecord",
      "TraceAggregation"
    ],
    "verified_functions": [
      "compute_logical_op_id",
      "aggregate_cost_and_eval",
      "assert_attributable"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TraceAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
