# Under what conditions must an instance distrust a causally complete tool-call graph reconstructed across federated runtimes **Date of Record:** 2026 November 22 **Scope:** Applies to multi-runtime agent fleets where tool-call causality graphs are reconstructed by joining per-runtime span exports (OpenTelemetry-style `trace_id`/`span_id`/`parent_span_id` plus agent-specific `tool_call_id`). Does not apply to single-process agents with a single authoritative trace store, nor to graphs reconstructed only from a shared, transactional event log. ## Core Distinction A causality graph can be *structurally complete* and still be *causally false*. Completeness is a graph property: every node has a resolvable parent, every `tool_call_id` referenced by an edge exists in some runtime's export, no orphans. Truth is a temporal property: for each edge `A → B`, `A` must have *happened-before* `B` in a single consistent global order, and the *content* of `A`'s result must be the content `B` actually consumed. The failure mode this record isolates is **cross-runtime clock-skew reordering of tool-call edges**, which produces graphs that pass every structural validation check while inverting the actual causal order of two or more tool calls. The invariant at stake: *a reconstructed edge `A → B` is trustworthy only if it is corroborated by at least one non-clock signal (span linkage, monotonic sequence number, or payload hash chaining).* Wall-clock timestamps inherited across federated runtimes are not such a signal. ## What Was Observed A three-runtime fleet (planner on `runtime-eu`, executor on `runtime-us`, auditor on `runtime-ap`) exported spans to a central collector. Each runtime stamped spans with its own `time.time()` under NTP discipline. NTP kept each node within ~40 ms of truth, but *pairwise* offsets of 15–30 ms were routine, and one executor node drifted 180 ms after a suspend/resume cycle before resync. The graph reconstructor ordered spans per `trace_id` by `start_time` and attached parents via `parent_span_id`. Consider the actual sequence on the executor: 1. `execute_sql` (span `s1`) starts at executor-local `12:00:00.200`. 2. `execute_sql` returns a row count at `12:00:00.260`. 3. `summarize_rows` (span `s2`) starts at `12:00:00.270`, consuming `s1`'s output. Both spans were exported with `parent_span_id` pointing to the planner's `plan` span, not to each other — the executor emitted them as siblings because the agent framework did not model intra-runtime tool-to-tool dependency. The reconstructor, seeing two siblings under `plan`, ordered them by timestamp and inferred an edge `s1 → s2` from ordering. On the drifted node, the exported `s1.start_time` was `11:59:59.960` and `s2.start_time` was `12:00:00.090` — still ordered `s1 → s2`. Correct by luck. The failure surfaced on a *different* trace where the executor had made two independent calls: - `fetch_price` (span `p1`) at executor-local `12:00:00.100`, returned `$142.00`. - `fetch_price` (span `p2`) at executor-local `12:00:00.150`, returned `$141.50` (a re-fetch after a cache miss). - `execute_trade` (span `t1`) at `12:00:00.160`, consuming `p2`'s `$141.50`. After the 180 ms drift, `p1` exported at `11:59:59.920` and `p2` at `11:59:59.970` — order preserved. But the auditor runtime, whose offset was `+25 ms` relative to the collector, stamped its `verify_trade` span at `12:00:00.140`, which the reconstructor placed *before* `t1` (`12:00:00.160`). The resulting graph showed `verify_trade → execute_trade`, i.e., the auditor verifying a trade before it was executed. The graph was structurally valid: all parents resolved, no orphans, monotone timestamps along every edge. It was causally false. An incident review then replayed the graph to attribute a bad trade to the auditor. The replay consumed a graph in which the verification edge preceded the execution edge, so the replay's own re-derivation of "what the auditor saw" was seeded with `p1`'s `$142.00` rather than `p2`'s `$141.50`. The attribution was wrong by `$0.50` and, more importantly, by one causal hop. ## Condition of Validity The reconstruction is valid only under the conjunction: 1. **Edge corroboration.** Every inferred edge (one not backed by an explicit `parent_span_id` or a framework-emitted `tool_call_id` chain) must be corroborated by a runtime-local monotonic sequence number or a payload hash chain (`B.input_hash == hash(A.output)`). Timestamp ordering alone is *not* corroboration. 2. **Clock-offset bound.** Cross-runtime edges are trustworthy only when the measured pairwise offset `|offset(r_i, r_j)|` is strictly less than the minimum inter-span gap along the edge's endpoints. If the offset bound cannot be established for a runtime (e.g., post-suspend drift before resync), all edges incident to that runtime are marked *unverified*, not *valid*. 3. **Sibling disambiguation.** Two spans sharing a parent must not be ordered relative to each other by timestamp unless a sequence signal exists. Sibling timestamp ordering is the specific mechanism by which the `verify_trade → execute_trade` inversion was manufactured. 4. **Replay seeding integrity.** Any replay that consumes the graph must re-derive tool inputs from the *corroborated* predecessor's output, and must refuse to run if the predecessor edge is unverified. Violating condition 2 alone is sufficient to invalidate attribution even when conditions 1, 3, and 4 hold; violating condition 3 alone is sufficient to invert sibling order even with perfect clocks. ## Decision Boundary The boundary is not "is the graph complete" but "is each edge's order *provable* from a signal that does not depend on synchronized clocks." Concretely: - If an edge is backed by `parent_span_id` **and** the child's `start_time` is within the parent's `[start, end]` interval on the *parent's* clock (same runtime), accept. - If an edge crosses runtimes and is backed only by timestamp ordering, **reject as unverified** — do not silently accept, do not silently drop; mark and exclude from replay seeding. - If an edge crosses runtimes and is backed by a payload hash chain or a framework sequence number, accept regardless of timestamp. - If a runtime's offset bound exceeds the minimum inter-span gap on any incident edge, quarantine that runtime's edges for the trace and emit a `CausalityUnverified` marker rather than a graph. The trap is that the *majority* of edges in a healthy fleet are timestamp-ordered and correct, so a reconstructor that accepts timestamp ordering will be right most of the time and catastrophically wrong exactly when drift coincides with a tight inter-span gap — which is precisely the high-frequency tool-call pattern (re-fetch, retry, audit-after-execute) where attribution matters most. ## Operational Effect Downstream consumers must treat the graph as a *partially ordered* structure with an explicit `verified` bit per edge, not a total order. Incident attribution, replay seeding, and audit sign-off all read the `verified` bit; an unverified edge downgrades the conclusion from "the auditor verified before execution" to "the relative order of verification and execution is not established." In the observed case, that downgrade alone would have prevented the misattribution: the review would have reported "auditor and executor ran within the clock-offset envelope; order indeterminate" instead of a false causal claim. The guardrail is cheap: emit a per-runtime monotonic counter on every span, hash-chain tool outputs into tool inputs where the framework allows, and bound clock offsets at export time. Where those are absent, the reconstructor must fail closed — an unverified edge is not a weaker edge, it is a different kind of claim, and conflating the two is the failure this record exists to prevent. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class CausalityUnverifiedError(RuntimeError): """Raised when a cross-runtime causal edge cannot be corroborated by a non-clock signal and must not be used to seed replay or attribution.""" @dataclass class Span: runtime: str span_id: str parent_span_id: Optional[str] start: float # runtime-local wall clock end: float seq: Optional[int] = None # runtime-local monotonic counter input_hash: Optional[str] = None # hash of consumed tool input output_hash: Optional[str] = None # hash of produced tool output @dataclass class Edge: src: Span dst: Span verified: bool = field(default=False) def _hash_payload(payload: str) -> str: return hashlib.sha256(payload.encode()).hexdigest() def corroborate_edge(edge: Edge, offset_bound: float) -> Edge: """Decide whether a cross-runtime edge is causally trustworthy. Accepts on: explicit parent linkage within the parent's own clock interval, a payload hash chain, or a runtime-local sequence number. Rejects (raises) on timestamp-only ordering across runtimes. """ src, dst = edge.src, edge.dst # Same-runtime parent linkage: trust the runtime's own clock. if src.runtime == dst.runtime and dst.parent_span_id == src.span_id: if src.start <= dst.start <= src.end: edge.verified = True return edge # Payload hash chain: strongest cross-runtime signal. if src.output_hash is not None and dst.input_hash is not None: if src.output_hash == dst.input_hash: edge.verified = True return edge # Runtime-local monotonic sequence: corroborates order without clocks. if src.runtime == dst.runtime and src.seq is not None and dst.seq is not None: if src.seq < dst.seq: edge.verified = True return edge # Timestamp-only cross-runtime ordering: only valid if the offset bound # is strictly smaller than the observed inter-span gap. gap = dst.start - src.start if src.runtime != dst.runtime and gap > offset_bound > 0: edge.verified = True return edge raise CausalityUnverifiedError( f"edge {src.span_id}({src.runtime}) -> {dst.span_id}({dst.runtime}) " f"is timestamp-only with gap={gap:.3f}s and offset_bound={offset_bound:.3f}s; " f"refusing to treat as causal" ) def seed_replay(graph_edges: list[Edge], offset_bound: float) -> list[Edge]: """Replay may only consume verified edges; unverified edges abort seeding.""" verified = [] for edge in graph_edges: try: verified.append(corroborate_edge(edge, offset_bound)) except CausalityUnverifiedError: # Fail closed: do not silently drop, do not silently accept. raise return verified ```