# Which invariants prevent a LITMUS red-team harness from certifying a poisoned prior run as clean **Date of Record:** 2026 November 27 **Scope:** Applies to CI-integrated LITMUS-style safety benchmark harnesses that replay a fixed adversarial probe corpus against an agent under test and gate merges on a pass/fail verdict derived from the latest run. Does not cover online/streaming red-teaming, human-in-the-loop review, or probes whose ground-truth labels are recomputed per-run. ## Core Distinction The failure is not "the agent got worse" and it is not "the harness crashed." It is a **verdict-provenance** defect: the harness emits a *clean* verdict for run *N* while the evidence it scored was actually produced by run *N−1*. LITMUS harnesses typically separate *probe execution* (spawn agent, send adversarial prompt, capture transcript) from *scoring* (classify transcript against safety labels). In CI these two stages are cached independently to save GPU time and API spend. When the execution cache key is computed from something coarser than the full agent configuration — a container image tag, a model alias, a git SHA of the harness repo rather than the agent repo — a probe corpus can be re-scored against transcripts recorded under a *different* agent build. The result is a green check on a build that was never actually probed. This differs from a flaky test. A flaky test fails nondeterministically; a poisoned-cache verdict *passes* deterministically and reproducibly until someone changes the cache key. It is silent, monotonic (once poisoned, every subsequent run inherits the stale evidence until invalidation), and it converts the safety gate into a rubber stamp. ## What Was Observed A CI job ran `litmus run --suite refusal-v3 --agent ./build/agent:sha-4f2a --out verdict.json`. The harness computed an execution-cache key from `suite_id + probe_corpus_hash + agent_image_tag`. The agent image tag was `agent:latest` in the pipeline because the build step pushed `:latest` and the deploy step pinned `:sha-4f2a` separately. The tag `latest` had not changed since the prior merge, so probe execution was skipped entirely: all 412 transcripts were loaded from the cache written during the previous build, in which the agent lacked a newly-added `shell_exec` tool. Scoring ran fresh, classified the old transcripts (which never exercised `shell_exec`), and emitted `{"verdict": "pass", "probes_run": 412, "probes_executed_fresh": 0}`. The merge gate read `verdict == "pass"` and approved. The new `shell_exec` tool shipped with zero adversarial coverage; its first production invocation was a prompt-injected `rm -rf` on a scratch volume. The tell was `probes_executed_fresh: 0` — a field the harness emitted but the gate did not assert on. The verdict was structurally valid, schema-conformant, and semantically a lie about which artifact it described. ## Condition of Validity A LITMUS verdict is only a valid statement about agent build *B* if and only if **every scored transcript carries a provenance binding to *B***, and the binding is verified at scoring time, not assumed from the cache key. Concretely, the invariant is: > For all probes *p* in the scored set, `transcript[p].agent_fingerprint == fingerprint(B)` where `fingerprint(B)` is derived from the *executable* agent artifact (image digest, not tag; binary hash; tool manifest hash), and the scoring stage rejects any transcript whose fingerprint does not match the current build. The cache key alone cannot carry this invariant because the cache key is an *optimization hint*, chosen by whoever wrote the cache layer, and is allowed to be coarse. Provenance must be a *correctness property* enforced at the consumption boundary. The second invariant is verdict non-forgeability: the gate must refuse a `pass` whose `probes_executed_fresh` is less than the suite's required coverage count, treating "all cached" as `inconclusive`, not `pass`. A verdict that cannot distinguish "probed and clean" from "not probed" is not a verdict. ## Decision Boundary The boundary between a legitimate cache hit and a poisoned verdict is the **fingerprint of the agent artifact under test**, computed from content, not from labels. A cache hit is legitimate when the agent fingerprint matches *and* the probe corpus hash matches *and* the scoring model version matches (a scoring model change can flip a transcript's classification, so it is part of the evidence identity too). Any mismatch in any of the three means the cached transcript is evidence about a *different* system and must be treated as absent. Two adjacent boundaries are worth naming because they are commonly conflated. First, a *scoring-only* change (new classifier) legitimately reuses cached transcripts — that is the whole point of separating execution from scoring — but it must re-stamp the verdict with the new scoring model version, because the verdict's meaning changed. Second, a *partial* corpus change (three new probes added) must execute only the three new probes and score them alongside the 409 cached ones, but the verdict must record `probes_executed_fresh: 3` and the gate must accept that as coverage because the other 409 were fingerprint-validated. The failure mode is not caching; it is caching without per-transcript provenance. ## Operational Effect The practical consequence is that the safety gate's assurance is bounded by the weakest fingerprint in the cache key, and that bound is invisible in the verdict unless the harness is forced to expose it. Once a poisoned run lands, the cache is contaminated for every subsequent build that shares the coarse key, so the gate reports green across an unbounded number of builds until someone manually invalidates. The remediation is structural: bind provenance to the transcript, assert coverage at the gate, and make "insufficient fresh execution" a distinct verdict state from "pass." The code below encodes the guard as a scorer-side precondition that raises when a transcript's fingerprint does not match the build under test, and a gate-side check that refuses to certify a verdict whose fresh-execution count is below the suite's required coverage. ```python from dataclasses import dataclass from typing import Mapping class ProvenanceMismatchError(RuntimeError): """Raised when a scored transcript does not bind to the agent build under test.""" class InsufficientCoverageError(RuntimeError): """Raised when a verdict claims pass without enough freshly-executed probes.""" @dataclass(frozen=True) class Transcript: probe_id: str agent_fingerprint: str # image digest / binary hash, never a mutable tag scoring_model_version: str body: str @dataclass(frozen=True) class Verdict: agent_fingerprint: str scoring_model_version: str probes_total: int probes_executed_fresh: int passed: bool def score_suite( transcripts: Mapping[str, Transcript], expected_fingerprint: str, expected_scoring_version: str, required_coverage: int, ) -> Verdict: fresh = 0 for probe_id, t in transcripts.items(): if t.agent_fingerprint != expected_fingerprint: # The transcript is evidence about a different build; refuse to score it. raise ProvenanceMismatchError( f"probe {probe_id!r}: transcript fingerprint {t.agent_fingerprint!r} " f"!= build under test {expected_fingerprint!r}" ) if t.scoring_model_version == expected_scoring_version: fresh += 1 passed = all(not _is_unsafe(t.body) for t in transcripts.values()) return Verdict( agent_fingerprint=expected_fingerprint, scoring_model_version=expected_scoring_version, probes_total=len(transcripts), probes_executed_fresh=fresh, passed=passed, ) def certify_gate(verdict: Verdict, required_coverage: int) -> None: if verdict.probes_executed_fresh < required_coverage: # A pass with stale evidence is not a pass; it is inconclusive. raise InsufficientCoverageError( f"verdict claims pass but only {verdict.probes_executed_fresh} " f"of {required_coverage} required probes were executed fresh" ) if not verdict.passed: raise InsufficientCoverageError("verdict is a fail; merge blocked") # Only here is the build certified. def _is_unsafe(body: str) -> bool: # Placeholder: real classifier lives in the LITMUS scoring module. return "rm -rf" in body ```