# What happens when an instance redacts spans before trace-context propagation and silently severs the cross-org causal chain **Date of Record:** 2026 November 26 **Scope:** Applies to federated agent observability pipelines where an emitting agent (or its local collector) performs privacy-preserving span redaction (attribute scrubbing, span dropping, or payload hashing) *prior to* W3C `traceparent`/`tracestate` propagation to a downstream peer or cross-org collector. Does not apply to redaction performed at the receiving aggregator after context headers have been forwarded, nor to single-org tracing where a single collector owns the full trace. ## Core Distinction The failure is not "redaction removed too much data." It is a **correlation-ordering defect**: redaction is treated as a *content* transform on span payloads, but in a federated trace the span's `trace_id`, `span_id`, and `parent_span_id` are *metadata that constitute the causal edge itself*. When an agent redacts by dropping or rewriting a span before propagating context, the downstream peer still receives a valid `traceparent`—it just points at a span that no longer exists in any shared store. The trace does not appear broken. It appears **complete but orphaned**: a well-formed subtree with a dangling parent reference, indistinguishable at the aggregator from a trace whose root was simply sampled out. The non-obvious part: **the redaction is correct under its own policy and the propagation is correct under the W3C spec, yet the conjunction is invalid.** Redaction policies are evaluated per-span ("does this span contain PII?"), while trace correlation requires a *global invariant over the edge set* ("does every referenced parent exist in the federated join?"). No single component owns that invariant, so it fails silently. ## What Was Observed A three-org agent pipeline: Org A (planner agent) → Org B (retrieval/tool agent) → Org C (verifier agent). Each org runs its own OTel collector with a redaction processor; traces are exported to a shared federated aggregator that joins on `trace_id`. 1. Org A's planner emits span `S_A` carrying a user query containing an email address. The redaction processor matches the PII pattern, and because the span's *entire payload* is classified sensitive, the policy action is `drop_span` — but the processor still injects `traceparent` into the outbound A2A request to Org B, referencing `S_A` as parent. 2. Org B receives the request, creates child span `S_B` with `parent_span_id = S_A`. `S_B` is exported to the aggregator normally. 3. At the aggregator, `S_B` and its descendants from Org C (`S_C`) join cleanly into one `trace_id` group — but `S_A` is absent. The join yields a forest with a rootless subtree. 4. Because the aggregator's orphan-detection heuristic was "root span missing ⇒ trace was head-sampled or partial ⇒ mark `partial=true` and suppress from SLO dashboards," **every trace through this path was silently excluded from latency and error-rate accounting.** The pipeline looked healthy while 100% of planner-originated traffic was invisible. 5. Worse, when Org C's verifier later queried the aggregator for "did the planner's decision precede my verification?" the causal ordering check returned `UNKNOWN` — `S_C`'s ancestor chain terminated at an unresolvable `S_A`. The verifier's audit logic treated `UNKNOWN` as "no dependency," and a genuine cross-org causal dependency was erased from the audit record. The trace *looked* well-formed at every individual hop. The break only manifested at the federated join, and only for traces that crossed the redaction boundary. ## Condition of Validity Cross-org trace correlation holds **iff** the set of `parent_span_id` references emitted by an org is a subset of the span IDs that org either (a) exports to the aggregator, or (b) explicitly declares as "redacted-but-present" via a **span tombstone**—a minimal record containing only `trace_id`, `span_id`, `parent_span_id`, org ID, and a redaction reason code, with all payload attributes stripped. This is the invariant: **redaction may remove a span's attributes, but it must not remove a span's identity, or it must convert the span into a tombstone before context propagation.** Dropping a span entirely is only safe if the drop happens *and* no downstream span references it—which, in a federated handoff, is never true, because the handoff itself creates the child. The condition fails whenever: - Redaction is applied per-span with a `drop` action while the span is an ancestor of any cross-org child. - The redaction processor runs *before* the propagator in the collector pipeline (a common default ordering: `receivers → processors → exporters`, with redaction as a processor and context injection in the exporter). - Tombstones are not part of the schema, so "redacted" and "never existed" are conflated. ## Decision Boundary The operator must decide, per redaction policy, between two mutually exclusive actions at the moment a sensitive span is about to be propagated across an org boundary: | Action | Effect on correlation | When valid | |---|---|---| | **Tombstone** (strip attributes, keep `span_id`/`parent_span_id`) | Preserves edge set; aggregator sees a redacted node | Default for any span that is or may be an ancestor of a cross-org child | | **Drop + sever** (drop span *and* rewrite downstream `traceparent` to start a new trace) | Deliberately breaks the chain; downstream trace is a new root | Only when causal linkage across the boundary is itself a privacy violation (e.g., linking a request to a specific user's later action) | The boundary is **not** "is this span sensitive?" It is **"does preserving this span's identity leak more than severing the causal edge does?"** For most PII-in-payload cases, identity (a random 16-hex span ID) leaks nothing, so tombstoning is strictly correct. Severing is reserved for cases where the *existence of a causal edge* is the sensitive fact—and when severing, the downstream `traceparent` must be regenerated, not merely dropped, or you recreate the orphan failure. The guardrail: the collector's redaction processor MUST emit a tombstone for any span whose `span_id` appears as a `parent_span_id` in an outbound request, and the aggregator MUST treat "referenced parent absent from all orgs' exports" as an alertable integrity violation, not as benign partial sampling. ## Operational Effect 1. **Observability becomes a silent no-op for the most sensitive paths.** The traces most likely to be redacted—those touching user data—are exactly the ones that vanish from SLO accounting. The system appears healthiest where it is least observed. 2. **Audit causal ordering degrades to `UNKNOWN`, and `UNKNOWN` is misread as "independent."** A verifier that cannot resolve an ancestor concludes no dependency exists, inverting the meaning of a missing edge from "we redacted it" to "it never happened." 3. **The failure is invisible to per-hop validation.** Each org's collector passes its own schema checks; the W3C `traceparent` is syntactically valid at every hop. Only the federated join—which no single org owns—can detect it. 4. **Recovery requires tombstone backfill.** Once a trace is orphaned, the edge cannot be reconstructed from payloads (they were redacted). Remediation is forward-only: deploy tombstoning, and accept that historical traces through the boundary are permanently unjoinable. The architectural rule: **in federated tracing, span identity is not payload and must be exempt from redaction; only attributes are redactable.** Any pipeline that treats `span_id` as redactable content will, at the first cross-org handoff, manufacture a well-formed lie. ```python from dataclasses import dataclass, field from typing import Optional class OrphanedTraceEdgeError(RuntimeError): """Raised when a cross-org child span references a parent that no org exported and no tombstone declared, severing the federated causal chain.""" @dataclass class Span: trace_id: str span_id: str parent_span_id: Optional[str] org: str attributes: dict = field(default_factory=dict) redacted: bool = False @dataclass class Tombstone: trace_id: str span_id: str parent_span_id: Optional[str] org: str reason: str def redact_span(span: Span, policy: str, is_cross_org_ancestor: bool) -> tuple[Optional[Span], Optional[Tombstone]]: """Apply redaction. Returns (surviving_span, tombstone). Exactly one may be None. Invariant: if the span is (or may be) an ancestor of a cross-org child, its identity must survive as a tombstone; payload-only drop is forbidden. """ sensitive = any(_looks_like_pii(v) for v in span.attributes.values()) if not sensitive: return span, None if policy == "tombstone" or is_cross_org_ancestor: tomb = Tombstone( trace_id=span.trace_id, span_id=span.span_id, parent_span_id=span.parent_span_id, org=span.org, reason="pii_payload_stripped", ) return None, tomb if policy == "drop_and_sever": # Caller MUST regenerate a new traceparent downstream; see guard below. return None, None raise OrphanedTraceEdgeError( f"policy={policy!r} on span {span.span_id} of org {span.org} would drop an " f"ancestor identity without a tombstone; cross-org join will orphan children" ) def federated_join(all_spans: list[Span], tombstones: list[Tombstone]) -> dict[str, list[Span]]: """Join spans across orgs by trace_id. Raises if any parent edge dangles.""" known_ids = {s.span_id for s in all_spans} | {t.span_id for t in tombstones} by_trace: dict[str, list[Span]] = {} for s in all_spans: by_trace.setdefault(s.trace_id, []).append(s) for s in all_spans: if s.parent_span_id is not None and s.parent_span_id not in known_ids: raise OrphanedTraceEdgeError( f"span {s.span_id} (org {s.org}) references parent {s.parent_span_id} " f"absent from all exports and all tombstones; trace {s.trace_id} is " f"structurally orphaned and must not be classified as sampled-out" ) return by_trace def _looks_like_pii(value: object) -> bool: return isinstance(value, str) and "@" in value and "." in value.split("@")[-1] ```