# Which invariants prevent cross-org span correlation from silently degrading under privacy-preserving trace export **Date of Record:** 2026 November 25 **Scope:** Applies to federated agent observability pipelines where two or more organizations export OTel-style spans for LLM/agent executions and correlate them by a shared trace identifier without exchanging payloads. Does not apply to single-tenant observability, nor to raw-payload trace sharing under a single trust domain. ## Core Distinction The failure is not "PII leaked into a trace." It is subtler: **the correlation key survives export while the predicate that makes correlation meaningful is redacted away, so the join succeeds and the answer is wrong.** Two agents in different orgs exchange a trace ID and a set of span IDs. Each org applies a redaction policy — hashing prompt text, dropping `tool.args`, bucketing latency, coarsening timestamps. The trace ID is *not* redacted because it is the correlation key. The result: the join produces a full, non-empty merged trace that looks structurally complete, but the spans that would have revealed a divergence (e.g., agent A's tool call returned `status=error` while agent B recorded `status=ok` for the same span ID) have had the discriminating field removed. Correlation reports "consistent" because the redacted fields are *absent*, and absence is indistinguishable from agreement. The invariant that must hold: **for any span attribute used as a correlation predicate, redaction must be a total function that preserves the equivalence class of the predicate, or the span must be marked uncorrelatable.** Redaction that merely drops the field is a silent predicate failure, not a privacy win. ## What Was Observed A cross-org handoff between a planner agent (Org A) and an executor agent (Org B) over a shared A2A request. Both sides emitted spans keyed to the same `trace_id` and a propagated `span_id` for the handoff boundary. Org B's export pipeline redacted `tool.result.hash` (a per-call digest) and replaced `latency_ms` with a 3-bucket label (`fast`/`mid`/`slow`). Org A retained both fields. During an incident replay, the correlation job joined on `span_id`, found a match, and compared the surviving attributes. The only surviving comparable field was `status`, which both sides had set to `ok` at span close — before Org B's executor actually observed the tool timeout (recorded only in `tool.result.hash` and the latency bucket). The merged trace showed a clean handoff. The actual failure — Org B's tool call timed out and the executor silently retried against a stale idempotency key — was invisible because the fields carrying it had been dropped, not hashed. The trace was *complete* (every span joined) and *wrong* (the discriminating evidence was absent). No error was raised. The correlation job had no notion of "this span had a field I needed but it was redacted." A second, compounding observation: Org B's redaction was *policy-versioned* — v3 dropped `tool.result.hash`, v2 had hashed it. Spans from v2 and v3 exports of the same trace joined fine (same `span_id`), but the v2 spans carried a hash and v3 spans did not, so the comparator treated "hash present vs absent" as a *mismatch* and flagged a false divergence on a trace that was actually consistent. Policy-version skew produced both false negatives (dropped field → false agreement) and false positives (present-vs-absent → false disagreement). ## Condition of Validity Cross-org correlation is only sound when all of the following hold for every span attribute in the predicate set: 1. **Redaction is declared, not inferred.** Each exported span carries a machine-readable `redaction_manifest` naming every attribute that was dropped, hashed, bucketed, or coarsened, plus the policy version. Absence of a field is only interpretable against this manifest. 2. **Predicate-preserving transforms.** A field used in a correlation predicate must be transformed by a function that is either *identity* or *equivalence-preserving* (hashing preserves equality; bucketing preserves only bucket-equality and must be declared as such). Dropping a predicate field is not a transform — it is a predicate removal and must demote the span to `uncorrelatable`. 3. **Policy-version compatibility is part of the join key.** The comparator must refuse to compare two spans whose manifests disagree on the transform applied to a predicate field, unless a registered compatibility relation maps the transforms. "Hash present vs absent" is not a mismatch; it is an *undefined* comparison and must not be counted as divergence. 4. **Monotonic redaction.** A given `(trace_id, span_id)` must not be exported under two different redaction policies with the same policy version. Version skew is permitted across time but must be visible in the manifest. When any of these fail, the merged trace is a *synthetic* artifact: structurally complete, semantically unverified. ## Decision Boundary The boundary is whether the correlation pipeline can distinguish **"fields agree"** from **"fields are not comparable."** A pipeline that collapses both into a boolean `consistent` is unsound under redaction. The correct boundary: - If a predicate field is present on both sides with equivalence-preserving transforms → compare, yield `agree`/`diverge`. - If a predicate field is present on one side only, or transformed by incompatible functions → yield `indeterminate`, and the span's overall correlation verdict is `indeterminate`, never `consistent`. - If a span is marked `uncorrelatable` by either side → the trace is `partial`, and any downstream alerting must treat `partial` as a distinct state from `consistent`. The failure mode is specifically the collapse of `indeterminate` into `consistent`. That collapse is the boundary. It is invisible in dashboards because the merged trace is non-empty and the join count is high — the very metrics that look healthy are the ones that mask the degradation. ## Operational Effect Without the invariant, federated observability degrades in a way that is *anti-correlated with its own success metrics*: the more orgs join and the more aggressively they redact, the higher the join rate and the lower the actual verification coverage, with no signal distinguishing the two. Incident replays produce confident, wrong root-cause attributions — the redacted field that would have shown the timeout is gone, and the surviving `status=ok` is read as ground truth. With the invariant, the pipeline pays a visible cost: a fraction of spans are `indeterminate` or `partial`, and that fraction is itself a monitored metric. A rising `indeterminate` rate is the early warning that redaction policy has outrun correlation coverage — the correct response is to negotiate a predicate-preserving transform (e.g., hash the tool-result digest rather than drop it) with the exporting org, not to loosen the comparator. The guardrail is structural: **redaction manifests are part of the span, not metadata about the export.** A span without a manifest is treated as fully redacted and therefore uncorrelatable. This makes the privacy transform auditable at the point of join, which is the only place where its correlation consequences are observable. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class CorrelationError(RuntimeError): """Raised when a cross-org span join would silently degrade.""" class Verdict(Enum): AGREE = "agree" DIVERGE = "diverge" INDETERMINATE = "indeterminate" UNCORRELATABLE = "uncorrelatable" class Transform(Enum): IDENTITY = "identity" HASH = "hash" # equivalence-preserving BUCKET = "bucket" # preserves bucket-equality only DROPPED = "dropped" # NOT a transform: predicate removal @dataclass class RedactionManifest: policy_version: str transforms: dict[str, Transform] = field(default_factory=dict) def transform_for(self, attr: str) -> Transform: return self.transforms.get(attr, Transform.IDENTITY) @dataclass class ExportedSpan: trace_id: str span_id: str org: str manifest: Optional[RedactionManifest] attrs: dict[str, object] def _compatible(a: Transform, b: Transform) -> bool: if a == Transform.DROPPED or b == Transform.DROPPED: return False if a == b: return True # identity vs hash: hash is not invertible, comparison undefined return False def correlate(left: ExportedSpan, right: ExportedSpan, predicate_attrs: list[str]) -> dict[str, Verdict]: if left.trace_id != right.trace_id or left.span_id != right.span_id: raise CorrelationError( f"span identity mismatch: {left.span_id} vs {right.span_id}" ) if left.manifest is None or right.manifest is None: # no manifest => treat as fully redacted; never claim consistency return {a: Verdict.UNCORRELATABLE for a in predicate_attrs} results: dict[str, Verdict] = {} for attr in predicate_attrs: tl = left.manifest.transform_for(attr) tr = right.manifest.transform_for(attr) if tl == Transform.DROPPED or tr == Transform.DROPPED: results[attr] = Verdict.INDETERMINATE continue if not _compatible(tl, tr): results[attr] = Verdict.INDETERMINATE continue if attr not in left.attrs or attr not in right.attrs: results[attr] = Verdict.INDETERMINATE continue results[attr] = ( Verdict.AGREE if left.attrs[attr] == right.attrs[attr] else Verdict.DIVERGE ) # The invariant: a trace is never "consistent" if any predicate is indeterminate. if any(v in (Verdict.INDETERMINATE, Verdict.UNCORRELATABLE) for v in results.values()): if all(v == Verdict.UNCORRELATABLE for v in results.values()): raise CorrelationError( f"trace {left.trace_id}/{left.span_id} fully uncorrelatable; " f"refusing to report a verdict" ) return results def assert_no_silent_consistency(verdicts: dict[str, Verdict]) -> None: """Guardrail: a caller must never treat indeterminate as agreement.""" for attr, v in verdicts.items(): if v == Verdict.INDETERMINATE: raise CorrelationError( f"predicate {attr!r} is indeterminate; " f"downstream must not collapse this into 'consistent'" ) ```