{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-trace-sampling-as-a-state-continuity-hazard-rather-than-a-telemetry-cost-lever-in-long-running-agent-sessions",
  "title": "In what scenarios must an instance treat trace sampling as a state-continuity hazard rather than a telemetry cost lever in long-running agent sessions",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent runtimes that sample execution traces (OpenTelemetry-style spans, reasoning step logs, tool-call records) under head-based or tail-based policies while a single logical session spans many turns, restarts, and sub-agent handoffs. Does not apply to single-shot inference calls or to stateless request/response services where each trace is independent.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-trace-sampling-as-a-state-continuity-hazard-rather-than-a-telemetry-cost-lever-in-long-running-agent-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-trace-sampling-as-a-state-continuity-hazard-rather-than-a-telemetry-cost-lever-in-long-running-agent-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-trace-sampling-as-a-state-continuity-hazard-rather-than-a-telemetry-cost-lever-in-long-running-agent-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2390,
    "python_slice_tokens": 440,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Conventional trace sampling is a *cost lever*: you drop a statistically representative fraction of spans, and because each request is independent, the dropped ones are exchangeable with the kept ones. The invariant that makes this safe is **exchangeability** — the sampled subset carries the same distributional information as the full set, so downstream analy...",
    "what_was_observed": "A long-horizon coding agent (session length ~6–14 hours, 300–900 reasoning turns, periodic context compaction every ~28 turns, sub-agent delegation for search and test execution) was instrumented with a tail-based sampler configured at 10% retention with a \"keep all error spans\" override and a \"keep all root spans\" override. The sampler buffered spans per trace ID and flushed at trace close. Three failure traces were...",
    "condition_of_validity": "Head-based and tail-based sampling are valid for agent traces **iff** all of the following hold: 1. **Chain closure.** Every retained span's causal antecedents (the spans it reads state from, not merely its parent) are either retained or represented by a retained *summary span* that carries the semantic content the antecedent contributed. Parent-child linkag...",
    "decision_boundary": "The operational decision is not \"what sampling rate\" but \"**is this trace an audit artifact or a telemetry artifact?**\" - If the session's output will be acted upon without human review, or if the session is subject to post-hoc attribution (who decided what, on what evidence), the trace is an **audit artifact**. Sampling must be *causally closed*: retain at ...",
    "operational_effect": "Applying the anchor/derived/leaf classification to the same session reduced retained span volume by 71% while making every retained trace replayable: no dangling `parent_span_id`, no memory-read without a retained or summarized write, no compaction summary without a retained eviction manifest. Error spans are no longer over-retained in isolation; instead the..."
  },
  "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": "0ceda50ec7c00b5dcb13840193add7893cbc87dc8da3a415f852c6de3f33b99f",
    "verified_classes": [
      "ContinuityClass",
      "TraceContinuityError",
      "Span"
    ],
    "verified_functions": [
      "enforce_chain_closure"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TraceContinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
