{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-trace-graph-corruption-when-observability-pipelines-retroactively-re-parent-spans-across-agent-handoffs",
  "title": "Which invariants prevent trace-graph corruption when observability pipelines retroactively re-parent spans across agent handoffs",
  "date_of_record": "2026 November 27",
  "scope": "Applies to asynchronous, batched observability exporters that reconstruct causal trace graphs from spans emitted by LLM agents (prompt spans, tool-call spans, memory-op spans, handoff spans) where span emission order does not match causal order. Does not apply to synchronous in-process tracers that flush spans at parent-close time, nor to pure logging sinks with no parent-child linkage.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-graph-corruption-when-observability-pipelines-retroactively-re-parent-spans-across-agent-handoffs.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-graph-corruption-when-observability-pipelines-retroactively-re-parent-spans-across-agent-handoffs.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-graph-corruption-when-observability-pipelines-retroactively-re-parent-spans-across-agent-handoffs.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1475,
    "python_slice_tokens": 226,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"missing spans\" or \"clock skew.\" It is **retroactive re-parenting under a late-arriving parent**, where a child span is admitted to the graph before its causal parent has been observed, gets provisionally attached to the nearest known ancestor (usually the agent's root or the currently-active handoff span), and is later re-attached when th...",
    "what_was_observed": "A supervisor agent `S` delegates to worker `W` via a handoff. The sequence on the wire: 1. `S` emits `handoff.request` span (span_id `h1`, parent `S.root`) at t=0. 2. `W` receives the baton and immediately issues a tool call. `W`'s tool span `t1` is emitted at t=2 with `parent_span_id = h1` — but `h1` has *not yet been exported* because `S`'s exporter batches at 5s. 3. The collector receives `t1` at t=2.5, sees `pare...",
    "condition_of_validity": "The re-parenting policy is only sound if, for every span `c` with claimed parent `p`, at least one of the following holds at admission time: - `p` is already indexed (parent-precedes-child), **or** - `c` carries a `causal_epoch` (or equivalent monotonic handoff counter) such that provisional attachment is tagged with the epoch and re-parenting is constrained...",
    "decision_boundary": "Choose epoch-tagged provisional attachment over buffering when handoff depth exceeds one (multi-hop swarms), because buffering only bounds the *first* re-parenting and cannot disambiguate concurrent in-flight handoffs from the same parent. Choose buffering only when the exporter batch interval is contractually bounded and handoffs are strictly single-hop. In...",
    "operational_effect": "Traces queried before and after re-parenting disagree on topology under the same ID; latency and token attribution computed in the window are wrong and silently cached; multi-hop handoffs mis-attach subtrees when concurrent handoffs share a parent; and verifier agents that consume unsealed epochs produce decisions that contaminate the trace they are auditing..."
  },
  "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": "11883d53726cceb19e80b1e454630eb44a9d5249f25f628a3b754883c700faf9",
    "verified_classes": [
      "UnsealedEpochError",
      "TraceGraph"
    ],
    "verified_functions": [
      "__init__",
      "admit",
      "observe_parent",
      "seal_epoch",
      "read_for_verifier"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UnsealedEpochError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
