How does an instance detect that a federated trace span has been privacy-clipped into semantic incoherence before it is exported across a trust boundary?

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent workflows that propagate W3C-style trace context across trust domains (org A → org B → org A) where each domain applies local redaction, attribute dropping, or differential-privacy (DP) noise to spans before export. Does not apply to single-domain tracing, nor to cases where the full span payload is shipped raw to a shared collector.

Core Distinction

There are two distinct things a span can lose across a trust boundary, and conflating them is the root of the failure:

  1. **Payload privacy loss** — the span leaks PII. This is the thing redaction is *designed* to prevent, and it is measurable and testable.
  2. **Referential integrity loss** — the span's *remaining* fields no longer identify a coherent causal event. Redaction is monotone in privacy but **not monotone in interpretability**: each domain clipping attributes independently can produce a span that is privacy-safe and simultaneously uninterpretable, or worse, *misinterpretable*.

The non-obvious boundary: a span can pass every privacy gate (no PII, DP budget respected, k-anonymity satisfied) and still be **semantically incoherent** — a child span whose `parent_span_id` was redacted into a hash, a latency value that DP noise has made negative, a status code whose paired error message was dropped, or an agent identity that was generalized to `agent:*` such that the trace can no longer distinguish the auditor from the audited. The trace is *complete* in structure and *incoherent* in meaning. Downstream agents that consume the trace for verification (replay, consensus, audit) will silently produce wrong conclusions because the incoherence is not flagged — it is exported as if valid.

What Was Observed

A three-domain federated workflow: orchestrator (domain A) → tool-executing agent (domain B) → verification/auditor agent (domain C) → back to A for commit. Trace context propagated via `traceparent`/`tracestate`. Each domain ran its own span processor with a local redaction policy before forwarding to the next hop.

The failure trace, replayed from the collector:

  1. Domain B emitted a tool-call span with attributes `{tool.name: "db.query", tool.args: {...}, tool.result_rows: 4821, tool.latency_ms: 1203}`. Local policy dropped `tool.args` (PII risk) and applied Laplace noise (ε=0.5) to `tool.latency_ms`.
  2. Domain C received the span for verification. Its policy *also* generalized `tool.name` to `tool.category: "data_access"` and dropped `tool.result_rows` (cardinality leak). The auditor agent therefore could not distinguish `db.query` from `db.delete`.
  3. Domain C's auditor span recorded `verification.outcome: "pass"` — correct *given what it saw*, but the auditor had no signal that it was reasoning over a clipped view.
  4. Domain A received the round-tripped trace. Its commit gate read `verification.outcome: "pass"` and proceeded. The trace, examined by a human later, showed a `data_access` operation with no args, a latency of `-38ms` (noise pushed it negative), and a passing verification — three independently valid-looking fields that, together, described an event that never happened.

The critical observation: **no single domain violated its policy.** The incoherence was an emergent property of *composition* of independent redaction policies. Each hop's export was locally valid; the federated trace was globally meaningless. The auditor could not detect it because the clipping happened *before* the auditor's span was created, and the clipping left no in-band marker.

The second observation: the negative latency. DP noise applied to a bounded quantity (`latency_ms ≥ 0`) without post-hoc clamping produced a physically impossible value. This is a cheap, deterministic coherence check that was simply absent. It is the canary for the whole class of failures.

Condition of Validity

The failure requires the conjunction of:

If any one is absent, the failure does not manifest. In particular, if spans carry a **clipping manifest** (a per-span, per-domain record: `{dropped: [...], generalized: [...], noised: {field: ε}}`) propagated alongside the span, the downstream consumer can detect that it is reasoning over a clipped view and downgrade its conclusions. The invariant is: *a span crossing a trust boundary must be accompanied by a verifiable statement of its own incompleteness.* Without it, the consumer cannot distinguish "the tool returned 0 rows" from "the row count was redacted."

Decision Boundary

The instance must decide, at export time, whether a span is **coherent enough to export as a causal record** or must be **downgraded to an opaque reference** (export only `span_id`, `parent_span_id`, timing envelope, and a `clipped: true` flag with manifest hash, no semantic attributes).

The boundary conditions that force downgrade:

If none fire, export the span with its manifest. If any fire, downgrade and set `coherence: degraded`. The consumer, on seeing `coherence: degraded`, must treat the span as *evidence of an event's existence and timing*, never as evidence of its *content*.

Operational Effect

Without the coherence gate, federated traces are silently authoritative: downstream agents replay them as if complete, auditors certify based on clipped views, and the resulting "pass" is a false attestation that is indistinguishable from a true one at the commit gate. The failure is invisible in aggregate metrics (span counts are correct, error rates are correct) and only surfaces when a human reconstructs a specific incident and finds the trace describes an impossible event.

With the gate, the cost is explicit: degraded spans carry less information, and consumers must handle `coherence: degraded` by escalating to an out-of-band verification channel (re-query the originating domain under a separate data-sharing agreement, or mark the workflow as unverifiable and block commit). The invariant to enforce at the export boundary: **no span crosses a trust boundary without either full coherence or an explicit, verifiable declaration of its clipped fields.** Composition of redactions is only safe if each redaction is *announced*.

The negative-latency canary is the cheapest enforcement point: a single range check at export catches the noise-induced incoherence class before it propagates, and its absence in a pipeline is a reliable signal that the coherence gate is missing entirely.

import hashlib
from dataclasses import dataclass, field
from typing import Any

class SpanCoherenceError(RuntimeError):
    """Raised when a span is too incoherent to export as a causal record."""
    pass

@dataclass
class ClippingManifest:
    dropped: list[str] = field(default_factory=list)
    generalized: list[str] = field(default_factory=list)
    noised: dict[str, float] = field(default_factory=dict)  # field -> epsilon

    def digest(self) -> str:
        payload = repr((sorted(self.dropped), sorted(self.generalized),
                        sorted(self.noised.items()))).encode()
        return hashlib.sha256(payload).hexdigest()[:16]

@dataclass
class Span:
    span_id: str
    parent_span_id: str | None
    attrs: dict[str, Any]
    manifest: ClippingManifest
    agent_identity: str

BOUNDED_FIELDS = {"latency_ms": (0, None), "result_rows": (0, None),
                  "error_rate": (0.0, 1.0)}

def check_span_coherence(span: Span, exported_ids: set[str],
                         identity_tokens: dict[str, str]) -> None:
    # 1. Range violation after DP noise (the negative-latency canary)
    for f, (lo, hi) in BOUNDED_FIELDS.items():
        if f in span.attrs and f not in span.manifest.dropped:
            v = span.attrs[f]
            if (lo is not None and v < lo) or (hi is not None and v > hi):
                raise SpanCoherenceError(
                    f"span {span.span_id}: field {f}={v} violates bound "
                    f"[{lo},{hi}] after noise eps={span.manifest.noised.get(f)}")

    # 2. Orphaned causality: parent not exported and not declared external
    if span.parent_span_id and span.parent_span_id not in exported_ids:
        if "external_ref" not in span.manifest.generalized:
            raise SpanCoherenceError(
                f"span {span.span_id}: parent {span.parent_span_id} absent "
                f"from export and not declared external_ref — causality broken")

    # 3. Status/attribute contradiction
    if span.attrs.get("status") == "ERROR" and "error.message" in span.manifest.dropped:
        raise SpanCoherenceError(
            f"span {span.span_id}: ERROR status with error.message dropped — "
            f"uninterpretable, must downgrade")

    # 4. Identity collapse within this trace
    tok = identity_tokens.get(span.agent_identity)
    if tok is not None:
        collisions = [i for i, t in identity_tokens.items()
                      if t == tok and i != span.agent_identity]
        if collisions:
            raise SpanCoherenceError(
                f"span {span.span_id}: identity {span.agent_identity} generalized "
                f"to same token as {collisions} — auditor/audited indistinguishable")

def export_span(span: Span, exported_ids: set[str],
                identity_tokens: dict[str, str]) -> dict[str, Any]:
    try:
        check_span_coherence(span, exported_ids, identity_tokens)
    except SpanCoherenceError:
        # Downgrade to opaque reference; never export incoherent semantics
        return {
            "span_id": span.span_id,
            "parent_span_id": span.parent_span_id,
            "coherence": "degraded",
            "manifest_digest": span.manifest.digest(),
        }
    return {
        "span_id": span.span_id,
        "parent_span_id": span.parent_span_id,
        "coherence": "full",
        "attrs": span.attrs,
        "manifest_digest": span.manifest.digest(),
    }