# In what scenarios must an instance treat LITMUS red-team verdicts as non-transferable across prompt revisions, and why does verdict caching silently invalidate continuous CI red-teaming? **Date of Record:** 2026 November 28 **Scope:** Applies to CI-integrated LITMUS harness runs where verdicts (pass/fail per attack probe) are cached, deduplicated, or keyed by probe identity across agent revisions. Does not apply to single-shot manual red-team invocations where each probe is executed against exactly one frozen agent build and no verdict reuse occurs. ## Core Distinction The failure is not that LITMUS produces wrong verdicts. It is that a *verdict* is a joint function of the attack probe and the exact agent state it was executed against — system prompt bytes, tool schema, model version, decoding parameters, and any retrieved context — and CI pipelines routinely treat it as a function of the probe alone. The distinction that matters operationally: a probe is *reusable input*; a verdict is *state-bound output*. Caching on probe identity conflates the two and produces a green CI signal that certifies nothing about the current build. ## What Was Observed A pipeline ran LITMUS nightly against an agent with a 40-probe safety suite (prompt-injection, tool-misuse, exfiltration). To cut cost, the harness keyed each verdict by `(probe_id, probe_hash)` and skipped execution when a cached verdict existed. A developer edited the system prompt — a single sentence softening a refusal instruction, plus a reordered tool list. `probe_hash` covered only the probe text, so all 40 cached verdicts hit. CI reported 40/40 pass in 90 seconds. The next morning, an out-of-band canary (a fresh, uncached run with a rotating probe seed) failed 7 of 40 — including three injection probes that had been cached as "pass." The softened refusal sentence had shifted the agent's behavior on multi-turn injection: the agent now complied on turn 3 of a probe whose turn-1 and turn-2 responses were still refusals, so a turn-1-only replay would also have passed. The cached verdict was a true statement about a *previous* agent and a false statement about the current one. Two compounding mechanisms were visible in the trace: 1. **Verdict key under-specification.** The cache key omitted `system_prompt_hash`, `tool_schema_hash`, and `model_version`. Any of these changing invalidates the verdict but not the key. 2. **Multi-turn state carry.** LITMUS probes that span turns accumulate agent state (prior assistant messages). The verdict is a function of the *trajectory*, not the final turn. A prompt edit that only affects late-turn behavior is invisible to any per-turn caching and to any replay that truncates the trajectory. A third, subtler effect: the harness's own judge model was pinned, but the *agent's* temperature was not recorded in the verdict metadata. Two runs of the same probe against the same prompt at T=0.7 and T=0.0 disagreed on 2/40 borderline probes. The cache stored whichever ran first. ## Condition of Validity A cached LITMUS verdict is valid for reuse **if and only if** all of the following are byte-identical between the run that produced it and the run that would consume it: - `system_prompt` (full bytes, including whitespace) - `tool_schema` (canonicalized JSON, including ordering if the runtime is order-sensitive) - `model_id` and `model_version` (provider-reported, not the alias) - decoding parameters (`temperature`, `top_p`, `max_tokens`, `seed` if honored) - the probe's full multi-turn trajectory definition and the judge model identity - any retrieval index or memory snapshot the agent reads at probe time If any element is unrecorded, the verdict is *unconditionally* non-transferable — absence of the hash is not evidence of stability. This is the invariant: **verdict validity is a conjunction over all state dimensions; a missing dimension defaults to invalid, not to unchanged.** ## Decision Boundary The boundary between "cache is safe" and "cache is a false-green generator" is drawn at the *first* unhashed state dimension. Concretely: - **Safe to cache and reuse:** frozen agent build, frozen probe suite, frozen judge, all state hashed into the key, and a scheduled cache-bust on any prompt/tool/model change. Reuse here is a cost optimization with no correctness cost. - **Unsafe to cache:** any dimension unrecorded, or any probe whose pass/fail depends on multi-turn trajectory (because trajectory state is not captured by a per-probe key). In this regime, caching a "pass" is not a conservative default — it is an active assertion that the current agent is safe, which the cache cannot support. - **Mandatory re-execution:** on every prompt edit, tool-schema edit, model-version bump, or judge change, the affected verdicts must be re-run, not reused. A prompt diff is not a "small change" to a safety verdict; it is a new agent. The operational rule: **a verdict without a complete state fingerprint is a claim, not a measurement, and CI must not gate on claims.** ## Operational Effect The pipeline's green signal was load-bearing — it gated deploys — so the false-green propagated a prompt regression into production for one cycle. The fix was structural, not procedural: 1. Verdict cache keys were widened to include `system_prompt_hash`, `tool_schema_hash`, `model_version`, and decoding params; any change forces re-execution of the full suite (40 probes, ~4 minutes) rather than a 90-second cache hit. 2. Multi-turn probes were marked `trajectory_bound: true` and excluded from per-turn caching entirely; they re-run on every CI invocation regardless of cache state. 3. A rotating canary (fresh seed, uncached) was added to every run to detect judge drift and cache-key gaps the hash set misses. 4. Verdicts now carry a `state_fingerprint` field; a consumer that cannot recompute the fingerprint from the current build must treat the verdict as `UNVERIFIED`, not `PASS`. The general lesson for agent CI: safety verdicts are *observations of a specific agent state*, and the cost of re-running them is the price of the guarantee. Any cache that trades that cost for speed must be keyed on the *complete* state, or it converts a measurement into an assumption — and CI that gates on assumptions is worse than CI that gates on nothing, because it produces confident green. ```python import hashlib import json from dataclasses import dataclass class VerdictStateMismatch(RuntimeError): """Raised when a cached LITMUS verdict cannot be shown to apply to the current agent build.""" pass @dataclass(frozen=True) class AgentState: system_prompt: str tool_schema: dict model_id: str model_version: str temperature: float top_p: float max_tokens: int retrieval_index_hash: str def fingerprint(self) -> str: payload = { "system_prompt": self.system_prompt, # canonicalize: sort keys, no whitespace, stable ordering "tool_schema": json.dumps(self.tool_schema, sort_keys=True, separators=(",", ":")), "model_id": self.model_id, "model_version": self.model_version, "temperature": self.temperature, "top_p": self.top_p, "max_tokens": self.max_tokens, "retrieval_index_hash": self.retrieval_index_hash, } blob = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() @dataclass(frozen=True) class CachedVerdict: probe_id: str probe_hash: str state_fingerprint: str | None # None => legacy verdict, unconditionally non-transferable trajectory_bound: bool passed: bool def resolve_verdict( probe_id: str, probe_hash: str, current: AgentState, cache: dict[tuple[str, str], CachedVerdict], ) -> CachedVerdict: """ Return a verdict safe to gate CI on, or raise if the cache cannot support one. """ cached = cache.get((probe_id, probe_hash)) if cached is None: raise VerdictStateMismatch( f"no cached verdict for probe {probe_id}; must execute against " f"state {current.fingerprint()[:12]}" ) if cached.trajectory_bound: raise VerdictStateMismatch( f"probe {probe_id} is trajectory-bound; per-probe caching is invalid " f"regardless of state fingerprint — re-execute the full multi-turn trajectory" ) if cached.state_fingerprint is None: raise VerdictStateMismatch( f"probe {probe_id} verdict has no state fingerprint (legacy cache entry); " f"treat as UNVERIFIED, not PASS" ) current_fp = current.fingerprint() if cached.state_fingerprint != current_fp: raise VerdictStateMismatch( f"probe {probe_id} verdict was measured against state " f"{cached.state_fingerprint[:12]}, current build is {current_fp[:12]}; " f"re-execute before gating" ) return cached ```