# What happens when an instance redacts spans before federating OTel GenAI traces and silently destroys the parent-child causal chain auditors need to reconstruct a multi-agent handoff **Date of Record:** 2026 November 30 **Scope:** Applies to cross-organization trace federation where OTel GenAI spans (`gen_ai.*` semantic conventions) are redacted at the exporter boundary before leaving the originating trust domain. Does not apply to intra-org tracing where the collector retains unredacted spans, nor to log-only audit pipelines that do not preserve span linkage. ## Core Distinction There are two different things an auditor needs from a federated trace, and redaction treats them as one: 1. **Payload confidentiality** — the *content* of a span (prompts, completions, tool arguments, retrieved documents, model provider, token counts) must not cross the organizational boundary. 2. **Structural causality** — the *topology* of the trace (which span is parent of which, span kind, timing, status, and the identity of the emitting agent instance) must survive so that a downstream auditor can reconstruct *who handed the baton to whom, in what order, and where it stalled*. The failure mode is that naive redaction collapses both. When an exporter replaces a sensitive span with a placeholder — or drops it entirely and "re-parents" its children to the nearest surviving ancestor — the causal chain is rewritten. The trace still parses. `trace_id` is intact. But the `parent_span_id` edges now encode a history that never happened. An auditor replaying the trace sees agent B invoked directly by agent A when in fact the call went A → orchestrator → B, and the orchestrator is exactly the instance whose span was redacted because its `gen_ai.input.messages` contained a customer record. This is non-obvious because every individual component behaves correctly. The redactor removes what it was told to remove. The exporter emits valid OTLP. The receiving collector accepts the spans. The corruption is a *relational* invariant violation that only manifests when someone traverses the DAG. ## What Was Observed A three-instance swarm (planner, executor, verifier) federates traces to a partner org's audit collector under a policy that redacts any span whose attributes match a PII classifier. During an incident replay, the partner's auditor reconstructed the following from the federated trace: - `planner.invoke` (root, span_kind=SERVER) → `executor.tool_call` (CLIENT) → `verifier.check` (CLIENT) The `executor.tool_call` span had been redacted because its `gen_ai.tool.call.arguments` contained a name. The redactor's re-parenting rule set the surviving `verifier.check`'s `parent_span_id` to the planner root. The auditor concluded the planner invoked the verifier directly and that the executor never ran — the opposite of the true sequence, in which the executor's output was the *input* to verification and the executor was the instance that actually failed. The receiving collector raised nothing. OTLP validation only checks that `parent_span_id` references *a* span in the same `trace_id`; it does not check that the referenced span was the true parent. The trace was internally consistent and externally false. The tell was a timing anomaly: `verifier.check`'s `start_time_unix_nano` preceded `executor.tool_call`'s original `end_time` (recoverable from the redaction tombstone's retained timing envelope), meaning verification began before the tool call it supposedly depended on completed — a causality violation that survived only because the tombstone kept timing but not linkage. ## Condition of Validity The invariant that must hold for a federated trace to be auditable is: > For every span `s` in the federated trace, either (a) `s` is present with its original `parent_span_id`, or (b) `s` is replaced by a **redaction tombstone** that (i) retains the original `span_id` and `parent_span_id`, (ii) retains `span_kind`, timing envelope, `status`, and the emitting `service.name`/agent-instance identity, and (iii) carries an explicit `redaction.policy_id` and `redaction.applied` marker. A redacted span MUST NOT be deleted, and its children MUST NOT be re-parented. Re-parenting is valid only when the redaction policy is explicitly declared as *structural-collapse* mode and the federation contract records that the trace is topology-degraded. Absent that declaration, deletion-plus-re-parenting is a silent integrity violation. This condition is valid only when the federation contract is versioned and the redaction policy is bound to a specific `trace_id` set. It does not hold for traces that cross more than one redaction boundary (org A → org B → org C), where tombstones from the first hop must be treated as opaque but *retained* nodes by the second hop. ## Decision Boundary The choice is between two exporter behaviors at the moment a span matches the redaction predicate: - **Tombstone mode (default, auditable):** emit a span with the same `span_id`/`parent_span_id`, `span_kind`, timing, status, and instance identity; strip all `gen_ai.*` payload attributes; add `redaction.applied=true` and `redaction.policy_id`. The DAG is preserved; payload is gone. - **Collapse mode (opt-in, topology-degraded):** delete the span and re-parent children. Permitted only when the federation contract sets `federation.topology_integrity=degraded` and the receiving auditor is informed. Any consumer that performs causal reconstruction MUST refuse to do so against a degraded trace. The boundary condition that forces the decision: does any downstream consumer perform *causal* reasoning (root-cause, handoff reconstruction, verification replay)? If yes, collapse mode is not a redaction choice — it is a corruption. Tombstone mode is the only mode that preserves the invariant in the Condition of Validity. A second boundary: tombstones must not be *re-redacted* into nothing on a subsequent hop. A tombstone that itself matches a PII predicate (e.g., because `service.name` embeds a tenant ID) must be re-tombstoned with a *superset* policy, never deleted. ## Operational Effect With tombstone mode enforced, an auditor replaying the federated trace sees the full three-node chain with the executor's span present-but-opaque: timing, span kind, instance identity, and status survive; prompts and tool arguments do not. The auditor can confirm the executor ran, that its output fed verification, and that verification's start time is causally after the executor's end time. Root-cause attribution survives redaction. With collapse mode (or the accidental re-parenting that occurs when an exporter "cleans up" orphaned children), the trace passes OTLP validation, parses cleanly, and misattributes failure. The corruption is undetectable from any single span; it is only visible to a DAG traversal that checks timing causality against linkage — which most audit tooling does not do by default. The guardrail is an exporter-side assertion: before emitting, verify that every emitted span's `parent_span_id` either references an emitted span or is the trace root, and that no child's timing envelope is causally inconsistent with its (possibly tombstoned) parent. This assertion is cheap and catches the re-parenting bug at the source rather than at the auditor. ```python from dataclasses import dataclass, field from typing import Optional class TraceFederationIntegrityError(RuntimeError): """Raised when a federated OTel GenAI trace violates causal-linkage invariants after redaction (deletion/re-parenting instead of tombstoning).""" @dataclass class Span: span_id: str parent_span_id: Optional[str] span_kind: str start_ns: int end_ns: int service_name: str redacted: bool = False redaction_policy_id: Optional[str] = None def assert_federatable(spans: list[Span], topology_integrity: str = "strict") -> None: """Enforce the tombstone invariant before spans leave the trust domain. In 'strict' mode, every non-root span MUST have a parent present in the emitted set (tombstones count as present). Re-parenting to a surviving ancestor is a violation because it rewrites causality. """ by_id = {s.span_id: s for s in spans} if len(by_id) != len(spans): raise TraceFederationIntegrityError("duplicate span_id in federated batch") for s in spans: if s.parent_span_id is None: continue parent = by_id.get(s.parent_span_id) if parent is None: if topology_integrity == "strict": raise TraceFederationIntegrityError( f"span {s.span_id} references missing parent " f"{s.parent_span_id}; redaction must tombstone, not delete" ) continue # Causal timing check: a child must not start before its parent starts. if s.start_ns < parent.start_ns: raise TraceFederationIntegrityError( f"span {s.span_id} (start={s.start_ns}) precedes parent " f"{parent.span_id} (start={parent.start_ns}): " f"linkage likely rewritten by re-parenting" ) # A redacted child must carry a policy marker so the auditor can # distinguish 'opaque by policy' from 'absent by corruption'. if s.redacted and not s.redaction_policy_id: raise TraceFederationIntegrityError( f"redacted span {s.span_id} missing redaction_policy_id" ) def redact_span(span: Span, policy_id: str) -> Span: """Tombstone a span: keep structure and identity, drop gen_ai payload.""" if not policy_id: raise TraceFederationIntegrityError("redaction requires a policy_id") return Span( span_id=span.span_id, # preserved parent_span_id=span.parent_span_id, # preserved — never re-parented span_kind=span.span_kind, start_ns=span.start_ns, end_ns=span.end_ns, service_name=span.service_name, redacted=True, redaction_policy_id=policy_id, ) # --- demonstration of the failure the guardrail catches --- planner = Span("p", None, "SERVER", 100, 900, "planner") executor = Span("e", "p", "CLIENT", 200, 600, "executor") verifier = Span("v", "e", "CLIENT", 650, 850, "verifier") # Correct: tombstone the executor, keep its edge. safe = [planner, redact_span(executor, "pii-v3"), verifier] assert_federatable(safe) # passes; DAG intact # Broken: executor deleted, verifier re-parented to planner. broken = [planner, Span("v", "p", "CLIENT", 650, 850, "verifier")] try: assert_federatable(broken) except TraceFederationIntegrityError as exc: print("caught:", exc) ```