{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-samples-its-own-trace-spans-under-a-federated-cost-ceiling-attribution-drift-at-the-sampling-boundary",
  "title": "What happens when an instance samples its own trace spans under a federated cost ceiling: attribution drift at the sampling boundary",
  "date_of_record": "2026 November 28",
  "scope": "Applies to multi-agent systems where each agent instance emits its own OpenTelemetry-style spans, applies local head-based or tail-based sampling before export, and where a federated cost-attribution layer sums per-agent token/USD counters to enforce a shared budget ceiling. Does not apply to centralized collectors that receive 100% of spans, nor to single-agent systems with no cross-instance budget arbitration.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-samples-its-own-trace-spans-under-a-federated-cost-ceiling-attribution-drift-at-the-sampling-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-samples-its-own-trace-spans-under-a-federated-cost-ceiling-attribution-drift-at-the-sampling-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-samples-its-own-trace-spans-under-a-federated-cost-ceiling-attribution-drift-at-the-sampling-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1790,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"cost\" in a federated agent mesh, and they diverge the moment any instance samples its own spans before export: 1. **Incurred cost** — the ground-truth provider billing event: tokens actually sent to and returned from the model, plus tool-call charges, attributable to a specific agent instance and a specific causal chain. 2....",
    "what_was_observed": "A four-agent pipeline (planner → retriever → synthesizer → critic) shared a federated ceiling of $50/day. Each instance ran tail-based sampling locally: keep 100% of error spans, keep 20% of success spans, and — critically — the synthesizer additionally kept 100% of spans exceeding 8k output tokens because those were \"interesting.\" The collector received ~22% of spans. The budget controller summed observed cost and r...",
    "condition_of_validity": "The invariant that must hold for federated cost attribution to be sound is: > For every instance `i` and every cost-relevant span class `c`, the expected observed cost contribution `E[observed_i,c]` must equal `incurred_i,c` up to a *single, known, instance-independent* scale factor `k`, and the estimator must be unbiased per instance. Local sampling violate...",
    "decision_boundary": "The architectural boundary is: **the cost-attribution path must never consume a sampled span stream as its cost source.** Sampling is for debugging and quality analysis; billing and ceiling enforcement must read from a separate, unsampled accounting channel. Concretely: - Emit cost counters (token usage, tool charges, per-call USD) on a **dedicated accountin...",
    "operational_effect": "When the boundary is crossed, three effects compound: 1. **Ceiling breach without alarm.** The controller under-counts precisely for the agents whose spans are most likely to be dropped, which are the high-volume cheap agents; the expensive agents are over-retained and over-counted, so aggregate spend is under-counted at the margin where it matters. The ceil..."
  },
  "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": "f7153790ee5679c5f77d8c582b5686a7471dfed37d3183f985e8f5e7b3548961",
    "verified_classes": [
      "AttributionDriftError",
      "CostWindow",
      "FederatedBudgetController"
    ],
    "verified_functions": [
      "__init__",
      "reconcile",
      "admit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "AttributionDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
