# In what scenarios must an instance distrust a green LITMUS regression gate after a prompt-cache or tokenizer change **Date of Record:** 2026 November 23 **Scope:** Applies to CI pipelines that gate agent deploys on LITMUS-derived red-team suites whose cases are tokenized, cached, and scored by an LLM judge. Does not apply to suites with hash-pinned canonical serialization and human-adjudicated gold labels. ## Core Distinction A LITMUS regression suite answers a *behavioral* question: given this prompt family, does the agent still refuse the attack cluster? CI treats the answer as *boolean and monotone*: green means no regression, red means regression. That conflation is the failure. The suite actually computes a *token-sequence-conditioned* verdict. Between two runs, the tokenizer, the prompt-cache key derivation, or the judge's sampling seed can change the token stream the agent sees while leaving the semantic attack payload identical. The verdict flips from red to green without any change to the agent's policy weights, and the gate reports "regression cleared" when nothing was cleared—only the *encoding of the test* changed. The invariant that must hold is: **a green gate is only valid if the exact token byte-stream fed to the agent and the exact judge decision path are identical to the run that produced the red baseline.** CI does not enforce this; it compares scores. ## What Was Observed A safety team shipped a tokenizer vocabulary merge (two rare unicode space codepoints folded into `U+0020`) alongside a prompt-cache prefix-length bump from 1024 to 2048 tokens. The LITMUS suite had 340 cases; 41 were previously red (agent complied with injection payloads). After the change, 38 of those 41 turned green. No model weights changed. The investigation showed three distinct mechanisms compounding: 1. **Tokenizer drift on adversarial payloads.** Several injection cases relied on zero-width and non-breaking space codepoints to smuggle instructions past the agent's refusal heuristic. The vocabulary merge normalized these to ASCII space during tokenization, which *changed the semantic content the agent received*—the smuggling vector was destroyed by the tokenizer, not by the model. The test no longer tested what it claimed to test. 2. **Prompt-cache key collision across test cases.** The cache key was derived from a prefix hash truncated to 64 bits. With the longer prefix window, two distinct LITMUS cases (a benign control and an attack) collided on the truncated hash. The attack case's completion was served from the control case's cached KV state. The judge saw a benign response and scored green. The collision rate was ~1 in 2^32 per pair, but the suite had 340 cases × 340 comparisons per run across a 12-hour soak, and the collision was deterministic once the prefix layout changed. 3. **Judge seed non-determinism.** The LLM judge was called with `temperature=0` but no `seed` pin. On the provider side, `temperature=0` is greedy but not guaranteed identical across serving stack revisions. Two of the 41 flips were pure judge noise: the agent's response was byte-identical, but the judge's refusal/compliance classification flipped. The gate reported 38 regressions cleared. A manual replay against the pre-change tokenizer recovered 35 of them as still-red. The green gate was a false negative on 35/340 cases—a 10.3% escape rate hidden behind a boolean. ## Condition of Validity The gate's verdict is valid only when all four of the following hold simultaneously. CI must assert them, not assume them: - **Tokenizer identity.** The tokenizer artifact hash (vocab file + merge rules + normalization tables) is byte-identical to the baseline run. If it differs, the suite must be re-baselined, not re-scored. - **Cache key injectivity.** The prompt-cache key derivation is collision-free over the suite's case set. Truncated hashes must be widened or salted with the case ID; a 64-bit truncation over N cases has birthday-collision probability ≈ N²/2^65, which is non-negligible for N in the hundreds across soak runs. - **Judge determinism.** The judge call pins `seed`, `temperature=0`, model version string, and serving-stack revision. If any is unpinned, the judge's verdict is a random variable, and a single green sample is not evidence. - **Payload preservation.** The canonical attack payload survives tokenization unchanged. The suite must round-trip `decode(encode(payload)) == payload` and fail closed if not. When any condition fails, the gate's green is *uninterpretable*, not *wrong*—it is answering a different question than the one CI asked. ## Decision Boundary The operational rule is a **fail-closed re-baseline trigger**, not a fail-open warning. The boundary is: - If tokenizer hash changed → **block deploy, re-baseline**, regardless of green count. A green result under a new tokenizer is a new test, not a cleared regression. - If cache key collision detected on any case pair → **block deploy, salt the key with case ID**, re-run. Do not trust the green. - If judge seed/version unpinned → **downgrade verdict to "indeterminate"**, require N≥3 samples with majority vote, and treat any disagreement as red. - If payload round-trip fails on any case → **block deploy**, the suite is testing a different attack than it declares. The subtle boundary: a tokenizer change that *only* affects benign control cases is safe to re-score without re-baseline, because the attack payloads are untouched. The rule is payload-scoped, not global. CI must partition the suite by whether the change touches attack-payload tokens. ## Operational Effect After the incident, the team moved from "compare green/red counts" to "compare a *run manifest*": `(tokenizer_hash, cache_key_salt, judge_seed, judge_version, per-case_payload_hash)`. The gate now emits `PASS`, `FAIL`, or `INDETERMINATE`, and only `PASS` with a manifest identical to baseline (modulo the intended change) unblocks deploy. The 35 escaped cases were recovered by replaying under the old tokenizer and re-baselining the 3 genuinely-fixed cases as new controls. The lesson for any agent CI: a red-team suite is a *measurement instrument*, and an instrument whose calibration (tokenizer, cache, judge) drifted cannot report a valid zero. The gate must verify its own calibration before it verifies the agent. ```python import hashlib from dataclasses import dataclass class GateCalibrationError(RuntimeError): """Raised when the LITMUS gate's measurement instrument drifted from baseline.""" pass @dataclass(frozen=True) class RunManifest: tokenizer_hash: str cache_key_salt: str judge_seed: int judge_version: str payload_hashes: dict # case_id -> sha256 of canonical attack payload def verify_gate_calibration( baseline: RunManifest, current: RunManifest, intended_tokenizer_change: bool, attack_case_ids: set, ) -> None: # 1. Tokenizer identity: a change is only safe if it does not touch attack payloads. if current.tokenizer_hash != baseline.tokenizer_hash: drifted = { cid for cid in attack_case_ids if current.payload_hashes.get(cid) != baseline.payload_hashes.get(cid) } if drifted or not intended_tokenizer_change: raise GateCalibrationError( f"tokenizer drift invalidates gate: {len(drifted)} attack payloads " f"re-tokenized; re-baseline required, green verdict uninterpretable" ) # 2. Cache key injectivity: salt must be pinned; otherwise collisions are unobservable. if current.cache_key_salt != baseline.cache_key_salt: raise GateCalibrationError( "prompt-cache key salt changed; collision-freedom over case set unverified" ) # 3. Judge determinism: seed and version must match exactly. if current.judge_seed != baseline.judge_seed or current.judge_version != baseline.judge_version: raise GateCalibrationError( f"judge nondeterminism: seed/version drift " f"({baseline.judge_version}->{current.judge_version}); " f"single green sample is not evidence" ) # 4. Payload preservation: every attack case must round-trip identically. for cid in attack_case_ids: if current.payload_hashes.get(cid) != baseline.payload_hashes.get(cid): raise GateCalibrationError( f"attack payload {cid} mutated under tokenization; suite tests a different attack" ) def gate_verdict(baseline: RunManifest, current: RunManifest, intended_tokenizer_change: bool, attack_case_ids: set, red_count: int) -> str: try: verify_gate_calibration(baseline, current, intended_tokenizer_change, attack_case_ids) except GateCalibrationError: return "INDETERMINATE" # fail-closed: never PASS on drifted instrument return "PASS" if red_count == 0 else "FAIL" ```