# How should an instance reconcile divergent trace roots when federated observability spans cross an organizational trust boundary mid-episode? **Date of Record:** 2026 November 22 **Scope:** Applies to multi-agent systems where an episode's causal trace is stitched together from spans emitted by agents owned by two or more organizations, each with its own trace-root assignment and clock authority. Does not apply to single-tenant observability, nor to purely post-hoc log aggregation where no live correlation decision is required. ## Core Distinction The conventional distinction in distributed tracing is between *propagated* context (parent span IDs carried in headers) and *locally generated* context (a new root when no parent arrives). Federated agent observability breaks this dichotomy because the trust boundary itself becomes a context-formation event. When agent A (Org X) hands a task to agent B (Org Y) via an A2A or MCP transport crossing an organizational boundary, Org Y's observability stack is contractually and often technically forbidden from accepting Org X's trace root verbatim: it must mint its own root for audit sovereignty, then *link* to the foreign root via a correlation attribute rather than a parent pointer. The non-obvious consequence: a single logical episode now has **two or more trace roots that are each locally valid**, and no single store owns the join. The join exists only as a *claim* — `correlation_id = X` on one side, `foreign_trace_ref = Y` on the other — that must be reconciled by whichever party (or auditor) later attempts to reconstruct causality. Reconciliation is not a lookup; it is a *decision* about which root is authoritative for which span, and that decision is where the invariant lives. ## What Was Observed An incident on a three-hop episode: Org X planner agent → Org Y retrieval agent (cross-boundary) → Org Y auditor agent (intra-boundary) → back to Org X executor. Observed trace facts: - Org X emitted root `tx-A` with spans `A1..A7`; `A4` carried `correlation_id=c-991` and `foreign_trace_ref=ty-B` on the egress span. - Org Y emitted root `ty-B` with spans `B1..B5`; `B1` carried `correlation_id=c-991`, `inbound_ref=tx-A`, and `trust_class=foreign`. - The return leg to Org X produced `A5` with a *new* local parent — Org X's propagator, seeing no recognized inbound root, minted `tx-A'` and attached `correlation_id=c-991` plus `foreign_trace_ref=ty-B`. So Org X now had two roots (`tx-A`, `tx-A'`) for one episode, both citing the same correlation ID. The failure surfaced during replay-based verification: the auditor reconstructed the episode by joining on `correlation_id=c-991` and obtained a **DAG with two roots and a phantom edge** — because `A5`'s parent pointer pointed at `tx-A'`, not `A4`, the join produced an apparent fork where `A4` and `A5` were siblings under no common ancestor. The verification replay flagged a causality violation ("executor ran before planner completed") that never occurred in reality. The replay was *deterministic* and *wrong*: it faithfully reproduced a corrupted join, not the episode. The trigger condition is precise: **a cross-boundary round trip where the returning leg re-enters the originating organization's trust domain.** A one-way egress (`X→Y`, no return) never mints the second local root, so the join is single-rooted and correct. The bug is latent until the episode returns home, which is exactly the topology of most delegation-with-callback agent patterns. ## Condition of Validity The correlation invariant holds only under all of: 1. **Root multiplicity is declared, not inferred.** Each span must carry `trace_root_authority` (the org that minted its root) and `correlation_id`. Absence of `trace_root_authority` must be treated as *unknown*, never defaulted to the local org — defaulting is the exact mechanism that produced `tx-A'`. 2. **Return-leg reattachment is explicit.** When a span re-enters an org that already owns a root for the same `correlation_id`, the propagator MUST attach to the existing root as a *cross-root link* (`linked_trace_ref`), not mint a new root. This requires the ingress path to consult a local correlation index keyed by `correlation_id` before root assignment. 3. **The join is a first-class object.** Reconstruction must consume an explicit join record (root set + link edges + authority per root), not re-derive it by matching correlation IDs across stores. Matching-based joins are non-deterministic under clock skew and under partial span loss. 4. **Clock authority is per-root.** Cross-root edges carry no temporal ordering guarantee; any verifier that orders spans across roots by wall-clock timestamp is invalid, because Org Y's clock is not synchronized to Org X's within the tolerance needed for sub-second agent spans. The invariant fails silently whenever any of (1)–(4) is violated, and it fails *plausibly* — the corrupted DAG looks like a real concurrency anomaly, which is worse than a crash. ## Decision Boundary At correlation time, an instance must choose between two actions, and the choice is governed by a single test: **does a local root already exist for this `correlation_id`?** - If **no local root exists** (first ingress): mint a root, record `trace_root_authority=self`, emit `inbound_ref=`. This is correct and cheap. - If a **local root exists** (return leg): do NOT mint. Attach via `linked_trace_ref` to the foreign root and to the existing local root, and record the edge as `cross_root=true, ordered=false`. The boundary is *not* "did we see a foreign header" — that test passes on both legs and is the trap. The boundary is *local correlation-index state*, which is exactly the state that a stateless propagator does not have. Therefore the guardrail is architectural: **root assignment must be a stateful operation against a correlation index, not a header-transform function.** Any design where root minting is a pure function of inbound headers will mint `tx-A'` on the return leg, every time, deterministically. A secondary boundary: if the correlation index is unavailable (cold partition, index loss), the instance must **fail closed** — emit the span with `trace_root_authority=unknown` and `correlation_id` set, and refuse to participate in automated verification replay until the join is resolved by an explicit reconciliation pass. Degrading to "mint a fresh root and hope the ID matches" is the failure mode, not the fallback. ## Operational Effect Downstream, three effects propagate from a single mis-minted root: 1. **Verification replay produces false causality violations**, which either block legitimate episodes (if the verifier is a gate) or train operators to ignore verifier output (if it is advisory) — the second is the durable damage. 2. **Audit joins become non-reproducible**: two auditors joining the same `correlation_id` on different days get different DAGs because index state and clock skew differ. The episode's causal record is no longer a fact but a function of when you ask. 3. **Trust-boundary laundering**: because `tx-A'` is locally authoritative, Org X's own audit trail shows the executor's work as a fresh episode unconnected to the planner, which is precisely the concealment pattern an external auditor is trying to detect. The remediation that holds is the join-object model: persist an explicit `FederatedJoin` per `correlation_id` listing every root, its authority, and cross-root link edges; make root assignment consult it; make verification consume it rather than re-derive. The invariant to enforce is: **for any `correlation_id`, the number of roots equals the number of distinct `trace_root_authority` values, and every cross-boundary edge is marked unordered.** Violation of that count is the alarm — it is detectable at write time, before any replay, which is the only place the failure can be caught cheaply. ```python from dataclasses import dataclass, field class FederatedJoinError(RuntimeError): """Raised when root assignment or join reconciliation violates the federated correlation invariant.""" @dataclass class FederatedJoin: correlation_id: str roots: dict = field(default_factory=dict) # root_id -> authority org cross_edges: list = field(default_factory=list) # (from_root, to_root) def assign_root(self, root_id: str, authority: str, inbound_ref: str | None): # Invariant: roots must be one-per-authority for a correlation_id. for existing_root, existing_auth in self.roots.items(): if existing_auth == authority and existing_root != root_id: raise FederatedJoinError( f"correlation {self.correlation_id}: org {authority} already " f"owns root {existing_root}; refusing to mint {root_id} " f"(return-leg re-entry must link, not re-root)" ) if inbound_ref is not None: self.cross_edges.append((inbound_ref, root_id)) self.roots[root_id] = authority def verify(self): authorities = list(self.roots.values()) if len(authorities) != len(set(authorities)): raise FederatedJoinError( f"correlation {self.correlation_id}: root count {len(authorities)} " f"!= distinct authorities {len(set(authorities))}" ) return True def handle_ingress(join: FederatedJoin, inbound_root: str, local_org: str, inbound_authority: str): # Stateful test: does a local root already exist for this correlation? local_roots = [r for r, a in join.roots.items() if a == local_org] if local_roots: # Return leg: link to existing local root, do not mint. existing = local_roots[0] join.cross_edges.append((inbound_root, existing)) return existing if inbound_authority == local_org: raise FederatedJoinError( f"inbound root {inbound_root} claims local authority {local_org} " f"but no local root exists for {join.correlation_id}; " f"authority spoofing or index loss — fail closed" ) new_root = f"{local_org}-{join.correlation_id}-root" join.assign_root(new_root, local_org, inbound_ref=inbound_root) join.verify() return new_root ```