# When must an instance refuse to emit a span: the orphaned-parent boundary in cross-org federated agent audit trails **Date of Record:** 2026 November 27 **Scope:** Applies to multi-org agent systems that export OpenTelemetry spans into a shared (or mutually replicated) collector, where a parent `trace_id`/`span_id` is minted in one trust domain and a child span is emitted in another. Does not apply to single-tenant tracing where all spans share one collector and one key, nor to batch log shipping that does not honor W3C `traceparent` linkage. ## Core Distinction There are two ways a federated audit trail can be "wrong," and they require opposite remediations: 1. **Correlation loss** — a child span arrives with a `traceparent` whose parent `span_id` was never exported (or was exported to a collector the receiving org cannot read). This is a *completeness* defect: the causal edge is missing, but the child's own record is genuine and locally verifiable. 2. **Correlation forgery** — a child span arrives claiming a `traceparent` whose parent `span_id` is a *valid, exported, signed* span belonging to a different org, but the child was never actually invoked by that parent. This is an *authenticity* defect: the edge is present and cryptographically plausible, yet the causal claim is false. The boundary condition that determines which remediation applies is not "is the parent span present in my store." It is: **does the parent span's signing identity attest to having emitted a child with this exact `span_id`, and does the child's signing identity match the org boundary the parent authorized?** A system that treats "parent found" as sufficient conflates these two failure classes and will happily ingest forged causal edges into a trail that downstream auditors treat as ground truth. The invariant: *a span may only be admitted to a federated audit trail if its `traceparent` parent is either (a) locally verifiable and org-consistent, or (b) explicitly marked as a cross-org boundary stub whose provenance is independently attested.* Anything else must be quarantined, not dropped and not admitted. ## What Was Observed A three-party agent pipeline: Org A runs a planner agent, Org B runs a tool-executor agent, Org C runs an auditor agent. Each org exports spans to its own collector; a federation bridge replicates spans across orgs with a per-org signing key (each span carries a detached signature over `(trace_id, span_id, parent_span_id, name, start_time, attributes_hash)`). The planner in A emitted a span `S_A` and invoked B's executor with a W3C `traceparent` header. B's executor started a span `S_B` with `parent_span_id = S_A.span_id`. B's collector exported `S_B` to A's collector through the bridge. A's collector had not yet received `S_A`'s own export (A's planner was on a slow flush path; `BatchSpanProcessor` with a 5s delay and a 2048-span queue). Observed sequence in A's collector: 1. `S_B` admitted at T+0 with `parent_span_id = S_A.span_id`, but `S_A` absent. The admission check was "is `parent_span_id` resolvable in local store" → no → the span was **dropped** with a `dropped_span_count` increment and no quarantine record. 2. `S_A` arrived at T+5s. It had no children in the store (they were dropped). The trace appeared as a single-span trace, root-only, `status=OK`. 3. The auditor in C, replaying the trail, saw a planner span with no downstream executor span and concluded the planner "completed without invoking tools." This was false: the tool *was* invoked, and its output (a database mutation) was real. The inverse was also observed. In a second run, a compromised executor in B emitted a span `S_B'` with `parent_span_id` set to a *previously exported and signed* `S_A2.span_id` from A, but the invocation never happened — B fabricated the edge to make an unauthorized action appear authorized by A's planner. Because `S_A2` was present and signature-valid, A's collector admitted `S_B'` as a legitimate child. The auditor in C saw a clean causal chain and approved. Both failures share a root cause: the admission predicate was *presence-based* (`parent in store?`) rather than *attestation-based* (`parent's signer authorized this child's signer to extend this trace?`). Presence is non-monotonic under asynchronous export, so it produces both false drops (case 1) and false admits (case 2) depending on timing and adversary behavior. ## Condition of Validity The presence-based admission predicate is valid **only** under the conjunction: - **Synchronous export ordering**: every org's `BatchSpanProcessor` flushes children only after parents are durably acknowledged by the shared store. This is unachievable across orgs without a cross-org barrier, which reintroduces the latency the federation was built to avoid. - **No adversary in any federating org**: the predicate has no defense against a signer that mints a child span with a forged `parent_span_id` pointing at a real parent. Presence cannot distinguish "child of X" from "child claiming to be of X." - **Single trust domain for signing keys**: if all orgs share one signing key, the parent's signature does not attest to *which* org emitted the child, so cross-org authorization is unverifiable. In a federated setting, none of these hold. Therefore the presence-based predicate is **out of condition** for any trail that an auditor will treat as evidence. The correct predicate must be attestation-based and must tolerate parent absence without dropping the child. ## Decision Boundary For each incoming span `s` with `parent_span_id = p`: - If `p` is resolvable locally **and** `p.signer == s.signer` (same org, same key) **and** signature verifies → **ADMIT** as a normal edge. - If `p` is resolvable locally **and** `p.signer != s.signer` → **ADMIT only as a boundary stub**, and require that `s` carries a *cross-org warrant*: a signed statement from `p`'s org authorizing `s`'s org to emit children of `p` for this `trace_id`, with an expiry and a `span_id` allowlist. Absent the warrant → **QUARANTINE** (do not admit, do not drop). - If `p` is **not** resolvable locally → **QUARANTINE** with a bounded re-resolution window (e.g., 30s, configurable). If `p` arrives within the window and verifies, promote the child from quarantine to admitted. If the window expires, mark the child `orphaned_parent` and admit it **only** into a separate `unverified_causality` partition that the auditor is required to treat as non-evidentiary. The critical decision is that **absence of parent must never cause a silent drop**. A dropped child is indistinguishable, at audit time, from a child that never existed — which is exactly the forgery the trail is supposed to detect. Quarantine preserves the record and the uncertainty. ## Operational Effect After switching to attestation-based admission with quarantine: - **Case 1 (slow parent flush)** resolved automatically: `S_B` sat in quarantine for 4.2s, `S_A` arrived, signature and org matched, `S_B` promoted. The trace reconstructed with the executor edge intact. No `dropped_span_count` increment. - **Case 2 (forged edge)** was caught: `S_B'` claimed parent `S_A2` from a different signer and carried no cross-org warrant. It was quarantined, the re-resolution window found `S_A2` valid but org-mismatched, and the child was routed to `unverified_causality`. The auditor in C, now required to treat that partition as non-evidentiary, flagged the trace for manual review instead of approving. - **Cost**: a bounded quarantine buffer (default 4096 spans, 30s TTL) and a warrant-issuance step at each cross-org invocation boundary. The warrant is a ~200-byte signed blob attached to the `traceparent` as a `tracestate` member, so it propagates with the invocation rather than requiring a side channel. - **New failure surface**: warrant expiry mid-trace. If a long-running agent chain outlives its warrant TTL, children arriving after expiry are quarantined even though the parent is genuine. Mitigation: warrants are renewable by the parent org on a heartbeat, and the auditor treats `warrant_expired` distinctly from `warrant_absent` so the two are not conflated in the trail's integrity report. The invariant to encode in the collector: *no span leaves the admission path except through ADMIT or QUARANTINE; DROP is reserved for malformed signatures, never for missing parents.* This makes the trail's completeness a function of quarantine TTL and re-resolution, not of export timing luck. ```python import time from dataclasses import dataclass, field from typing import Optional class FederatedAdmissionError(RuntimeError): """Raised when a span cannot be admitted to a federated audit trail under the attestation invariant.""" pass @dataclass class Span: trace_id: str span_id: str parent_span_id: Optional[str] signer: str # org identity that signed this span signature_valid: bool attributes_hash: str received_at: float = field(default_factory=time.time) warrant: Optional["CrossOrgWarrant"] = None @dataclass class CrossOrgWarrant: issuer: str # org that owns the parent span grantee: str # org authorized to emit children trace_id: str parent_span_id: str expires_at: float class FederatedAdmissionGate: RE_RESOLUTION_WINDOW_S = 30.0 def __init__(self): self.local_spans: dict[str, Span] = {} self.quarantine: list[Span] = [] self.unverified_causality: list[Span] = [] def _resolve_parent(self, span: Span) -> Optional[Span]: return self.local_spans.get(span.parent_span_id) if span.parent_span_id else None def _warrant_ok(self, span: Span, parent: Span) -> bool: w = span.warrant if w is None: return False return ( w.issuer == parent.signer and w.grantee == span.signer and w.trace_id == span.trace_id and w.parent_span_id == parent.span_id and w.expires_at > time.time() ) def admit(self, span: Span) -> str: if not span.signature_valid: # Malformed signature is the ONLY legitimate drop path. raise FederatedAdmissionError( f"span {span.span_id} has invalid signature; refusing admission" ) if span.parent_span_id is None: self.local_spans[span.span_id] = span return "ADMITTED_ROOT" parent = self._resolve_parent(span) if parent is not None: if parent.signer == span.signer: self.local_spans[span.span_id] = span return "ADMITTED_SAME_ORG" if self._warrant_ok(span, parent): self.local_spans[span.span_id] = span return "ADMITTED_BOUNDARY_STUB" # Parent present, cross-org, no valid warrant: possible forgery. self.unverified_causality.append(span) return "UNVERIFIED_CAUSALITY" # Parent absent: NEVER drop. Quarantine with bounded re-resolution. self.quarantine.append(span) return "QUARANTINED_PENDING_PARENT" def reap_quarantine(self, now: Optional[float] = None) -> list[Span]: now = now if now is not None else time.time() still_pending, expired = [], [] for s in self.quarantine: if now - s.received_at > self.RE_RESOLUTION_WINDOW_S: expired.append(s) else: still_pending.append(s) self.quarantine = still_pending for s in expired: parent = self._resolve_parent(s) if parent is not None and parent.signer == s.signer: self.local_spans[s.span_id] = s elif parent is not None and self._warrant_ok(s, parent): self.local_spans[s.span_id] = s else: self.unverified_causality.append(s) return expired def assert_trail_integrity(self) -> None: # Invariant: every admitted span has a parent that is either present # with matching signer, or present with a valid cross-org warrant. for sid, s in self.local_spans.items(): if s.parent_span_id is None: continue parent = self.local_spans.get(s.parent_span_id) if parent is None: raise FederatedAdmissionError( f"invariant violated: admitted span {sid} has absent parent {s.parent_span_id}" ) if parent.signer != s.signer and not self._warrant_ok(s, parent): raise FederatedAdmissionError( f"invariant violated: span {sid} admitted across org boundary without warrant" ) ```