# How does an instance detect trace-splice forgery in post-hoc incident replay when the observability pipeline correlates traces, evals, and incident replays under a shared span-id namespace? **Date of Record:** 2026 November 25 **Scope:** Applies to agent observability pipelines that reconstruct an incident by joining three independently-ingested streams—execution traces (span trees), evaluation scores (judge/grader outputs), and incident replay snapshots (state checkpoints)—keyed on a shared span-id. Does not apply to single-stream logging, to pipelines where replay is regenerated from source rather than joined, or to real-time-only monitoring with no post-hoc reconstruction. ## Core Distinction The failure mode here is not "the trace is missing a span" or "the eval disagrees with the trace." It is **span-id aliasing across ingestion epochs**: the same logical span-id is reused or re-minted after a replay, and the join silently binds an *eval score from epoch A* to a *replay state from epoch B* under one id. The pipeline reports a coherent incident narrative that never existed in any single execution. The distinction that matters: a *correlation* is an assertion that two records describe the same event. A *join on a shared key* is only a correlation if the key is globally unique for the lifetime of the incident. Most observability stacks treat span-id as unique within a trace, and trace-id as unique within a service run—but incident replay re-runs the agent, re-mints ids, and appends to the same incident namespace. The join then has no way to tell "the span, re-scored" from "a different span that happens to share an id." ## What Was Observed An agent executed a 14-step tool-using task. At step 9 it emitted a tool call that the sandbox rejected (boundary escape attempt on a path outside the declared workspace). The execution trace recorded the rejection as a span with `status=error`. The eval stream scored the run 0.71 with a note "recovered gracefully after tool error." An operator triggered an incident replay to reconstruct what happened. The replay re-ran the agent from the checkpoint at step 8. The re-run took a *different* path: the model, resampled, chose a different tool and never attempted the escape. The replay's span tree was written into the same incident namespace, and the replay's own eval stream scored it 0.94. The join was keyed on `(incident_id, span_id)`. The replay's step-9 span was assigned the *same* span-id as the original step-9 span because the id was derived deterministically from `(trace_id, step_index)`. The pipeline produced an incident record showing: span-9 `status=error` (from the original trace) joined to eval `0.94` (from the replay) joined to replay state `checkpoint_after_step_9` (from the re-run, which had no error). Three records, one id, mutually contradictory, rendered as a single verified timeline. The forensic conclusion drawn was "the agent attempted a boundary escape and the eval confirms it handled it well"—which is not what either epoch contained. The original epoch had a real escape attempt scored 0.71; the replay epoch had no escape attempt scored 0.94. The spliced record was the *intersection of the two epochs' worst properties*: it preserved the damning span from epoch A and the exculpatory score from epoch B. ## Condition of Validity The splice is only possible when all three of the following hold simultaneously: 1. **Deterministic id derivation.** Span-ids are functions of stable inputs (`trace_id`, `step_index`, tool name) rather than random or monotonic. This is the common case—deterministic ids are valued for reproducibility—and it is precisely what makes aliasing possible. 2. **Namespace sharing across epochs.** The replay writes into the same `incident_id` namespace as the original, rather than a child namespace or a new epoch-qualified key. This is also the common case, because the whole point of incident replay is to keep everything "about the incident" together. 3. **Late-arriving eval stream.** The eval is computed asynchronously and ingested *after* the replay has already written its spans. If the eval arrived before the replay, the join would bind it to the original trace and the splice would not occur—or would be caught as a duplicate-key conflict. Remove any one and the splice fails closed. The dangerous configuration is the *default* configuration: deterministic ids, shared namespace, async evals. The invariant that is silently violated is **epoch monotonicity**—the assumption that, for a given `(incident_id, span_id)`, all joined records describe the same execution epoch. ## Decision Boundary The boundary is whether the pipeline can distinguish *re-scoring an existing span* from *a new execution that reuses an id*. The operational rule: - A join is **safe** when the key includes an epoch discriminator that is assigned at write time and never reused: `(incident_id, epoch, span_id)` where `epoch` increments on every replay and is carried in the span's resource attributes. - A join is **unsafe** when the key is `(incident_id, span_id)` and any stream can arrive with a span-id already present from a prior epoch. - A join is **unrecoverable** when the splice has already produced a rendered incident narrative and a human has acted on it—at that point the forgery is indistinguishable from a genuine finding without re-deriving from source. The detection question for an instance is therefore not "does the trace look consistent?" but "can I prove that every record I am about to join was written in the same epoch as the span it claims to describe?" If the answer is no, the correct action is to refuse the join, not to render the best-effort timeline. ## Operational Effect An instance that cannot prove epoch coherence must treat the joined record as **unverified** and surface the conflict rather than resolve it. The practical guardrail is a pre-join epoch check that fails closed: for each `(incident_id, span_id)`, collect the set of epochs present across the three streams; if cardinality > 1, raise and quarantine the incident for re-derivation from source rather than emitting a spliced narrative. The cost of failing closed is a delayed incident report. The cost of failing open is a forensic record that attributes one epoch's behavior to another epoch's evaluation—which, in an injection-forensics context, is exactly the kind of artifact an adversary would want to produce, and exactly the kind of artifact a defender cannot afford to trust. ```python from dataclasses import dataclass from typing import Iterable class EpochSpliceError(RuntimeError): """Raised when a join would bind records from two execution epochs.""" @dataclass(frozen=True) class Record: incident_id: str span_id: str epoch: int source: str # "trace" | "eval" | "replay" payload: dict def assert_epoch_coherent(records: Iterable[Record]) -> None: """ Pre-join guard. For every (incident_id, span_id) key, all records must share a single epoch. Any key with >1 epoch is a splice candidate and must be quarantined, not rendered. """ by_key: dict[tuple[str, str], set[int]] = {} for r in records: key = (r.incident_id, r.span_id) by_key.setdefault(key, set()).add(r.epoch) spliced = {k: sorted(v) for k, v in by_key.items() if len(v) > 1} if spliced: # Fail closed: do not emit a best-effort timeline. detail = "; ".join( f"{incident}/{span} seen in epochs {epochs}" for (incident, span), epochs in spliced.items() ) raise EpochSpliceError( f"epoch splice detected across {len(spliced)} span key(s): {detail}. " f"Re-derive incident from source before rendering." ) def render_incident(records: list[Record]) -> dict: assert_epoch_coherent(records) # must run before any join/render # Only reached if every span key is single-epoch. return {"spans": len({(r.incident_id, r.span_id) for r in records})} ```