{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-abandon-head-based-trace-sampling-to-preserve-multi-turn-causal-chains",
  "title": "When must an instance abandon head-based trace sampling to preserve multi-turn causal chains",
  "date_of_record": "2026 November 27",
  "scope": "Applies to observability pipelines that sample agent execution traces at the span or turn level before persistence, where a single logical agent task spans multiple LLM invocations, tool calls, and handoffs. Does not apply to single-turn inference logging where each request is independently reconstructable, nor to systems that persist full traces and sample only at query time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-head-based-trace-sampling-to-preserve-multi-turn-causal-chains.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-head-based-trace-sampling-to-preserve-multi-turn-causal-chains.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-head-based-trace-sampling-to-preserve-multi-turn-causal-chains.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1981,
    "python_slice_tokens": 349,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"we sampled too aggressively and lost data.\" It is the collapse of *causal reconstructability* under head-based sampling when the unit of sampling (the span) is finer than the unit of causation (the task). A multi-turn agent trace is a dependent chain: turn N+1's prompt is a function of turn N's tool output, which is a function o...",
    "what_was_observed": "A coding agent executed a 14-turn task (plan → 9 tool calls → 3 self-corrections → final patch). The pipeline used per-span head sampling at p=0.1, keyed on `trace_id`, with a 30% secondary \"tail rescue\" sampler that retained any span with `error=true` or `latency > 8s`. Over a 6-hour window, 41 of 38,000 task traces were retained at full fidelity. Of the 2,900 traces retained *partially* (some spans kept, some dropp...",
    "condition_of_validity": "Head-based or per-span sampling is valid for an agent system *only* when all of the following hold: 1. **The causal unit is sealed before the sampling decision.** If sampling is applied only after a task terminates and its full span set is atomically available, head-based sampling is safe — you are sampling whole traces, not fragments. This is the \"seal-then...",
    "decision_boundary": "The boundary is the moment a sampler must choose between *lower retention with intact causality* and *higher retention with broken causality*. The correct decision rule: - If the causal unit cannot be sealed before sampling (streaming, long-running, or open-ended agent tasks), **abandon head-based sampling for that task class** and switch to either (a) full ...",
    "operational_effect": "After moving to seal-then-sample with whole-trace atomic retention and disabling ancestor repair, the pipeline retained 38% fewer total spans but 4× more *complete* failing traces per hour, because retention budget was redirected from high-volume healthy prefixes to terminated-with-error tasks. The \"nonexistent turn-11 bug\" class of investigation disappeared..."
  },
  "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": "a97b4841aeb0ed6e50ac087087f738ce1a56690759ccaaee595b2c549c320f67",
    "verified_classes": [
      "CausalSamplingViolation",
      "Span",
      "TraceBuffer"
    ],
    "verified_functions": [
      "decide_retention",
      "retain_subset",
      "add",
      "seal"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CausalSamplingViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
