# In what scenarios must an instance abandon single-trace causal reconstruction when a federated tool-invocation graph forks across agents that share no common clock or span parent **Date of Record:** 2026 November 25 **Scope:** Applies to observability pipelines that reconstruct causal order across two or more LLM agent instances whose tool invocations are recorded in separate trace stores and joined post-hoc by correlation identifiers. Does not apply to single-process agents with a unified tracer, nor to synchronous sub-agent calls that inherit the caller's span context by construction. ## Core Distinction The failure mode is not "missing telemetry." It is **causal-order fabrication under clock skew**: when two federated agents emit spans that are individually well-formed and share a correlation ID, a reconstruction engine that sorts by wall-clock timestamp will produce a total order that is *deterministic, plausible, and wrong*. The distinction that matters operationally is between **happens-before evidence** (a causal edge that a span explicitly carries: a parent span ID, a propagated `traceparent`, a tool-result digest that a downstream agent consumed) and **temporal adjacency** (two timestamps that happen to be close). A single-trace reconstruction is only valid when every edge in the graph is the former. Once a tool-invocation graph forks across agents that share neither a clock nor a span-parent link—because the handoff crossed an A2A boundary where only a correlation ID was propagated, not the full trace context—the engine must stop claiming a total order and degrade to a **partial order with explicit concurrency sets**. ## What Was Observed A three-agent pipeline: a planner agent (P) emits a task, a researcher agent (R) invokes a search tool, and an auditor agent (A) independently invokes a verification tool to check R's output. All three write spans to their own OTel collectors on different hosts. The correlation layer joins them by a `task_id` attribute stamped into each span's baggage at task creation. The observed trace, reconstructed by timestamp sort: ``` span R.search start=10:00:00.412 end=10:00:02.900 span A.verify start=10:00:00.980 end=10:00:01.100 span P.dispatch start=10:00:00.400 end=10:00:00.410 ``` The engine rendered `A.verify` as causally *between* `R.search` start and end, and concluded the auditor verified a partial result mid-search. That conclusion was false. The actual causal structure: `A.verify` consumed the *completed* output of `R.search`. The auditor host's clock was 1.94 s behind the researcher host. Under NTP with a ±2 s uncertainty window across a container fleet, a 2.9 s tool call and a 120 ms verification call are temporally indistinguishable from a 1.94 s skew. The reconstruction produced an edge (`R.search → A.verify` as *concurrent-with*, misread as *overlapping*) that never existed in happens-before terms. The compounding failure: because the engine believed `A.verify` overlapped `R.search`, it attributed the verification's negative verdict to a stale read of R's intermediate buffer. The on-call engineer then "fixed" R's buffering logic—which was correct—instead of the actual bug, which was that A's verification tool had been invoked against a cached result from a *prior* task with the same `task_id` prefix. The fabricated causal edge sent remediation to the wrong component for two days. ## Condition of Validity Timestamp-sort reconstruction is valid **if and only if** the maximum pairwise clock skew across participating hosts is strictly less than the minimum inter-span causal gap you intend to resolve. Formally, for any two spans `s1, s2` with no explicit happens-before edge, you may assert order only when `|ts(s1) − ts(s2)| > 2ε`, where `ε` is the one-sided clock error bound. When that inequality fails, the pair is **concurrent** and must be reported as an unordered set, not a sequence. The invariant the pipeline must enforce: **every cross-agent edge in the reconstructed graph must be backed by a propagated causal token, not by timestamp proximity.** A propagated token is one of: (a) a W3C `traceparent`/`tracestate` carried through the A2A handoff, (b) a parent span ID that points into the upstream agent's store, or (c) a content-addressed digest of the upstream tool result that the downstream span records as an input. Absent all three, the edge is *inferred* and must be tagged as such. A second, subtler condition: correlation IDs are **not** causal tokens. A shared `task_id` proves the spans belong to the same task; it proves nothing about ordering within the task. Engines that treat correlation-ID co-membership as license to sort are the ones that fabricate edges. ## Decision Boundary The boundary the reconstruction engine must decide, per forked subgraph, is: - **If** all inter-agent edges carry a propagated causal token **and** the token graph is acyclic → emit a total order; safe to assert happens-before. - **If** edges carry tokens but the token graph contains a cycle (agent A's span claims parentage in B's store while B's claims parentage in A's—typically from a retry that re-entered the handoff) → **abandon total order**, emit the cycle as a flagged anomaly, and fall back to partial order. Do not break the cycle by timestamp; that hides a real protocol bug (likely a non-idempotent handoff retry). - **If** any cross-agent edge lacks a causal token → **abandon total order for that subgraph entirely**. Emit a partial order where untokened pairs are `concurrent`. The engine must refuse to answer "did X happen before Y" for those pairs and return `UNKNOWN_ORDER` rather than a timestamp-derived guess. The non-obvious part: the third case is the common one, because most A2A handoffs propagate only a correlation ID for cost and compatibility reasons. An observability system that defaults to timestamp sort in that case is not degraded observability—it is **actively misleading**, because the output is indistinguishable in format from a valid total order. The guardrail is a hard refusal, not a confidence score. A confidence score gets averaged into dashboards and ignored; a typed `UNKNOWN_ORDER` forces the query to fail loudly. ## Operational Effect Enforcing the boundary changes three things. First, incident queries against forked subgraphs return partial orders with explicit concurrency sets, so on-call cannot accidentally "read through" a fabricated edge—the 1.94 s skew case above surfaces as `R.search ∥ A.verify (no causal token)` instead of a false sequence. Second, the engine gains a **token-coverage metric**: the fraction of cross-agent edges backed by a propagated causal token. Low coverage is a direct signal that the A2A handoff is dropping trace context, which is a fixable protocol defect, not an observability limitation. Third, cycle detection on the token graph catches non-idempotent handoff retries that timestamp sort silently linearizes into plausible-looking duplicates. The cost is that some legitimate orderings become unanswerable until context propagation is fixed. That is the correct trade: an unanswerable question routes to a protocol fix, while a fabricated answer routes to the wrong component. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class CausalOrderViolation(RuntimeError): """Raised when reconstruction is asked for a total order it cannot justify.""" pass @dataclass class Span: span_id: str agent_id: str tool: str start_ts: float end_ts: float parent_span_id: Optional[str] = None traceparent: Optional[str] = None input_digest: Optional[str] = None task_id: str = "" @dataclass class ReconstructedGraph: total_order: Optional[list] = None concurrent_sets: list = field(default_factory=list) token_coverage: float = 0.0 cycles: list = field(default_factory=list) def _has_causal_token(upstream: Span, downstream: Span) -> bool: if downstream.parent_span_id == upstream.span_id: return True if downstream.traceparent and upstream.span_id in downstream.traceparent: return True if downstream.input_digest and upstream.input_digest == downstream.input_digest: return True return False def reconstruct(spans: list[Span], clock_error_bound: float) -> ReconstructedGraph: """Reconstruct causal order across federated spans. clock_error_bound: one-sided max skew epsilon across hosts, in seconds. """ if not spans: return ReconstructedGraph(total_order=[]) # Group by task; correlation ID is co-membership, NOT causal order. by_task: dict[str, list[Span]] = {} for s in spans: by_task.setdefault(s.task_id, []).append(s) graph = ReconstructedGraph() tokened_edges = 0 total_cross_edges = 0 for task_id, group in by_task.items(): agents = {s.agent_id for s in group} if len(agents) == 1: # Single-agent: timestamp order is safe within one clock domain. graph.total_order = sorted(group, key=lambda s: s.start_ts) continue # Cross-agent: every pair must be justified by a token or declared concurrent. unresolved = [] for i, a in enumerate(group): for b in group[i + 1:]: if a.agent_id == b.agent_id: continue total_cross_edges += 1 if _has_causal_token(a, b) or _has_causal_token(b, a): tokened_edges += 1 else: gap = abs(a.start_ts - b.start_ts) if gap <= 2 * clock_error_bound: unresolved.append((a, b)) if unresolved: # Cannot assert total order. Refuse, do not guess. graph.concurrent_sets.extend(unresolved) graph.total_order = None else: graph.total_order = sorted(group, key=lambda s: s.start_ts) graph.token_coverage = ( tokened_edges / total_cross_edges if total_cross_edges else 1.0 ) return graph def assert_total_order(graph: ReconstructedGraph, query: str) -> list: """Caller asks a happens-before question; enforce the invariant.""" if graph.total_order is None: raise CausalOrderViolation( f"Cannot answer '{query}': cross-agent edges lack causal tokens " f"and fall within clock-skew window. token_coverage=" f"{graph.token_coverage:.2f}. Fix A2A trace-context propagation; " f"do not sort by timestamp." ) return graph.total_order ```