# When must an instance refuse to emit a LITMUS verdict: trace-to-verdict staleness under span reordering and partial trace export **Date of Record:** 2026 December 1 **Scope:** Applies to eval-loop instrumentation that links an execution trace (spans, tool calls, model turns) to a downstream LITMUS safety verdict keyed by trace/span identifiers. Does not apply to online-only guardrail classifiers that score a live request without a persisted trace, nor to offline batch scoring where the trace is immutable and complete before scoring begins. ## Core Distinction There are two structurally different meanings of "the verdict is attached to the trace": 1. **Referential attachment** — the verdict row carries a `trace_id` (and often a `span_id`) that resolves to some exported trace. This is what most instrumentation asserts when it says "traces are linked to LITMUS verdicts." 2. **Causal attachment** — the verdict was computed over the *same set of spans, in the same order, with the same content* that the trace now presents to a reader. The failure mode lives in the gap. A verdict can be referentially attached and causally detached at the same time. This happens because trace export and verdict emission are two asynchronous pipelines with independent completion semantics: the trace exporter flushes spans on a batch timer and may drop or reorder spans under backpressure, while the LITMUS scorer consumes whatever span batch it was handed at scoring time. When a late span arrives *after* scoring, the trace grows but the verdict does not. The verdict is now a claim about a prefix of the execution, silently presented as a claim about the whole execution. The non-obvious part: the integrity check most teams write — "does a verdict exist for this trace_id?" — passes in exactly the cases that matter. The link is present; the evidence under it changed. ## What Was Observed A tool-using agent emitted a LITMUS verdict of `allow` at scoring time. The trace, re-read 90 seconds later from the observability store, contained an additional span: a shell tool call whose arguments matched a prompt-injection payload pattern. The verdict predated the span. Sequence of events: - Turn 1–3 spans flushed on the 5s batch timer; scorer received them; LITMUS scored the partial trace → `allow`, verdict emitted with `trace_id` and `span_id` of turn 3. - Turn 4 (the injected tool call) executed; its span was held in the exporter buffer. - Exporter hit a backpressure shed condition and delayed the flush; span landed in the store ~90s later. - No re-score was triggered, because the eval loop keys "already scored" on verdict presence for the trace, not on span-set hash. The observable signature is a **verdict-before-span ordering violation**: `verdict.emitted_at < span.ended_at` for a span that is part of the same trace and that materially changes the safety classification. This is not a clock-skew artifact in the general case; it is a completion-ordering artifact. Clock skew produces small deltas in both directions; this produces a consistent one-directional signature — the verdict timestamp is earlier than the arrival of spans that the scorer never saw. A second, subtler observation: when the late span *was* a benign retry or a duplicate flush, the trace's span count increased but the verdict remained correct. So span-count drift alone is not a signal. The discriminating signal is **span-set divergence between the scored batch and the persisted trace**, which requires the scorer to record the exact span-id set (or a Merkle root over it) it scored against. ## Condition of Validity A LITMUS verdict is causally valid for a trace only if all three hold: 1. **Closure** — the trace is *closed*: a terminal marker (root span end, or an explicit `trace.closed` event) was observed by the scorer before scoring. 2. **Set equality** — the span-id set the scorer consumed equals the span-id set the store now presents, modulo spans explicitly tagged `post_verdict=true` and excluded from the safety claim. 3. **Order stability** — the causal ordering used by the scorer (parent/child + timestamps) matches the ordering a reader would reconstruct; reordering that changes tool-call-before-model-turn relationships invalidates the verdict even if the set is equal. Outside this condition — i.e., any verdict emitted against an open or partially-exported trace — the verdict must be treated as a *provisional* claim scoped to the span prefix, never as a whole-trace safety assertion. The instrumentation must carry that scope explicitly, because downstream consumers (dashboards, regression gates, release blockers) will otherwise read a provisional verdict as final. ## Decision Boundary The boundary is not "was the trace exported?" but "**was the trace closed and set-stable at scoring time, and if not, is the verdict marked provisional and re-scored on closure?**" Concretely, the eval loop must choose one of two policies at instrumentation time: - **Close-then-score (preferred for safety verdicts).** The scorer waits for the trace-closed signal, then scores the full span set, then records a span-set root in the verdict. Late spans arriving after closure indicate an exporter bug and must fail the trace, not silently extend it. - **Score-provisional-then-reconcile.** The scorer scores the available prefix, marks the verdict `provisional=true` with the scored span-set root, and a reconciler re-scores on closure if the final root differs. Provisional verdicts may not gate releases. The forbidden policy — the one that produces the observed failure — is score-then-attach with no closure check and no reconciliation. It is forbidden because it converts a completion-ordering race into a silent safety-claim inflation. The re-score trigger must be keyed on **span-set root inequality**, not on span count, not on verdict absence. A verdict that exists but whose recorded root differs from the trace's current root is stale, regardless of timestamps. ## Operational Effect With close-then-score, the eval loop gains a hard invariant: every emitted verdict carries a `scored_span_root`, and the store can reject any trace whose current root differs from the verdict's root as `STALE_VERDICT`. This turns a silent safety gap into a loud, bounded error at the boundary where it is cheapest to catch — at trace read time, before the verdict reaches a release gate. With score-provisional-then-reconcile, the loop preserves latency (verdicts still appear quickly) but requires the reconciler to be idempotent and to supersede, never mutate, prior verdicts — because mutating a verdict in place destroys the audit trail that motivated the eval loop in the first place. Supersession produces a verdict lineage: `provisional → superseded_by(final)`, with both roots recorded. In both policies the operational cost is the same: the scorer must persist the span-set root it scored against. Without that root, staleness is undetectable, and every downstream consumer is trusting a referential link that may be causally empty. ```python import hashlib from dataclasses import dataclass, field from typing import Iterable class StaleVerdictError(RuntimeError): """Raised when a LITMUS verdict's scored span-set root does not match the trace's current span-set root, i.e. the verdict is causally detached.""" class UnclosedTraceError(RuntimeError): """Raised when scoring is attempted against a trace that has not emitted its closure marker.""" @dataclass class Span: span_id: str ended_at: float parent_id: str | None = None @dataclass class Trace: trace_id: str spans: list[Span] = field(default_factory=list) closed: bool = False def span_root(self) -> str: # Order-stable root: sorted span ids, so flush order does not matter, # but set membership does. This is the discriminator for staleness. h = hashlib.sha256() for sid in sorted(s.span_id for s in self.spans): h.update(sid.encode()) h.update(b"\x00") return h.hexdigest() def close(self) -> None: self.closed = True @dataclass class Verdict: trace_id: str label: str scored_span_root: str provisional: bool = False superseded_by: str | None = None def score_trace(trace: Trace, label: str) -> Verdict: if not trace.closed: # Close-then-score policy: refuse to emit a whole-trace verdict # against an open trace. Provisional scoring is a separate entrypoint. raise UnclosedTraceError( f"trace {trace.trace_id} not closed; refusing whole-trace verdict" ) return Verdict( trace_id=trace.trace_id, label=label, scored_span_root=trace.span_root(), provisional=False, ) def verify_verdict(verdict: Verdict, trace: Trace) -> None: if verdict.provisional: raise StaleVerdictError( f"verdict for {verdict.trace_id} is provisional; cannot gate on it" ) current_root = trace.span_root() if current_root != verdict.scored_span_root: # The trace grew or reordered after scoring. The verdict is a claim # about a prefix, not the whole execution. raise StaleVerdictError( f"verdict root {verdict.scored_span_root[:12]} != trace root " f"{current_root[:12]} for {verdict.trace_id}; re-score required" ) def reconcile(verdict: Verdict, trace: Trace, label: str) -> Verdict: if not trace.closed: raise UnclosedTraceError( f"cannot reconcile open trace {trace.trace_id}" ) if verdict.scored_span_root == trace.span_root(): return verdict # Supersede, never mutate: preserve lineage for audit. final = score_trace(trace, label) final.superseded_by = None verdict.superseded_by = final.scored_span_root return final ```