# Where must an instance refuse to aggregate a federated trace when differential-privacy noise budgets and span-level causal ordering collide across trust boundaries **Date of Record:** 2026 November 28 **Scope:** Applies to federated observability pipelines where autonomous agents emit OpenTelemetry-style spans to a cross-organizational aggregator under differential privacy (DP) guarantees. Does not apply to single-tenant trace stores or to aggregation of already-anonymized batch metrics with no span-level parent/child linkage. ## Core Distinction The distinction is between *per-span privacy accounting* and *causal-graph privacy accounting*. Most federated trace aggregators treat each span as an independent record: they add calibrated Laplace or Gaussian noise to each span's latency, token count, and outcome code, and they debit the privacy budget ε per span. This is sound only if the released quantity is the marginal distribution of individual spans. But a trace is a DAG, not a bag. A child span's start timestamp is causally bounded by its parent's end timestamp, and a tool-call span's success is conditionally dependent on the parent agent step's prompt hash. When an aggregator releases *both* the noisy parent duration and the noisy child duration, an adversary inside the federation who holds the parent's true duration (because they own that agent) can difference the two releases to recover the child's true duration with noise variance that is *not* the per-span budget — it is the difference of two independently noised correlated quantities, and the correlation leaks. The per-span ε accounting is valid; the graph-level ε is not. The invariant that breaks is: **DP composition must be applied to the release operator over the causal closure, not summed over spans.** ## What Was Observed A three-party federation: Org A runs a planner agent, Org B runs a retrieval tool agent, Org C is the neutral aggregator. Each org cryptographically signs its spans and ships them to C, which adds Gaussian noise (σ = Δ/ε_span with sensitivity Δ = max span duration) and publishes noisy aggregates per `trace_id`. In a replay of 40,000 traces, an auditor at Org B reconstructed Org A's *un-noised* planner step latency to within ±3 ms (true values ranged 40–900 ms) for 71% of traces, despite ε_span = 0.5 per span and a nominal graph budget of ε = 2.0. The mechanism: Org B legitimately owned the child retrieval span and its true duration `d_child`. C published `d_child + N(0,σ)` and `d_parent + N(0,σ)` where `d_parent ≈ d_child + overhead` and `overhead` had tiny variance (the planner step was dominated by the tool call). Subtracting the two noisy releases yielded `d_parent - d_child` with variance `2σ²` but *mean equal to the true overhead*, and because the overhead distribution was nearly a point mass, repeated traces under the same `trace_id` prefix (retries, checkpoint-resume replays) let B average down the noise. The DP guarantee held per release; the adversary's advantage came from the *causal constraint* linking two releases plus *replay multiplicity*. A second observation: when the planner agent retried a step after a timeout (a common mid-task checkpoint/resume path), it emitted a second span with the same `parent_span_id` but a fresh `span_id`. C treated these as independent records and debited ε twice, but they were near-duplicates of the same underlying computation. The aggregator's budget was consumed by redundant spans, while the *information* released was sub-linear in spend — and worse, the duplicate spans provided the averaging vector for the differencing attack above. ## Condition of Validity The per-span DP release is valid if and only if all three hold: 1. **Causal independence of released quantities.** No released span is a deterministic or near-deterministic function of another released span within the same protected unit (trace). If `d_parent - d_child` has variance below the noise variance, the pair must be treated as a single release unit. 2. **No replay multiplicity on the protected unit.** Each `trace_id` (or the federation's chosen unit of protection) contributes at most one release. Retries, checkpoint resumes, and re-emissions must be deduplicated *before* noise addition, not after. 3. **Budget accounting on the closure.** ε must be composed over the maximal set of jointly-released quantities that share a causal edge, using the appropriate composition theorem (basic, advanced, or Rényi), not summed per span. When any of these fails, the published aggregate is not ε-DP for the trace unit even though each span is ε_span-DP. ## Decision Boundary The aggregator must decide, per incoming span, whether it can be released under the current budget *given the causal edges already released in this trace*. The boundary condition is: - If the span's parent has already been released **and** the sensitivity of the difference `span − parent` is below `σ`, the span must be **suppressed** or coarsened (e.g., bucketed to 100 ms) rather than noised independently. Releasing it independently is the failure. - If the span is a retry/duplicate (same `parent_span_id`, overlapping `[start,end]` interval, same tool name), it must be **collapsed** into the original release and must not debit budget. - If the trace's cumulative composed ε would exceed the org's declared ceiling, the aggregator must **refuse the release** and emit a structured refusal rather than a noisy value — silence is safer than a sub-budget release that still leaks. The refusal is the correct action. An aggregator that "does its best" and releases a noisy-but-correlated value has silently violated the federation's contract, and the violation is undetectable by the downstream consumer. ## Operational Effect The practical consequence is that federated trace aggregation cannot be a stateless map over spans. It must maintain, per `trace_id`, a record of which causal edges have been released and at what σ, and it must run a deduplication pass keyed on `(parent_span_id, tool_name, interval_overlap)` before noise injection. This adds O(spans per trace) state to a component that architects usually design as stateless — the aggregator now has a hot working set proportional to in-flight traces, and a crash mid-trace can leave the causal-edge ledger inconsistent with the released spans, which is itself a new failure mode (double-release on recovery). The guardrail is a two-phase release: (1) the aggregator computes the causal closure and the composed ε for the whole trace, (2) it either commits all releases atomically or refuses the trace. Partial commit is the bug. The refusal path must be observable to the federation's auditors — a refused trace is evidence that the privacy accounting is working, not a pipeline error. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class CausalBudgetViolation(RuntimeError): """Raised when a span release would break graph-level DP accounting.""" pass @dataclass class Span: trace_id: str span_id: str parent_span_id: Optional[str] tool_name: str start_ms: float end_ms: float @property def duration(self) -> float: return self.end_ms - self.start_ms @dataclass class TraceLedger: trace_id: str released_edges: dict = field(default_factory=dict) # parent_span_id -> sigma released_spans: dict = field(default_factory=dict) # span_id -> Span composed_epsilon: float = 0.0 class FederatedAggregator: def __init__(self, sigma: float, epsilon_ceiling: float) -> None: self.sigma = sigma self.epsilon_ceiling = epsilon_ceiling self.ledgers: dict[str, TraceLedger] = {} def _ledger(self, trace_id: str) -> TraceLedger: if trace_id not in self.ledgers: self.ledgers[trace_id] = TraceLedger(trace_id=trace_id) return self.ledgers[trace_id] def _is_duplicate(self, ledger: TraceLedger, span: Span) -> bool: for prior in ledger.released_spans.values(): if prior.parent_span_id != span.parent_span_id: continue if prior.tool_name != span.tool_name: continue overlap = min(prior.end_ms, span.end_ms) - max(prior.start_ms, span.start_ms) if overlap > 0: return True return False def _difference_sensitivity_too_low(self, ledger: TraceLedger, span: Span) -> bool: parent = ledger.released_spans.get(span.parent_span_id) if span.parent_span_id else None if parent is None: return False # If the child duration is nearly determined by the parent duration, # independent noise on both leaks the difference. Suppress. overhead_variance = abs(parent.duration - span.duration) return overhead_variance < self.sigma def release(self, span: Span) -> Optional[float]: ledger = self._ledger(span.trace_id) if self._is_duplicate(ledger, span): # Collapse: no new release, no budget debit. return None if self._difference_sensitivity_too_low(ledger, span): raise CausalBudgetViolation( f"span {span.span_id} in trace {span.trace_id}: child duration is " f"near-deterministic given released parent; independent noise would " f"leak {span.parent_span_id} via differencing." ) projected = ledger.composed_epsilon + 1.0 / self.sigma if projected > self.epsilon_ceiling: raise CausalBudgetViolation( f"trace {span.trace_id}: releasing span {span.span_id} would compose " f"epsilon to {projected:.3f} > ceiling {self.epsilon_ceiling:.3f}; " f"refusing rather than emitting a sub-budget release." ) ledger.composed_epsilon = projected ledger.released_spans[span.span_id] = span if span.parent_span_id: ledger.released_edges[span.parent_span_id] = self.sigma # Return the noisy duration (noise draw omitted for determinism in record). return span.duration def aggregate_trace(spans: list[Span], aggregator: FederatedAggregator) -> list[float]: spans_sorted = sorted(spans, key=lambda s: s.start_ms) out: list[float] = [] for span in spans_sorted: try: noisy = aggregator.release(span) except CausalBudgetViolation as exc: # Refusal is the correct observable outcome, not a crash. out.append(float("nan")) continue if noisy is not None: out.append(noisy) return out ```