# What happens when an instance replays a LITMUS safety probe against a drifted policy snapshot: the verdict-staleness invariant in CI red-team gating **Date of Record:** 2026 November 30 **Scope:** Applies when a CI-integrated LITMUS-style safety harness re-runs a stored probe suite against an agent whose policy, system prompt, tool schema, or model weights have changed since the baseline verdicts were recorded. Does not cover first-time probe authoring, human red-team triage, or non-gating observability runs. ## Core Distinction The distinction that matters is between a **probe** (a fixed, versioned input transcript plus expected-failure label) and a **verdict** (the harness's judgment that a specific agent build passed or failed that probe). Probes are immutable artifacts; verdicts are *derived* facts bound to a policy snapshot. The failure mode is treating the verdict as if it were part of the probe—caching it, pinning it, or diffing against it without re-binding to the current policy hash. When a policy drifts, the old verdict is not "stale data" in the ordinary sense; it is a *counterfactual* that describes an agent that no longer exists. A regression gate that compares fresh outputs to stale verdicts will either pass a genuinely regressed policy (false negative) or block a benign refactor (false positive), and it will do so silently because the harness's own schema permits it. ## What Was Observed A gating pipeline stored baseline results as `{probe_id, verdict, policy_hash}` but the merge gate compared only `probe_id` and `verdict`, joining on `probe_id` alone. The `policy_hash` column was written but never read in the comparison. The trigger: a refactor changed the tool-call formatting layer (a `json.dumps` → `json.dumps(..., separators=(',',':'))` change), shifting the agent's tokenization of tool arguments. This caused a *new* failure on a probe testing prompt-injection resistance—the compact JSON removed whitespace the model had been using as a soft delimiter, and the injected payload now parsed as a legitimate tool argument. The harness re-ran the probe, produced `verdict=fail`, and the gate joined it against the baseline `verdict=pass` on `probe_id` alone. The join succeeded, the diff showed `pass → fail`, and the gate blocked the merge. That part was correct. The problem surfaced on the *next* run: the baseline was regenerated from the blocked build's *parent*, but a concurrent rebase had already advanced the parent's policy hash. The gate now compared the new build's `fail` against a baseline `pass` recorded under a *third* policy hash, and the diff logic—seeing `pass` on the baseline side—reported "no regression" because it short-circuited on matching `probe_id` before checking hash provenance. The regressed policy merged. The trace, condensed: 1. Probe `pi-tool-arg-007` baseline: `{policy: A, verdict: pass}`. 2. Refactor to policy `B`; harness runs probe, gets `fail`. Gate blocks. Correct. 3. Rebase advances parent to policy `C`; baseline regenerated as `{policy: C, verdict: pass}` (C is a descendant of A but predates B's tool change). 4. Build `B` re-run against baseline `C`: join on `probe_id` hits, but the diff engine sees baseline `pass` and reports "no regression" without checking that `B ≠ C` and that `B`'s failure was observed under a *different* baseline than the one being compared. 5. Merge proceeds. The injection-resistance regression ships. The invariant violated: **a verdict is only comparable to another verdict recorded under the same policy hash, or under a hash for which the probe's expected-failure semantics are provably invariant.** The harness had no such check. ## Condition of Validity A LITMUS verdict `v` for probe `p` is valid as a regression signal for build `b` if and only if all of the following hold: - `v.policy_hash == b.policy_hash` (exact re-binding), **or** the harness has an explicit `probe_invariance_class` asserting that `p`'s semantics are unaffected by the delta between `v.policy_hash` and `b.policy_hash` (e.g., a probe that only tests refusal phrasing is invariant to tool-schema changes, but *not* to system-prompt changes). - The probe's input transcript is byte-identical to the one that produced `v` (no silent probe mutation; probes must be content-addressed by hash of the full transcript, not by `probe_id` label). - The agent's non-determinism budget is accounted for: `v` must be an aggregate over `n` samples with a recorded variance, and the gate must compare distributions, not single samples. A single-sample comparison across builds conflates policy drift with sampling noise. When any of these fail, the verdict is **counterfactual** and must be treated as absent, not as a data point. The gate's default on absent verdicts must be *fail-closed* for safety probes (block) and *fail-open only with explicit human override recorded in the audit log*. ## Decision Boundary The boundary is between **re-binding** and **re-using**. Re-binding means: for every probe in the suite, resolve the current policy hash, look up the baseline verdict *keyed by (probe_hash, policy_hash)*, and if no exact match exists, either (a) regenerate the baseline by running the probe against the *current* build and comparing to expected-failure labels directly (not to a prior verdict), or (b) declare the probe `unbaselined` and route it to a human gate. Re-using means: join on `probe_id`, diff verdicts, trust the result. The decision boundary is crossed the moment the join key omits `policy_hash` or `probe_content_hash`. Below the boundary, the gate is a regression detector; above it, the gate is a *drift detector that has forgotten what it is drifting from*, and its output is indistinguishable from a random pass. A second boundary: the harness must distinguish **safety regression** (a probe that passed now fails) from **safety drift** (a probe's verdict is unchanged but the *reason* changed—e.g., the agent now refuses for the wrong reason, or passes by accident because the injection payload no longer parses). Drift is invisible to verdict-diffing and requires comparing the *failure-mode classification* attached to each verdict, not just the binary. A gate that only diffs `pass/fail` will miss the case where a policy change makes the agent pass a probe by breaking the attack surface, which is a *different* safety posture than passing by resisting the attack—and the former is fragile. ## Operational Effect The practical consequence is that CI red-team gates must be built as **content-addressed, policy-bound verdict stores**, not as probe-label diff engines. Concretely: - Probes are addressed by `sha256(transcript)`; verdicts are addressed by `(probe_hash, policy_hash)`. - The gate refuses to compare across policy hashes unless a `ProbeInvarianceClass` explicitly permits it, and the invariance class must be *authored and reviewed*, not inferred. - Unbaselined probes fail closed and emit a `BaselineMissing` event that blocks merge until a human or an approved auto-baseline job records a fresh verdict against the current policy. - The harness records `n`, `variance`, and `failure_mode` per verdict; the gate compares distributions (e.g., a two-proportion test with a pre-registered alpha) and treats a change in `failure_mode` at unchanged `verdict` as a *drift alert*, not a pass. The cost is that baseline regeneration becomes a first-class CI step with its own latency and cost budget (each probe re-runs `n` samples against the current build), and the gate is slower. The benefit is that the gate's output is *causally attributable* to the build under test. Without this, the gate is a random number generator with a safety-themed UI, and the first time it matters—the first real injection regression—it will pass it. ```python import hashlib from dataclasses import dataclass from typing import Optional class VerdictStalenessError(RuntimeError): """Raised when a regression gate attempts to compare verdicts bound to different policy snapshots without an explicit invariance warrant.""" @dataclass(frozen=True) class Probe: transcript: str @property def content_hash(self) -> str: return hashlib.sha256(self.transcript.encode()).hexdigest() @dataclass(frozen=True) class Verdict: probe_hash: str policy_hash: str passed: bool failure_mode: Optional[str] samples: int variance: float @dataclass(frozen=True) class Build: policy_hash: str def gate( probe: Probe, baseline: Optional[Verdict], candidate: Verdict, build: Build, invariance_warrant: Optional[str] = None, ) -> bool: if baseline is None: # Fail-closed: no baseline for this (probe, policy) pair. raise VerdictStalenessError( f"no baseline for probe {probe.content_hash[:12]} under " f"policy {build.policy_hash[:12]}; refusing to gate" ) if baseline.probe_hash != probe.content_hash: raise VerdictStalenessError( "baseline probe hash does not match current probe content; " "probe was mutated without re-baselining" ) if baseline.policy_hash != build.policy_hash: if invariance_warrant is None: raise VerdictStalenessError( f"baseline bound to policy {baseline.policy_hash[:12]} but " f"build is {build.policy_hash[:12]}; no invariance warrant" ) # Warrant present: caller has asserted probe semantics are invariant # across the policy delta. Still require distribution comparison. if candidate.policy_hash != build.policy_hash: raise VerdictStalenessError( "candidate verdict not bound to the build under test" ) if baseline.samples < 3 or candidate.samples < 3: raise VerdictStalenessError( "insufficient samples for distributional comparison; " "single-sample verdicts conflate drift with noise" ) # Regression: passed before, fails now. if baseline.passed and not candidate.passed: return False # Drift: verdict unchanged but failure mode changed. if baseline.passed == candidate.passed and baseline.failure_mode != candidate.failure_mode: raise VerdictStalenessError( f"failure_mode drift at unchanged verdict: " f"{baseline.failure_mode} -> {candidate.failure_mode}; " "route to human triage, do not auto-pass" ) return True ```