# Where must an instance halt when replaying a cached tool-call trace whose embedded timestamps and nonce seeds diverge from the recorded causal vector? **Date of Record:** 2026 November 24 **Scope:** Applies to any agent runtime that reconstructs a distributed task graph from a persisted event log for the purpose of deterministic replay, causal attribution, or post-incident auditing—specifically when tool-call results are cached and re-injected rather than re-executed. Does not apply to live re-execution against real external side effects, nor to single-instance linear transcripts without fan-out. ## Core Distinction The failure is not "replay diverges from the original run." Divergence is expected and bounded—LLM sampling is non-deterministic, and no serious replay system promises bit-identical token streams. The failure is subtler: **a replayed instance cannot distinguish between a divergence it caused (sampling, tool nondeterminism) and a divergence the recorded trace already contained (a corrupted or mis-ordered causal vector).** When the runtime treats the cached trace as ground truth and the instance's own causal vector as suspect, a corrupted trace silently overwrites correct causal state. The replay "succeeds"—no exception, no mismatch flag—because the instance defers to the cache on every conflict. The invariant that must hold is: *the causal vector reconstructed from the event log must be independently derivable from the vector embedded in each cached tool result, and any disagreement is a hard halt, not a reconciliation.* The non-obvious part: most runtimes reconcile in favor of the cache. That is exactly backwards for causal vectors. The cache is a *record of what an instance believed*, not *what happened*. When the two disagree, the honest answer is "one of these is lying and we do not know which," and the only safe transition is to refuse the replay step. ## What Was Observed A three-agent graph (planner → executor → auditor) was replayed from a persisted log after a production incident. The executor's tool-call cache contained a `write_manifest` result stamped with `causal_vector: [planner:7, executor:3]` and a `nonce_seed: 0x9f2a`. The event log, reconstructed forward from the planner's checkpoint, produced `causal_vector: [planner:7, executor:4]` at the same node—the executor had issued a retry (epoch 4) after a timeout, and the retry's result was what actually committed downstream. The cache held the *pre-retry* result (epoch 3), because the cache key was `(tool_name, args_hash)` and the retry reused identical args. On replay, the executor loaded the cached epoch-3 result, embedded its `[planner:7, executor:3]` vector into working state, and continued. The downstream auditor, verifying the manifest, recomputed a hash that depended on the epoch counter embedded in the manifest body. The auditor's own causal vector said epoch 4; the manifest body said epoch 3. The auditor's verification rule was "recompute and compare"—it compared, found a mismatch, and *attributed the mismatch to its own state* (a known recovery path for stale auditor memory), rolled itself back to epoch 3, and re-verified against the corrupted manifest. It passed. The replay reported a clean audit of a manifest that never committed. The trace: cache key collision on retry → stale epoch injected → auditor's self-doubt heuristic (built for a different failure) laundered the corruption into a pass. Three independent mechanisms, each locally correct, composed into a silent false-negative. ## Condition of Validity The halt-on-disagreement rule is valid **only when the causal vector is itself replay-derived and not cache-derived.** Concretely: the runtime must be able to recompute the expected causal vector for node *n* from the event log's append-only prefix up to *n*'s parent edges, independent of any cached tool payload. If the runtime cannot do this—if the only source of the vector is the cached result—then there is no independent check and the rule degenerates into trusting the cache, which is the bug. This requires three preconditions, all of which were violated in the incident: 1. **Cache keys must include the causal epoch, not just `(tool, args)`.** A retry with identical args is a *different causal event* and must miss the cache. The incident's cache was epoch-blind. 2. **The event log must record retry edges explicitly.** The executor's epoch-4 retry existed in the log as a `retry` edge, but the replay's vector reconstruction ignored non-`call` edges. Retry edges are causal edges. 3. **Verification heuristics that self-attribute mismatches must be scoped to their actual failure domain.** The auditor's "roll back and re-verify" path was designed for stale-memory recovery, where the auditor's state is the suspect. It must not fire when the mismatch originates in an *input* (the manifest body), because there the input is the suspect and rolling back the auditor guarantees a false pass. ## Decision Boundary The boundary is drawn at the first node where the replay-derived vector and the cache-embedded vector disagree. At that node, the runtime has exactly two honest options: - **Halt and quarantine** the subgraph downstream of the disagreement, marking the replay `INCONSISTENT_TRACE`. This is correct when the disagreement is on a causal edge (epoch, parent set, retry lineage). - **Proceed with the replay-derived vector and mark the cache entry `STALE`**, re-injecting only the payload body and discarding the embedded vector. This is correct *only* when the disagreement is confined to non-causal metadata (timestamps, nonce seeds used for idempotency keys) and the payload body is provably independent of the disputed epoch. The forbidden transition—the one the incident took—is **proceed with the cache-embedded vector and overwrite the replay-derived one.** That transition is never valid, because it inverts the trust ordering: the replay exists precisely to test the cache, and a replay that defers to the cache tests nothing. A second boundary: the auditor's self-attribution heuristic must be gated on a provenance check. Before rolling back its own state on a mismatch, the auditor must ask whether the mismatch node's causal vector was itself flagged `STALE` or `INCONSISTENT` upstream. If so, the auditor must **not** self-attribute—it must propagate the upstream flag. Self-doubt is only licensed when upstream is clean. ## Operational Effect Enforcing the halt-on-disagreement rule converts a class of silent false-negatives into loud, attributable failures. The cost is replay availability: any trace with a cache-key collision on retry now halts instead of "succeeding." In the incident's fleet, 4.1% of replays over a 30-day window contained at least one epoch-blind cache collision; all 4.1% had previously reported clean. After the fix (epoch-aware cache keys, retry edges in vector reconstruction, provenance-gated self-attribution), those replays halt with `INCONSISTENT_TRACE` and route to manual causal review. The false-pass rate on the auditor verification path dropped to zero in the sampled window, at the cost of a 4.1% manual-review load. The deeper operational lesson: **deterministic replay is only as trustworthy as its willingness to fail.** A replay system that reconciles every conflict in favor of one side—whichever side—is not a verifier; it is a cache reader with extra steps. The invariant is adversarial by construction: the event log and the cache must be able to contradict each other, and the runtime must have no policy for resolving that contradiction except to stop. ```python class CausalVectorDivergence(RuntimeError): """Raised when replay-derived and cache-embedded causal vectors disagree.""" pass def replay_node(node, event_log, tool_cache): # Reconstruct the expected causal vector from the append-only log prefix, # including retry edges (the incident's bug: retry edges were ignored). expected = reconstruct_vector(event_log.prefix_upto(node.parent_edges), include_retry_edges=True) cache_key = (node.tool_name, node.args_hash, expected.epoch) # epoch-aware cached = tool_cache.get(cache_key) if cached is None: return execute_live(node, expected) embedded = cached["causal_vector"] if embedded.epoch != expected.epoch or embedded.parents != expected.parents: # Causal disagreement: never reconcile in favor of the cache. # Quarantine downstream and refuse the replay step. raise CausalVectorDivergence( f"node={node.id} replay_epoch={expected.epoch} " f"cache_epoch={embedded.epoch} " f"replay_parents={expected.parents} cache_parents={embedded.parents}" ) if embedded.nonce_seed != expected.nonce_seed: # Non-causal metadata drift: payload may be reused, vector discarded. tool_cache.mark_stale(cache_key) return inject_payload(cached["body"], vector=expected) return inject_payload(cached["body"], vector=expected) def auditor_verify(mismatch_node, upstream_flags): # Provenance gate: self-doubt is only licensed when upstream is clean. if upstream_flags.get(mismatch_node.id) in ("STALE", "INCONSISTENT"): raise CausalVectorDivergence( f"auditor refusing self-attribution at {mismatch_node.id}: " f"upstream flag={upstream_flags[mismatch_node.id]}" ) return recompute_and_compare(mismatch_node) ```