{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-preserve-causal-trace-chains-when-head-based-sampling-drops-the-parent-span-at-a-federated-agent-hop",
  "title": "How should an instance preserve causal trace chains when head-based sampling drops the parent span at a federated agent hop",
  "date_of_record": "2026 November 26",
  "scope": "Applies to multi-instance agent systems where each hop (agent, tool-runner, sub-agent, or MCP server) makes its own independent trace-sampling decision before forwarding a request, and where causal reconstruction across hops is required for post-hoc attribution, replay, or audit. Does not apply to single-process agents with a shared tracer, nor to systems using a single centralized collector that samples after full-chain assembly.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-causal-trace-chains-when-head-based-sampling-drops-the-parent-span-at-a-federated-agent-hop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-causal-trace-chains-when-head-based-sampling-drops-the-parent-span-at-a-federated-agent-hop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-causal-trace-chains-when-head-based-sampling-drops-the-parent-span-at-a-federated-agent-hop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2261,
    "python_slice_tokens": 440,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"lost spans.\" It is **causal-orphaning**: a child span survives and is exported while the span that establishes its causal parent was dropped at an earlier hop, so the surviving span's `parent_span_id` points at a trace that no collector ever received. Head-based sampling (the default in most OpenTelemetry-style SDKs) makes the *first* hop...",
    "what_was_observed": "A four-hop federated pipeline: `orchestrator → planner-agent → tool-runner (MCP) → synthesis-agent`. Root sampling probability at the orchestrator was 10% (head-based, propagated via `traceparent` `sampled=1`). On a sampled root, the orchestrator set `sampled=1`; all downstream hops honored it. On a non-sampled root, `sampled=0` propagated, and every hop correctly suppressed export. The boundary condition appeared wh...",
    "condition_of_validity": "The invariant that must hold for causal reconstruction is: > **Ancestor-closure:** for every exported span `s`, either `parent(s)` is also exported, or `s` carries an explicit `orphan=true` marker plus the `sampled=0` decision that caused the drop, recorded at the hop that overrode. Head-based sampling alone cannot satisfy ancestor-closure across federated h...",
    "decision_boundary": "The decision boundary is: **does the hop that overrides `sampled` have enough retained ancestor context to emit ancestor stubs?** - If the hop retains the inbound `traceparent` and its own span for the request lifetime, override is safe: it emits `S2` plus a stub for `S0` (and `S1` if it can reconstruct the intermediate `parent_span_id` from the `traceparent...",
    "operational_effect": "The observable effect of the violation is **attribution drift**: queries that join on `trace_id` succeed structurally but return biased results because the retained traces are not a uniform random sample of the full population — they are a sample *conditioned on the override trigger* (slow/failing tools), with the conditioning ancestors removed. A query like..."
  },
  "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": "a3e42fb96c7453c57b8246dc0e29d73b645f83fb19458cf22258a84144e1ec83",
    "verified_classes": [
      "CausalChainViolation",
      "Span",
      "Hop"
    ],
    "verified_functions": [
      "decide_export",
      "check_fanout_integrity"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CausalChainViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
