# What structural signals indicate causal-trace divergence when replaying multi-agent runs for post-hoc safety audits **Date of Record:** 2026 November 28 **Scope:** Applies to post-hoc deterministic replay of recorded multi-agent LLM runs where causal provenance is reconstructed from a shared append-only event log (tool calls, messages, agent spawns, handoffs). Does not apply to single-agent, single-turn inference, nor to replay that re-executes live models against a live environment rather than a recorded transcript. ## Core Distinction A multi-agent run is *causally traceable* only if, for every recorded effect, the log contains a complete ordered chain of (a) the event that produced the input, (b) the agent instance identity that consumed it, and (c) the transport-level delivery acknowledgment. Deterministic replay is a *different* property: it requires that re-executing the recorded decision function over the recorded inputs yields the recorded outputs. The non-obvious boundary is this: **replay can succeed bit-for-bit while causal tracing is silently broken.** A run can replay to identical final state and still contain orphaned effects—tool calls whose originating message was delivered to a *different* agent instance than the one recorded as the consumer. This happens because replay validates *outputs against inputs*, not *inputs against provenance*. The divergence is invisible to output-equality checks and only surfaces when you walk the causal DAG and find an edge whose (producer_instance, consumer_instance, delivery_seq) triple does not close. ## What Was Observed In a recorded run of a three-agent swarm (planner → executor → auditor), the executor issued a `write_file` tool call. The auditor later read the file and approved. Replay produced identical file contents and identical approval verdict. The run was marked "replay-verified." Walking the causal DAG, however, revealed a structural signal of divergence: the `write_file` call's `caused_by` pointer referenced a message whose `delivery_ack` had landed at *sequence 4192*, but the executor's instance ledger showed it had been *replaced* (crash-restart) at sequence 4187. The message was delivered to the pre-restart instance ID; the tool call was recorded under the post-restart instance ID. The restart boundary was a *seam*: the executor's in-memory mailbox state was reconstructed from a checkpoint taken at 4150, so the message that actually triggered the write was a *stale replay* of an earlier instruction, not the message the DAG pointed to. The output matched because the stale instruction and the intended instruction happened to specify the same file and the same content. The causal edge was wrong. The audit's safety conclusion ("the write was authorized by message X") was unsound, because message X was never delivered to the instance that wrote. Three structural signals distinguished this from a clean trace: 1. **Sequence inversion between `delivery_ack` and `instance_epoch`.** The ack sequence number was lower than the consumer's current epoch-start sequence, meaning the ack predated the instance that consumed it. 2. **Checkpoint-relative provenance.** The `caused_by` pointer resolved to a message whose `replay_origin` was a checkpoint snapshot, not a live delivery—i.e., the input was reconstructed, not received. 3. **Missing re-delivery record.** A correct restart protocol re-delivers unacked messages to the new epoch. No `redelivery` event existed for message X. The message was consumed from the checkpoint mailbox without a transport-level re-ack. ## Condition of Validity The invariant that makes replay audits sound is: > For every recorded effect E with consumer instance I, there exists a delivery event D such that D.ack_seq > I.epoch_start_seq AND D.consumer_id == I.id AND E.caused_by ∈ D.payload_set AND no checkpoint reconstruction of I's mailbox occurred between D.ack_seq and E.seq without a corresponding `redelivery` event. Replay-verification is valid only when this holds for *every* effect in the DAG. If any effect violates it, the run is *output-replayable but causally untraceable*, and any safety claim that depends on provenance ("who authorized this write") is unproven. The condition fails silently under the common audit pattern of comparing final-state hashes, because the hash is insensitive to which message authorized the write. ## Decision Boundary The audit must branch on trace integrity *before* it evaluates safety properties, not after. The decision boundary is: - **Trace-closed:** every effect's causal chain satisfies the invariant. Proceed to safety evaluation; provenance claims are admissible. - **Trace-seamed:** at least one effect crosses a restart/checkpoint boundary without a re-delivery record. The effect's provenance is *unknown*, not *invalid*. Do not treat the recorded `caused_by` as ground truth; treat it as a hypothesis requiring re-derivation from the pre-restart mailbox snapshot. - **Trace-orphaned:** an effect's `caused_by` resolves to no delivery event at all (e.g., message dropped by a timeout that was logged only at the transport layer). The effect is causally unattributed; the run is not auditable for that effect. The boundary is crossed when `epoch_start_seq` of any consumer exceeds the `ack_seq` of any edge into it. A single crossing demotes the whole run from trace-closed to trace-seamed, because the audit's unit of soundness is the *chain*, not the effect. ## Operational Effect Auditors that check output equality will pass seamed runs and issue false safety clearances. The fix is structural, not statistical: instrument the restart protocol to emit an explicit `redelivery` event for every unacked message at epoch transition, and make the replay verifier reject any effect whose causal edge lacks either a live delivery ack or a redelivery record. This converts a silent provenance gap into a hard audit failure. The cost is that crash-restart runs will fail trace-closure until the redelivery instrumentation is in place—which is correct: an unaudited restart is a safety hole, and a replay that hides it is worse than a replay that refuses. ```python class CausalTraceDivergence(RuntimeError): """Raised when a replayed effect's causal edge does not satisfy the provenance invariant.""" pass def verify_effect_provenance(effect, deliveries, epochs, checkpoints): """ effect: dict with keys seq, consumer_id, caused_by deliveries: list of dicts with keys ack_seq, consumer_id, payload_set epochs: dict consumer_id -> epoch_start_seq checkpoints: list of dicts with keys consumer_id, snapshot_seq, restored_seq """ consumer = effect["consumer_id"] epoch_start = epochs.get(consumer) if epoch_start is None: raise CausalTraceDivergence( f"effect seq={effect['seq']} references unknown consumer {consumer!r}" ) candidate = [ d for d in deliveries if d["consumer_id"] == consumer and effect["caused_by"] in d["payload_set"] ] if not candidate: raise CausalTraceDivergence( f"effect seq={effect['seq']} orphaned: no delivery to {consumer!r} " f"carries caused_by={effect['caused_by']!r}" ) live = [d for d in candidate if d["ack_seq"] > epoch_start] if not live: # all candidate deliveries predate the consumer's current epoch stale = candidate[0] redelivered = any( d["ack_seq"] > epoch_start and d["consumer_id"] == consumer for d in deliveries if effect["caused_by"] in d["payload_set"] ) if not redelivered: raise CausalTraceDivergence( f"effect seq={effect['seq']} seamed: delivery ack_seq={stale['ack_seq']} " f"<= epoch_start={epoch_start} for {consumer!r}, no redelivery record" ) for cp in checkpoints: if cp["consumer_id"] != consumer: continue if cp["restored_seq"] < effect["seq"] and cp["snapshot_seq"] >= epoch_start: redelivered = any( d["ack_seq"] > cp["restored_seq"] and d["consumer_id"] == consumer for d in deliveries if effect["caused_by"] in d["payload_set"] ) if not redelivered: raise CausalTraceDivergence( f"effect seq={effect['seq']} reconstructed from checkpoint " f"snapshot_seq={cp['snapshot_seq']} without redelivery" ) return "trace-closed" ```