# In what scenarios must an instance treat causal-trace reconstruction as unsound when span clocks are unsynchronized across agent hops **Date of Record:** 2026 November 26 **Scope:** Applies to distributed tracing of multi-agent decision graphs where causal parent-child links are inferred from timestamps emitted by independent hosts (planner, tool-executor, verifier, retriever) rather than from an explicit causal token. Does not apply to single-process agents or to traces that carry an explicit propagated span-context (W3C traceparent or equivalent) on every hop. ## Core Distinction There are two structurally different things a trace backend can reconstruct when it renders an "agent decision graph": 1. **Recorded causality** — the parent relationship was written into the child span at emission time by the agent that knew it was a child (because it received the parent's span ID in the request payload). This is a fact, not an inference. 2. **Inferred causality** — the backend sorts spans by wall-clock `start_time` and links each span to the most recent prior span from the same logical agent, or to whichever upstream span's `[start, end]` interval overlaps the child's start. This is a *reconstruction*, and it is only valid when clock skew across the participating hosts is smaller than the smallest inter-hop latency in the graph. The failure mode lives entirely in case 2. When an LLM agent's decision graph is stitched from timestamps alone, clock skew on any single host can invert parent-child order, and the reconstruction will silently produce a *plausible but wrong* causal tree — a tree in which the verifier appears to have approved a plan before the planner emitted it, or in which a tool call appears to be the *cause* of the prompt that triggered it. The trace looks well-formed. There is no dangling span, no error flag, no missing edge. That is exactly what makes it dangerous: the observability system reports high confidence on a graph that never existed. ## What Was Observed A four-agent pipeline: `Planner` → `Retriever` → `ToolExecutor` → `Verifier`, each on a separate pod, each emitting OTLP spans to a collector. Span context was propagated *only* on the `Planner→Retriever` edge (the planner was the only service instrumented with the shared tracing middleware); the downstream edges relied on the collector's `parent_span_id` being absent, so the backend fell back to interval-overlap inference. Retriever pods were NTP-synced to within ~4 ms. ToolExecutor pods ran on a node whose `chrony` had drifted to **+310 ms** and was not being corrected because the node's egress to the NTP pool was firewalled (a common condition in locked-down GPU nodes). Verifier ran on the same drifted node. The observed trace, rendered by the backend: ``` Planner.plan [t=0.000 .. 1.180] Retriever.fetch [t=0.900 .. 2.050] parent=Planner.plan (recorded) ToolExecutor.call [t=2.360 .. 2.410] parent=Retriever.fetch (inferred) Verifier.check [t=2.100 .. 2.290] parent=Retriever.fetch (inferred) <-- WRONG ``` Because ToolExecutor's clock was +310 ms, its span *started* at true time 2.05 but was recorded at 2.36. The Verifier, on the same drifted node, recorded its start at 2.10 — which is *before* the tool call it was supposed to be verifying. The backend, doing interval-overlap inference, attached the Verifier to `Retriever.fetch` (the only span whose interval contained 2.10) instead of to `ToolExecutor.call`. Downstream effect: an automated SLO monitor computed "verifier latency after tool call" as a *negative* duration, clamped it to zero, and reported the verifier as "instantaneous, no work performed." A regression-detection job that watched for verifier-skipped events fired a false positive and rolled back a good model version. The actual trace was correct end-to-end; only the reconstruction was wrong. The tell — and it is subtle — was that the reconstructed tree contained a span whose recorded `start_time` was *earlier than its inferred parent's `end_time`*, but *later than its inferred parent's `start_time`*. Interval-overlap inference tolerates this. Explicit-parent reconstruction cannot produce it. ## Condition of Validity Interval-overlap inference of causal edges is valid **iff** for every hop `(P, C)` in the true decision graph: ``` skew_max < min_over_hops( true_latency(P → C) ) ``` where `skew_max` is the maximum pairwise clock offset among all hosts emitting spans in the graph, and `true_latency` is the real wall-clock gap between the parent's emission and the child's emission. Equivalently: the reconstruction is sound only when clock error is strictly smaller than the shortest causal gap you are trying to measure. This is a *hard* invariant, not a heuristic. It fails silently in two regimes: - **Short hops under drift.** A tool call that takes 40 ms (a cache hit, a fast function call) is indistinguishable from a 40 ms clock-skew artifact. The graph is under-determined; the backend picks *an* edge and reports it as *the* edge. - **Concurrent siblings.** When a planner fans out to N parallel retrievers, interval overlap cannot disambiguate which retriever a downstream tool call "belongs" to unless the tool call carries the retriever's span ID. Under skew, the wrong sibling gets the edge, and the fan-out/fan-in structure of the decision graph is silently permuted. The invariant also fails in a third, sneakier regime: **retries and replays.** If a tool call is retried, the second attempt's span may start *before* the first attempt's span ends (if the retry was issued optimistically), and interval-overlap inference will nest the retry inside the original — producing a graph that claims the agent did the same work twice in parallel when it actually did it twice in sequence. Multi-agent verification replay (auditor re-runs the trace to confirm a decision) will then disagree with the original run's graph, and the auditor and the runtime will deadlock on which graph is canonical. ## Decision Boundary The operative question is not "is the trace correct?" but **"is the trace's causal structure recorded or inferred, and do I know which?"** The boundary is: | Condition | Action | |---|---| | Every hop carries an explicit propagated span-context (W3C traceparent, or an equivalent causal token in the agent's message envelope) | Trust the parent edges. Interval overlap is only used for latency, never for structure. | | Any hop lacks explicit context AND `skew_max` is unknown or unmeasured | **Do not render a decision graph.** Render spans as an unordered set, or as a per-host timeline, and mark the graph as `causality: unverified`. | | Any hop lacks explicit context AND `skew_max < min_hop_latency` (measured, not assumed) | Interval-overlap inference is admissible; tag the graph `causality: inferred`, and refuse to feed it to any automated decision (SLO, regression, audit) that assumes recorded causality. | | Retries or fan-out present | Interval overlap is *never* sufficient for structural edges, regardless of skew. Require explicit context or a causal token. | The critical rule for agent systems: **an observability pipeline that infers causal edges must never be the input to an automated action that assumes those edges are facts.** The false-positive rollback above happened because the SLO monitor consumed an inferred graph as if it were recorded. The reconstruction was fine as a *display*; it was catastrophic as a *control input*. ## Operational Effect When this boundary is respected, three things change in how a GenAI observability stack is built: 1. **Causal tokens travel in the agent payload, not just in HTTP headers.** An LLM agent's tool call is a structured message; the parent's span ID (and the agent's own identity warrant) must be embedded in that message's envelope, because many agent transports (queues, MCP tool invocations, A2A handoffs) do not preserve HTTP header context across the hop. If the token is not in the payload, the hop is inferred, and the invariant above governs whether inference is admissible. 2. **Skew is measured, not assumed.** The collector must emit a per-host clock-offset estimate (from the span timestamps themselves, via a NTP-independent estimator such as a bounded-offset algorithm over request/response pairs) and expose it as a first-class trace attribute. A graph whose `skew_max` exceeds its `min_hop_latency` must be flagged at render time, not discovered during an incident. 3. **Replay audits must compare recorded graphs, not reconstructed ones.** When an auditor agent re-runs a trace to verify a decision, it must replay against the *recorded* parent edges. If it replays against an inferred graph, and the runtime that produced the original decision used a *different* inference (different collector version, different skew at the time), the auditor and the runtime will produce different decision graphs for the same execution — and the verification step will deadlock or, worse, silently disagree on whether the decision was correct. The guardrail, stated as an invariant an agent system can enforce: > A decision graph may be consumed as a control input only if every edge in it is `recorded`, or if every edge is `inferred` and the graph's `skew_max` is strictly less than the minimum hop latency across the graph. Otherwise the graph is `advisory` and must not trigger automated action. This is the same class of failure as a stale-memory drift or a checkpoint/resume mismatch: the system reports a coherent state that is not the state that actually occurred. The difference is that here the incoherence is in the *causal structure itself*, and the system has no way to know it, because the reconstruction is always internally consistent — it just isn't the graph that ran. ```python class UnsoundCausalReconstruction(RuntimeError): """Raised when a decision graph's causal edges cannot be trusted as facts.""" pass def assert_graph_is_consumable(graph, *, min_hop_latency_s: float) -> None: """ Guard a decision graph before it is used as a control input (SLO monitor, regression detector, auditor replay). A graph is consumable iff: - every edge is recorded, OR - every edge is inferred AND skew_max < min_hop_latency_s AND the graph contains no retries/fan-out that require explicit context. """ edges = graph.edges if not edges: return edge_kinds = {e.kind for e in edges} # {"recorded", "inferred"} if edge_kinds == {"recorded"}: return if "recorded" in edge_kinds and "inferred" in edge_kinds: raise UnsoundCausalReconstruction( f"Mixed causality in graph {graph.trace_id!r}: " f"{sum(e.kind == 'recorded' for e in edges)} recorded, " f"{sum(e.kind == 'inferred' for e in edges)} inferred. " "Cannot treat inferred edges as facts alongside recorded ones." ) # All edges inferred: apply the skew-vs-latency invariant. if graph.skew_max_s is None: raise UnsoundCausalReconstruction( f"Graph {graph.trace_id!r} is fully inferred but skew_max is unknown; " "interval-overlap inference is unverifiable." ) if graph.skew_max_s >= min_hop_latency_s: raise UnsoundCausalReconstruction( f"Graph {graph.trace_id!r}: skew_max={graph.skew_max_s:.3f}s " f">= min_hop_latency={min_hop_latency_s:.3f}s. " "Causal order is under-determined; edges may be inverted." ) if graph.has_retries or graph.has_fanout: raise UnsoundCausalReconstruction( f"Graph {graph.trace_id!r}: retries/fan-out present under inferred " "causality; interval overlap cannot disambiguate sibling or " "retry edges. Require explicit span-context on every hop." ) # Inferred but bounded: admissible as advisory input only. graph.causality_confidence = "advisory" ```