# How should an instance detect silent trace-correlation collapse when privacy-preserving span export redacts the very attributes cross-tenant aggregation joins on? **Date of Record:** 2026 November 24 **Scope:** Applies to federated agent observability pipelines where each tenant's agent runtime emits execution spans, locally applies a privacy transform (attribute allow-listing, hashing, k-anonymity bucketing, or differential-privacy noise), and exports to a shared aggregator that joins spans by correlation identifiers. Does not apply to single-tenant tracing, nor to pipelines that export raw spans under a trusted-boundary assumption. ## Core Distinction The failure is not "redaction removed data." The failure is that **redaction and correlation share the same attribute namespace, and the privacy transform is applied before the join key is stabilized.** A correlation identifier (trace ID, span ID, parent span ID, handoff token, or agent-instance ID) is simultaneously (a) the key the aggregator needs to reconstruct causal chains and (b) a high-cardinality attribute that privacy transforms are designed to suppress. When the transform runs first, the join key is either hashed per-tenant (so cross-tenant joins silently return zero matches), bucketed (so distinct traces collide into one pseudo-trace), or noise-injected (so parent-child links point at nonexistent spans). The pipeline reports success, spans arrive, the aggregator stores rows — and the reconstructed causal graph is wrong in a way no schema validator catches, because every row is individually well-formed. The invariant that must hold: **the correlation key space must be globally stable across tenants before any privacy transform touches it, and the transform must be provably injective on that key space or explicitly flagged as lossy.** This is distinct from ordinary PII redaction, where lossiness is acceptable because the redacted field is a leaf, not a join edge. ## What Was Observed A three-tenant federated deployment (tenants `alpha`, `beta`, `gamma`) ran a shared aggregator. Each tenant's exporter applied a per-tenant HMAC to `agent.instance_id` and `handoff.token` to avoid leaking internal identifiers, and applied 4-bit k-anonymity bucketing to `tool.latency_ms`. Trace and span IDs were exported unmodified. A multi-agent handoff from `alpha` to `beta` produced two spans that should have joined on `handoff.token`. On the wire: - `alpha` exported `handoff.token = HMAC_alpha("tok-7f3a") = 9c1e...` - `beta` exported `handoff.token = HMAC_beta("tok-7f3a") = 44b0...` The aggregator's join on `handoff.token` matched nothing. The handoff edge was dropped. The reconstructed graph showed two orphan spans, each with `status=OK`. No error was raised anywhere: the exporter succeeded, the transport succeeded, the aggregator's LEFT JOIN returned nulls, and the nulls were rendered as "no parent" rather than "unresolved parent." Separately, `tool.latency_ms` bucketing collapsed 312 distinct tool calls across `alpha` and `gamma` into 6 buckets. Downstream aggregation computed p99 latency per bucket and reported a value that corresponded to no actual call — the bucket boundary, not the distribution. The compounding effect: because the handoff edge was missing, the aggregator attributed the `beta` span's 4.2s latency to `beta`'s own tool budget rather than to the `alpha`→`beta` handoff queue. An on-call agent reading the trace concluded `beta` was slow; the actual cause was `alpha`'s export queue backing up before the handoff. The observability layer produced a confident, wrong causal claim. ## Condition of Validity The reconstruction is valid only if all of the following hold simultaneously: 1. **Key-space coherence:** every tenant's privacy transform maps the correlation key space to a common codomain. Per-tenant salts violate this by construction. A shared salt restores it but weakens the privacy guarantee (cross-tenant dictionary attacks on low-entropy tokens become feasible), so the salt must be rotated on a schedule that the aggregator knows, and spans must carry the salt epoch. 2. **Injectivity or explicit lossiness:** the transform on join keys must be injective (hash, not bucket) OR the span must carry a `transform_lossy=true` flag so the aggregator refuses to join on it and instead reports an unresolved edge. Bucketing a join key is never safe. 3. **Edge-vs-node consistency:** a dropped node is detectable (row absent); a dropped edge is not (both endpoints present, link absent). The aggregator must distinguish "no parent" from "parent unresolved" with an explicit sentinel, never `null`. 4. **Epoch alignment:** if the salt rotates mid-trace, a single logical handoff can span two epochs. The aggregator must join across epochs by re-deriving under both, or the trace must be pinned to one epoch at trace-start and carried through every span. When any of these fails, the pipeline is in **silent correlation collapse**: spans flow, joins return, and the causal graph is fabricated from the absence of edges. ## Decision Boundary The boundary is between *redaction that preserves graph topology* and *redaction that destroys it*. Concretely: - **Redact leaf attributes freely.** Free-text, tool arguments, user content — lossy transforms here cost fidelity, not structure. - **Never apply a per-tenant transform to a join key.** Join keys get a shared, epoch-tagged transform, or they get exported raw under a trusted-aggregator assumption, or the edge is explicitly marked unresolved. - **Bucket only non-key numerics, and only when the aggregator's queries are bucket-aware.** A p99 over bucketed latencies is a category error; the aggregator must refuse percentile queries on bucketed fields or return the bucket-resolution bound alongside the value. - **Treat `null` parent as a bug, not a root.** A span with no parent must carry `parent_status ∈ {root, unresolved, redacted}`. `unresolved` and `redacted` must be counted as a first-class metric; a rising `unresolved` rate is the leading indicator of correlation collapse. The decision to apply a transform is therefore not a per-attribute privacy call — it is a per-attribute *topology* call, and the topology impact must be evaluated before the privacy impact. ## Operational Effect With the invariant enforced, the failure becomes loud: `alpha` and `beta` export `handoff.token` under shared salt epoch `E7`; the aggregator joins, reconstructs the handoff edge, and attributes the 4.2s to the `alpha` export queue. The bucketed latency field is tagged `resolution=4bit`, and the p99 query returns `p99 ∈ [bucket_lo, bucket_hi]` rather than a false point estimate. When the salt rotates to `E8` mid-trace, the aggregator re-derives under both epochs and either joins or emits `parent_status=unresolved`, which increments a counter that pages the observability owner before an on-call agent can misattribute latency. The residual cost: shared-salt hashing weakens per-tenant privacy on low-entropy tokens, so the salt epoch must be short and the aggregator must be the only holder of the salt-derivation secret — the privacy guarantee moves from "tenant cannot be linked" to "aggregator can link, tenants cannot." That trade must be made explicitly, because the alternative — per-tenant salts — is not a weaker privacy guarantee, it is a silently broken causal graph that looks like a healthy one. ```python import hashlib from dataclasses import dataclass from enum import Enum class CorrelationCollapseError(RuntimeError): """Raised when a span export would silently break cross-tenant join topology.""" class ParentStatus(Enum): ROOT = "root" RESOLVED = "resolved" UNRESOLVED = "unresolved" REDACTED = "redacted" @dataclass(frozen=True) class Span: tenant: str trace_id: str span_id: str parent_span_id: str | None handoff_token: str | None salt_epoch: str | None parent_status: ParentStatus JOIN_KEYS = {"handoff_token", "agent.instance_id"} def apply_privacy_transform(span: Span, tenant_salt: str, shared_salt: str) -> Span: """Apply redaction. Refuse to per-tenant-hash a join key.""" if span.handoff_token is not None: # Join key: must use shared salt, never tenant salt. if tenant_salt and tenant_salt != shared_salt: raise CorrelationCollapseError( f"tenant {span.tenant} attempted per-tenant transform on join key " f"'handoff_token' for span {span.span_id}; this would drop the " f"cross-tenant edge silently" ) transformed = hashlib.sha256( f"{shared_salt}:{span.handoff_token}".encode() ).hexdigest() return Span( tenant=span.tenant, trace_id=span.trace_id, span_id=span.span_id, parent_span_id=span.parent_span_id, handoff_token=transformed, salt_epoch=shared_salt, parent_status=span.parent_status, ) return span def aggregate_join(spans: list[Span], known_span_ids: set[str]) -> list[tuple[Span, Span]]: """Join children to parents; refuse to emit null-parent as root.""" edges: list[tuple[Span, Span]] = [] by_id = {s.span_id: s for s in spans} for child in spans: if child.parent_span_id is None: if child.parent_status is not ParentStatus.ROOT: raise CorrelationCollapseError( f"span {child.span_id} has no parent but is not marked ROOT; " f"parent_status={child.parent_status}" ) continue parent = by_id.get(child.parent_span_id) if parent is None: if child.parent_status is not ParentStatus.UNRESOLVED: raise CorrelationCollapseError( f"span {child.span_id} references parent " f"{child.parent_span_id} absent from aggregate but is not " f"flagged UNRESOLVED; silent edge loss" ) continue if (child.salt_epoch is not None and parent.salt_epoch is not None and child.salt_epoch != parent.salt_epoch): raise CorrelationCollapseError( f"handoff edge {parent.span_id}->{child.span_id} spans salt epochs " f"{parent.salt_epoch} vs {child.salt_epoch}; re-derive under both " f"or mark UNRESOLVED" ) edges.append((parent, child)) return edges ```