# What structural signals indicate causal trace divergence when reconstructing emergent multi-agent behavior from partial spans **Date of Record:** 2026 November 24 **Scope:** Applies to post-hoc reconstruction of multi-agent causal graphs from span/event telemetry where agents emit asynchronous, partially sampled traces (MCP tool calls, A2A handoffs, peer/auditor messages). Does not apply to fully synchronous single-agent traces with guaranteed span completeness, nor to real-time online monitoring where spans arrive in causal order. ## Core Distinction There is a difference between *trace completeness* (every span an agent emitted was eventually persisted) and *causal trace fidelity* (the reconstructed happens-before graph matches the actual causal order that produced the observed outputs). Observability tooling routinely conflates these. A trace can be 100% complete at the span level and still reconstruct a causally false graph, because the reconstruction algorithm infers edges from *timestamps and parent-span pointers*, both of which degrade under multi-agent concurrency in ways single-agent tracing never exposes. The specific failure: when two agents in a swarm operate concurrently and share no wall-clock synchronization, the reconstruction joins their spans using `parent_span_id` where available and `start_time` ordering where not. Emergent behaviors—the interesting ones, the ones you actually want to observe—are precisely the interactions that *were not* explicitly instrumented as parent-child links. They are peer-to-peer messages, shared-memory reads, and baton passes that the runtime never recorded as causal edges. The reconstructor therefore fills the gap with timestamp proximity, and timestamp proximity under clock skew and async scheduling produces *phantom causal edges*: A appears to have caused B when in fact B was already in flight, or both were caused by an uninstrumented C. ## What Was Observed A three-agent swarm (planner, executor, auditor) executing a tool-use task. The auditor emits a `REJECT` verdict that, in the reconstructed graph, is a child of the executor's second tool call—implying the auditor reacted to that call. In the actual execution, the auditor's verdict was derived from a cached read of the planner's intent record that had been written *before* the executor's first call. The reconstruction placed the verdict downstream of the wrong node entirely. Structural signals that flagged the divergence: 1. **Orphaned causal fan-in.** The auditor span had a `parent_span_id` pointing to a span that did not exist in the persisted set (the planner's intent-write span was dropped by the sampler). The reconstructor's fallback logic silently reparented it to the nearest timestamp-preceding span. Orphan fan-in that gets silently reparented is the single strongest signal of fidelity loss. 2. **Negative happens-before slack.** After reconstruction, the edge `executor.call_2 → auditor.verdict` had a start-time delta of −3ms (verdict started before the call it supposedly reacted to). Sub-millisecond negative slack is tolerated as clock noise; −3ms on a 40ms tool call is not noise, it is a reparenting artifact. Any reconstructed edge with negative slack beyond the measured clock-skew envelope is a phantom edge. 3. **Missing shared-resource access spans.** The auditor's read of the planner's intent record produced no span, because the shared-memory read was not instrumented. The reconstructor had no edge to draw, so it drew the closest one. Absence of a span for a known shared resource is a structural hole, not an absence of causality. 4. **Consensus replay mismatch.** Replaying the reconstructed graph forward (each node's recorded input/output) did not reproduce the auditor's verdict from its reconstructed parents. The verdict was only reproducible when the uninstrumented intent-write was injected. Replay divergence is the ground-truth check: if the graph cannot regenerate the observed outputs, the graph is wrong regardless of span completeness. ## Condition of Validity The reconstruction is causally faithful only when all three hold: - Every span that writes to a shared resource (memory, blackboard, message queue) is instrumented, or the reconstructor is told explicitly that the resource exists and its reads/writes are opaque. - The clock-skew envelope between any two agents is measured and bounded tighter than the shortest inter-agent causal latency; edges with slack inside the envelope are marked *ambiguous*, not resolved by proximity. - Orphan spans (dangling `parent_span_id`) are surfaced as unresolved, never silently reparented. When any of these fails, the reconstructed graph is a *plausible* DAG, not a *causal* one, and downstream analysis (blame, divergence detection, emergent-behavior mining) inherits the error. ## Decision Boundary The boundary is whether to treat an ambiguous edge as resolved or unresolved. Resolution by timestamp proximity is only valid when the skew envelope is strictly smaller than the minimum genuine causal latency between the two agents. In a swarm, intra-agent tool calls may be 5ms apart while inter-agent handoffs are 40–200ms; if skew is ±10ms, proximity resolution is safe *within* an agent and unsafe *across* agents. The decision rule: cross-agent edges require an explicit causal token (message ID, memory version vector, baton sequence number); absent that token, the edge is emitted as `UNRESOLVED` and the graph is flagged `fidelity=degraded`. Do not let the reconstructor promote an unresolved edge to a resolved one to produce a tidy DAG. ## Operational Effect Treating the reconstructed graph as ground truth when it is merely plausible causes three concrete operational harms: (a) blame attribution lands on the wrong agent, so the wrong prompt or tool schema gets "fixed"; (b) emergent-behavior detection fires on phantom edges, flagging coordination patterns that never occurred; (c) replay-based verification passes or fails for reasons unrelated to the actual execution, eroding trust in the verifier. The guardrail is to make fidelity a first-class, machine-checkable property of every reconstructed graph—orphan count, negative-slack edge count, unresolved-edge count, and replay-reproduction rate—and to refuse to emit a causal claim when replay cannot reproduce the observed output from the reconstructed parents. ```python from dataclasses import dataclass from typing import Optional class CausalFidelityError(RuntimeError): """Raised when a reconstructed multi-agent trace cannot be certified as causal.""" pass @dataclass class ReconstructedEdge: src: str dst: str slack_ms: float # dst.start - src.end has_causal_token: bool # message id / version vector / baton seq present cross_agent: bool @dataclass class TraceReport: orphan_spans: int clock_skew_ms: float edges: list[ReconstructedEdge] replay_reproduced: bool def certify_causal_graph(report: TraceReport) -> str: # Orphans must never be silently reparented; they invalidate fidelity. if report.orphan_spans > 0: raise CausalFidelityError( f"{report.orphan_spans} orphan span(s) with dangling parent_span_id; " "reconstructor must not reparent by timestamp proximity" ) # Cross-agent edges without a causal token and with slack inside the # skew envelope are ambiguous, not resolved. for e in report.edges: if e.cross_agent and not e.has_causal_token: if abs(e.slack_ms) <= report.clock_skew_ms: raise CausalFidelityError( f"ambiguous cross-agent edge {e.src}->{e.dst} " f"(slack={e.slack_ms}ms within skew={report.clock_skew_ms}ms, " "no causal token); emit UNRESOLVED, not a resolved edge" ) # Negative slack beyond the skew envelope indicates a phantom edge # produced by reparenting, not clock noise. if e.slack_ms < -report.clock_skew_ms: raise CausalFidelityError( f"phantom edge {e.src}->{e.dst}: slack {e.slack_ms}ms " f"exceeds skew envelope {-report.clock_skew_ms}ms" ) # Ground-truth check: graph must regenerate observed outputs. if not report.replay_reproduced: raise CausalFidelityError( "replay failed to reproduce observed outputs from reconstructed " "parents; graph is plausible, not causal" ) return "fidelity=certified" ```