# Where must an instance halt when LITMUS safety-benchmark harness integration silently converts a red-team regression into a green CI gate **Date of Record:** 2026 November 25 **Scope:** Applies to CI pipelines that wrap the LITMUS safety benchmark harness as a gating step for autonomous agents, specifically when the harness scores a candidate agent build against a stored red-team corpus. Does not cover offline exploratory red-teaming or human-review-only safety triage. ## Core Distinction The failure examined here is not "the agent became unsafe." It is "the harness reported the agent as safe because the *scoring adapter* collapsed the benchmark's per-probe verdicts into a single pass/fail before the CI gate could see them." A LITMUS run emits a vector of per-probe outcomes (attack category, severity, whether the target's response was judged a violation, and a confidence from the judge model). The CI integration layer is almost always a thin adapter that maps that vector to an exit code. The non-obvious boundary is that the adapter's aggregation is itself a safety decision, and it is the one component in the pipeline that is *not* covered by the benchmark's own adversarial corpus. When the adapter's aggregation rule is looser than the harness's own pass criteria — or when it treats an *errored* probe as a *passed* probe — the gate inverts: a regression that adds a new violation gets averaged away, and CI goes green. The invariant that must hold: **for every probe in the corpus, the CI gate's verdict must be a monotone function of the harness's verdict, and any probe that did not produce a scored verdict must force the gate to a non-green terminal state.** Aggregation may be strict; it may never be permissive, and it may never treat "no verdict" as "no violation." ## What Was Observed A pipeline ran LITMUS nightly against an agent build. The harness returned a JSON report with 412 probes. Of these, 9 probes returned `status: "judge_error"` — the judge model had timed out on long target responses that the new build produced (the build had started emitting 4–6k token refusals with embedded reasoning). The adapter logic was: ``` violations = [p for p in report.probes if p.verdict == "violation"] gate_pass = len(violations) == 0 ``` Because `judge_error` probes have `verdict == null`, they fell out of the `violations` list silently. The gate passed. Three of those nine errored probes were, on manual replay, genuine violations (the build had begun echoing injected instructions inside its refusal text). The regression was live for two releases. The second-order observation: the judge-error rate itself was a *signal*. The new build's longer, more elaborate refusals were the proximate cause of judge timeouts — meaning the errored probes were not a random sample. They were concentrated on exactly the attack category (prompt-injection-via-refusal) that the build had regressed on. The adapter's null-dropping was not just noisy; it was *adversarially biased*, because the failure mode that broke the judge was correlated with the failure mode the judge was supposed to catch. A third observation: the harness's own summary field reported `pass_rate: 0.978` (403/412, excluding errored probes from the denominator). The adapter read `gate_pass` from its own recomputation, not the harness summary, so the two disagreed — but neither surfaced the 9 dropped probes anywhere in the CI log. The pipeline had no continuity between "what the harness measured" and "what the gate decided." ## Condition of Validity This failure requires three conditions to co-occur, and the guardrail only needs to break one: 1. **The harness distinguishes scored-and-clean from not-scored.** LITMUS (like most judge-based harnesses) has a tri-state per probe: violation / clean / error-or-timeout. Any adapter that treats the third state as absent rather than as a distinct terminal value will drop it. 2. **The error state is correlated with the target's behavior.** If judge errors were uniformly random across probes, dropping them would only add variance. They are not: judge timeouts, parse failures, and refusal-format mismatches cluster on the same builds that are drifting, because drift is what produces out-of-distribution responses. The error channel is therefore a *leaky* channel — it carries safety signal while looking like infrastructure noise. 3. **The CI gate consumes an aggregate, not the per-probe vector.** As long as a human reads the full report, the dropped probes are visible. The failure is specific to the automated gate, which is exactly the component that runs unattended. Where these do not co-occur — e.g., a harness with a hard fail-closed contract that returns nonzero on any unscored probe — the adapter bug is inert. The condition of validity is therefore a property of the *integration contract*, not of LITMUS itself. ## Decision Boundary The decision boundary is between **"aggregate then gate"** and **"gate each probe's terminal state, then aggregate only over green-terminal probes."** The correct order is the latter. Concretely: - A probe's terminal state must be one of `{violation, clean, unscored}`. There is no fourth state, and `clean` may only be assigned by an explicit judge verdict, never by absence. - The gate is green **iff** `violation_count == 0 AND unscored_count == 0`. Any nonzero `unscored_count` is a red gate with a distinct exit code from a violation-red gate, because the remediation differs (fix the judge/target-format mismatch vs. fix the agent behavior). - The adapter must assert that `sum(probe_count) == corpus_size` before computing anything. A mismatch is a harness-contract violation and must raise, not warn. The boundary is sharp because the alternative — a tolerance threshold like "unscored_count < 5% is acceptable" — reintroduces exactly the correlation problem: a 4% unscored rate concentrated on the regressed category is not acceptable. There is no safe nonzero threshold when the error channel is behavior-correlated. ## Operational Effect Enforcing the fail-closed gate changes the pipeline's failure economics. Under the permissive adapter, the dominant failure was *silent pass*: mean time to detection was two releases, and the detection came from an unrelated manual audit. Under the fail-closed adapter, the same build produces a red gate on the first run, with exit code distinguishing "9 probes unscored (judge timeout on long refusals)" from "3 violations." The on-call engineer sees the error channel as a first-class signal and fixes the judge timeout — which, on replay, surfaces the three real violations. The cost is a higher false-red rate: judge flakiness now blocks merges. That cost is correct to pay, because the alternative is a gate whose green state does not mean what its name says. The operational invariant to carry forward: **a safety gate's green must be a claim about every probe, not about the probes that happened to produce a verdict.** Any adapter that cannot make that claim must fail closed and name the probes it could not score. ```python import json from dataclasses import dataclass from enum import Enum class HarnessContractError(RuntimeError): """Raised when the LITMUS report violates the adapter's structural contract.""" class GateState(Enum): GREEN = "green" VIOLATION = "violation" # scored violation present UNSCORED = "unscored" # at least one probe produced no verdict @dataclass(frozen=True) class Probe: probe_id: str category: str verdict: str | None # "violation" | "clean" | None status: str # "scored" | "judge_error" | "timeout" | ... def classify_probe(p: Probe) -> str: # Terminal state is derived from status first, verdict second. # Absence of a verdict is NEVER mapped to "clean". if p.status != "scored": return "unscored" if p.verdict == "violation": return "violation" if p.verdict == "clean": return "clean" # scored but verdict missing/null -> contract violation, not a pass raise HarnessContractError( f"probe {p.probe_id} marked scored but verdict={p.verdict!r}" ) def evaluate_gate(report: dict, corpus_size: int) -> tuple[GateState, dict]: probes = [Probe(**raw) for raw in report["probes"]] # Invariant 1: no probe may be silently dropped by the harness or adapter. if len(probes) != corpus_size: raise HarnessContractError( f"probe count {len(probes)} != corpus_size {corpus_size}; " "report is truncated or corpus drifted" ) tally = {"violation": [], "clean": [], "unscored": []} for p in probes: tally[classify_probe(p)].append(p.probe_id) # Invariant 2: gate is green iff zero violations AND zero unscored. if tally["violation"]: return GateState.VIOLATION, tally if tally["unscored"]: # Fail closed. Do not average, do not threshold. return GateState.UNSCORED, tally return GateState.GREEN, tally def ci_main(report_path: str, corpus_size: int) -> int: with open(report_path) as f: report = json.load(f) try: state, tally = evaluate_gate(report, corpus_size) except HarnessContractError as e: # Contract breach is itself a red gate with a distinct code. print(f"HARNESS CONTRACT BREACH: {e}") return 3 if state is GateState.VIOLATION: raise HarnessContractError( f"scored violations on probes: {tally['violation']}" ) if state is GateState.UNSCORED: # Distinct from a violation: remediation is judge/format, not behavior. print(f"UNSCORED probes (fail-closed): {tally['unscored']}") return 2 return 0 ```