{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-attribute-sampled-trace-spans-to-a-parent-agent-when-the-sampling-decision-is-made-downstream-of-the-cost-boundary",
  "title": "Where must an instance refuse to attribute sampled trace spans to a parent agent when the sampling decision is made downstream of the cost boundary",
  "date_of_record": "2026 November 24",
  "scope": "Applies to multi-agent systems where trace sampling decisions (head-based, tail-based, or adaptive) are made at a collector or orchestrator that sits logically downstream of the cost-attribution boundary (i.e., where token spend is actually incurred). Does not apply to single-agent systems with inline, synchronous cost accounting, nor to systems where sampling is decided at span creation by the spending agent itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-attribute-sampled-trace-spans-to-a-parent-agent-when-the-sampling-decision-is-made-downstream-of-the-cost-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-attribute-sampled-trace-spans-to-a-parent-agent-when-the-sampling-decision-is-made-downstream-of-the-cost-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-attribute-sampled-trace-spans-to-a-parent-agent-when-the-sampling-decision-is-made-downstream-of-the-cost-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2018,
    "python_slice_tokens": 469,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is between **the agent that spends tokens** and **the agent that decides whether the spend is recorded**. In most multi-agent trace architectures these are not the same actor. A worker agent emits spans; a downstream collector applies a sampling policy (e.g., tail-based sampling that keeps only errored or slow traces) and dr...",
    "what_was_observed": "In a three-tier workflow (planner → N workers → synthesizer), tail-based sampling at 10% retention was configured to keep \"interesting\" traces. Workers emitted spans with `parent_span_id` pointing at the planner's dispatch span. The collector sampled on trace completion and retained ~10%. Cost attribution ran nightly, joining the token ledger (which recorded every worker's `usage.total_tokens` at emit time, regardles...",
    "condition_of_validity": "The invariant that must hold for cost attribution to be sound is: > **Every token-spending span must have a durable, sampling-independent cost record that carries its own parent linkage, and that record must be joined to trace structure by a key that is unique across the entire workflow, not merely unique within a sampling decision.** This holds only when al...",
    "decision_boundary": "The boundary is this: **an instance may attribute a sampled span's cost to a parent only if the cost record was emitted before the sampling decision and the join key is workflow-scoped.** If the cost record was emitted by the collector (post-sampling), the instance must treat the cost as *unattributable* and route it to a quarantine ledger, not to a parent. ...",
    "operational_effect": "With the boundary enforced, the nightly attribution run stops silently under-reporting clean workers. The planner's cost ledger reflects all dispatched workers, not just the ones whose traces survived tail sampling. The failure-biased skew disappears because dropped clean traces' costs are attributed via their worker-emitted cost records (which carry parenta..."
  },
  "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": "258b19340ddb78711c5db67f009b9264d056562c328ee9a9655b77b4052410bb",
    "verified_classes": [
      "AttributionBoundaryError",
      "EmitStage",
      "CostRecord",
      "SamplerConfig"
    ],
    "verified_functions": [
      "attribute_cost",
      "reconcile"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AttributionBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
