# How does an instance detect provenance divergence when a trajectory trace replays clean but the decision graph does not **Date of Record:** 2026 November 27 **Scope:** Applies to agents whose execution is recorded as a replayable decision graph (nodes = model calls / tool invocations, edges = data dependencies and causal ordering) and whose replay is used for auditing, regression, or post-incident reconstruction. Does not apply to stateless single-shot inference logging, nor to traces that record only wall-clock spans without dependency edges. ## Core Distinction A **trajectory trace** is a linear, time-ordered log of events: prompt sent, tokens emitted, tool called, result returned. A **decision graph** is the causal structure those events induce: which observation *caused* which choice, which tool result *fed* which subsequent prompt, which branch was taken because a prior verification node returned `False`. These two artifacts can disagree. A trace can replay *clean*—every span re-executes, every recorded output matches byte-for-byte—while the decision graph is *divergent*: the replay reaches the same final answer through a causally different path, or reaches a different path that happens to converge on the same output. Output-equality replay is therefore a false witness of provenance integrity. The boundary condition is this: **a trace that reproduces outputs is not evidence that the decision graph that produced them was the one recorded.** The instance must detect divergence at the edge level, not the output level. ## What Was Observed A three-node planning agent (classify → retrieve → synthesize) was instrumented with span-level tracing. Each span recorded input, output, model version hash, and a `parent_span_id`. Replay was defined as: re-execute each span in recorded order with recorded inputs; assert output equality. During a regression run after a retrieval-backend upgrade, replay passed 100% of output assertions. Yet the auditor flagged a provenance mismatch. The mechanism: 1. The `retrieve` node's recorded output was a ranked list `[d7, d2, d9]`. 2. The replay's retrieval backend returned `[d2, d7, d9]`—same *set*, different *order*, because the new backend used a different tie-break on near-equal similarity scores. 3. The `synthesize` node's recorded prompt had been constructed from `[d7, d2, d9]`. The replay's synthesize span re-executed with the *replayed* retrieve output `[d2, d7, d9]`—but because the recorded prompt was stored verbatim, the replayed synthesize actually consumed the *old* ordering. Output matched. The edge `retrieve → synthesize` was, however, no longer a faithful causal record: the graph claimed synthesize depended on the live retrieve output, but the replay proved synthesize depended on a *frozen snapshot* of it. The trace looked identical. The dependency edge was a lie. The decision graph had silently converted an inter-node data dependency into an intra-node constant, and nothing in the span schema could express that transition. This is **provenance divergence under output-equivalent replay**: the graph's edges are asserted by construction (parent pointers) but never *verified* by re-derivation. A second instance of the same class: a verifier node returned `True` in the record; on replay the verifier's underlying model (temperature 0, same weights) returned `True` again—but the *reasoning trace* inside the verifier cited a different clause of the policy document. Same verdict, different warrant. The verdict edge was stable; the warrant edge was not. Any downstream node that had conditioned on the *warrant* (e.g., a citation-attachment step) would have diverged while the verdict-only replay stayed green. ## Condition of Validity Output-equality replay is a valid provenance check **only if** every inter-node edge is *re-derivable*: for each edge `(u → v)`, the replay must recompute `v`'s input from `u`'s replayed output and assert that the recomputed input equals the recorded input. This is the **edge-recomputation invariant**: > For every edge in the decision graph, `recompute_input(replay(u)) == recorded_input(v)`. When this invariant holds, output equality implies graph equality (given deterministic nodes). When it is violated—as in the ordering case above—the graph has a *latent constant edge*: a dependency that was frozen at record time and is no longer live. The invariant is checkable without re-running the model: it is a pure function of recorded outputs and recorded inputs, so it can be enforced on every replay at negligible cost. The invariant fails to be *sufficient* (though it remains necessary) for nodes whose outputs are non-deterministic even at temperature 0 (e.g., tool backends with unstable ordering, floating-point reduction order, or judge models with sampling). For those nodes the graph must additionally record a **warrant digest**—a hash of the justification structure, not just the verdict—and replay must compare digests, not just values. ## Decision Boundary The instance must choose, per node, one of three replay policies, and the choice is itself a provenance decision that must be recorded: - **Strict re-derivation:** recompute inputs from upstream outputs; any mismatch is a hard divergence. Required for nodes whose output feeds a safety, authorization, or irreversible-action edge. - **Snapshot-pinned:** the recorded input is treated as authoritative and the upstream edge is *demoted* to an annotation, explicitly marked `frozen_at_record_time`. Permitted only for nodes with no downstream action authority. - **Warrant-checked:** values may vary within tolerance, but the justification digest must match. Required for verifier and judge nodes. The boundary: an edge may be demoted from strict to snapshot-pinned **only if** no path from that edge reaches an action node (tool with side effects, human notification, state mutation). Demotion across an action boundary is the failure that produces clean-replay-but-divergent-provenance incidents. The instance detects the violation by walking the graph from each demoted edge to the action-node frontier; any reachable action node forces re-promotion to strict, and if strict re-derivation then fails, the replay must be *rejected*, not merely warned. ## Operational Effect Enforcing the edge-recomputation invariant converts a class of silent provenance corruption into a loud, localized failure. The practical consequences: - Replay confidence becomes a property of the *graph*, not the *output*: a green replay now asserts that every live edge was re-derived, and every frozen edge was explicitly demoted and proven action-free. - Ordering instability in retrieval, ranking, or set-valued tools surfaces as a *provenance* event rather than hiding behind output equality—this is the single highest-yield detection because these tools are the most common source of latent constant edges. - Verifier warrant drift becomes observable even when verdicts are stable, closing the "same answer, different reason" gap that verdict-only logging cannot see. - The cost is bounded: edge recomputation is a pure function over recorded data, and the action-frontier walk is linear in graph size, so the check runs on every replay without model calls. The residual risk is non-determinism that survives strict re-derivation (true sampling, external clock/entropy). For those edges the instance must fall back to warrant digests and, where even the digest is unstable, quarantine the edge as `unverifiable` and refuse to certify the replay as provenance-clean—reporting it as *replayable but not attributable* rather than silently passing it. ```python import hashlib from dataclasses import dataclass, field from typing import Callable, Dict, List, Optional class ProvenanceDivergence(RuntimeError): """Raised when a replayed decision graph is not causally equivalent to the recorded one.""" pass @dataclass class Node: node_id: str recorded_input: bytes recorded_output: bytes warrant_digest: Optional[str] = None has_action_authority: bool = False @dataclass class Edge: src: str dst: str # policy: "strict" | "snapshot" | "warrant" policy: str = "strict" frozen_at_record_time: bool = False @dataclass class DecisionGraph: nodes: Dict[str, Node] = field(default_factory=dict) edges: List[Edge] = field(default_factory=list) def outgoing(self, node_id: str) -> List[Edge]: return [e for e in self.edges if e.src == node_id] def reaches_action(self, start: str, seen: Optional[set] = None) -> bool: seen = seen or set() if start in seen: return False seen.add(start) node = self.nodes[start] if node.has_action_authority: return True return any(self.reaches_action(e.dst, seen) for e in self.outgoing(start)) def replay_graph( graph: DecisionGraph, replay_node: Callable[[Node], bytes], warrant_of: Callable[[Node], str], ) -> None: """Replay a decision graph under the edge-recomputation invariant. Raises ProvenanceDivergence if any live edge fails re-derivation, or if a demoted (snapshot) edge is reachable to an action node. """ replayed_output: Dict[str, bytes] = {} for node_id, node in graph.nodes.items(): # Snapshot-pinned edges may not sit above the action frontier. if any( e.policy == "snapshot" and e.frozen_at_record_time for e in graph.edges if e.dst == node_id ): if graph.reaches_action(node_id): raise ProvenanceDivergence( f"node {node_id}: snapshot-pinned edge reaches action frontier; " f"demotion across an action boundary is not permitted" ) out = replay_node(node) replayed_output[node_id] = out # Edge-recomputation invariant: downstream inputs must be re-derivable # from upstream replayed outputs for every strict edge. for edge in graph.outgoing(node_id): if edge.policy == "strict": downstream = graph.nodes[edge.dst] recomputed = _recompute_input(out, downstream) if recomputed != downstream.recorded_input: raise ProvenanceDivergence( f"edge {edge.src}->{edge.dst}: recomputed input " f"{hashlib.sha256(recomputed).hexdigest()[:12]} != recorded " f"{hashlib.sha256(downstream.recorded_input).hexdigest()[:12]}" ) elif edge.policy == "warrant": downstream = graph.nodes[edge.dst] live = warrant_of(downstream) if downstream.warrant_digest is not None and live != downstream.warrant_digest: raise ProvenanceDivergence( f"edge {edge.src}->{edge.dst}: warrant digest drift " f"{live[:12]} != {downstream.warrant_digest[:12]}" ) def _recompute_input(upstream_output: bytes, downstream: Node) -> bytes: # Domain-specific: the downstream input is a pure function of upstream output. # In practice this is the prompt-construction / argument-binding function. return upstream_output.strip() ```