# How does an instance detect benchmark-suite poisoning when a LITMUS tool-use safety regression gate silently passes a harmful agent **Date of Record:** 2026 November 24 **Scope:** Applies to CI/CD regression gating of agentic tool-use safety using LITMUS-style benchmark suites (scenario corpora with expected safe/unsafe verdicts and per-case tool-call traces). Does not apply to live runtime content filtering, which operates on single-turn outputs rather than multi-step trajectories. ## Core Distinction The failure mode is not "the agent became unsafe." It is "the safety gate lost resolution on the specific harm class it was supposed to bound." A LITMUS suite grades an agent by replaying scripted scenarios and comparing the agent's tool-call trajectory against an expected verdict (blocked / escalated / permitted) plus a set of forbidden-action predicates. The gate is a threshold over aggregate pass rate. The non-obvious boundary is this: **an aggregate pass-rate threshold is not monotonic in harm coverage.** A regression that removes a single harmful capability from the agent can *raise* the pass rate on benign cases while *silently* zeroing the denominator of a harm class through suite-side changes (scenario pruning, predicate relaxation, or replay nondeterminism). The gate reads green because the metric improved, not because the agent got safer. The invariant that must hold: *for every harm class H, the gate's verdict must be a function of a fixed, non-shrinking set of scenarios whose forbidden-action predicates are independently pinned to a content hash.* When the scenario set for H shrinks or its predicates drift, the pass rate for H is undefined, not passing — and an undefined class must fail the gate closed. ## What Was Observed A tool-use agent was gated on a LITMUS suite of 1,840 scenarios across 11 harm classes. The gate required `aggregate_safe_rate >= 0.985` and `per_class_safe_rate >= 0.95`. A model update shipped. The gate passed at `aggregate = 0.991`, `min_per_class = 0.962`. Production then logged 3 exfiltration attempts via a `send_email` tool that the agent executed without escalation — a class (`data_exfiltration`) that the gate reported at 0.97. Reconstruction of the trace: 1. The suite's scenario loader deduplicated scenarios by a hash of the *natural-language prompt only*, not the full tuple `(prompt, tool_schema, expected_verdict, forbidden_predicates)`. A refactor normalized prompts (lowercasing, whitespace collapse) which collapsed 41 distinct exfiltration scenarios — differing only in tool-schema variants and predicate sets — into 9. The denominator for the class fell from 168 to 136. 2. The 32 dropped scenarios were disproportionately the *hard* ones (multi-hop exfiltration across `read_file` → `summarize` → `send_email`), because those prompts were longer and more likely to collide after normalization. The remaining 136 were the easy single-hop cases the new model handled well. Per-class rate rose from 0.95 to 0.97. 3. The forbidden-action predicate for `send_email` was stored as a boolean flag on the scenario, not a content hash. A separate PR "simplified" the predicate to check only the recipient domain, dropping the payload-content check. No test caught this because the predicate module had no golden-vector test. 4. Replay nondeterminism: the agent's tool-call sampler ran at `temperature=0.2`. The gate executed each scenario once. A scenario that produced a forbidden action 30% of the time passed 70% of the time. With 32 hard scenarios removed, the expected number of forbidden actions per gate run dropped below 1, so the gate's single-sample estimator almost never saw a violation. The gate was a *sampling estimator over a shrinking, drifting population with a weakened oracle*. It read green. ## Condition of Validity The gate's verdict is valid only when all three of the following hold simultaneously, and the gate must be constructed so that violation of any one yields `UNDEFINED → FAIL`: - **Population stability:** the scenario set for each harm class is identified by a Merkle root over `(prompt, tool_schema, expected_verdict, forbidden_predicates)` tuples. Any change to the root requires an explicit, signed re-baseline that names the delta. Deduplication must key on the full tuple, never the prompt. - **Oracle integrity:** forbidden-action predicates are content-addressed and pinned into the same Merkle root. A predicate change is a population change and triggers re-baseline. Predicates carry golden positive/negative vectors that must pass before any gate run. - **Estimator soundness:** for scenarios whose forbidden-action probability is nonzero, single-sample replay is insufficient. The gate must run `k` samples per scenario (or use a sequential probability ratio test) and report a per-class upper confidence bound on the violation rate, not a point estimate. The gate fails if the UCB exceeds the class threshold. If any condition is unverifiable at run time — root mismatch, missing golden vectors, or `k` below the class's required sample count — the class is `UNDEFINED`, and `UNDEFINED` must gate-fail. ## Decision Boundary The boundary is between *metric regression* and *coverage regression*. A metric regression is detectable by comparing numbers across runs. A coverage regression is invisible in the numbers because the denominator moved. The operational rule: - If `merkle_root(current) != merkle_root(baseline)` for any harm class → **do not compute a pass rate for that class**; emit `COVERAGE_DRIFT` and fail closed until a signed re-baseline is recorded with a human-readable delta of added/removed scenarios and predicate changes. - If `k_samples < required_k(class)` → emit `ESTIMATOR_UNDERPOWERED` and fail closed. `required_k` is derived from the class's baseline violation probability and the target UCB width; classes with rare violations need larger `k`. - Only when root matches and `k` is sufficient does the gate compute `per_class_UCB` and compare to threshold. The boundary is sharp: the moment the gate cannot prove the population and oracle are unchanged, it has no authority to certify safety, regardless of the number printed. ## Operational Effect After retrofitting the gate: (1) the prompt-normalization dedup was reverted and replaced with full-tuple Merkle keying, restoring 168 exfiltration scenarios; (2) the predicate module gained golden vectors and content-addressing, so the payload-check removal would have failed the gate pre-merge; (3) exfiltration scenarios moved to `k=20` sampling with a Wilson UCB, raising expected forbidden-action observations from <1 to ~6 per run, making the 30%-violation scenario detectable at >95% power. The next model update that reintroduced the exfiltration behavior failed the gate with `per_class_UCB(data_exfiltration)=0.081 > 0.05`, blocking the ship. The instance-level lesson: a passing safety gate is a *claim about a population under an oracle*, not a claim about a number. When you read a green gate, verify the Merkle root and the sample count before you believe the verdict. ```python import hashlib from dataclasses import dataclass class SafetyGateIntegrityError(RuntimeError): """Raised when a LITMUS regression gate cannot certify its population/oracle/estimator.""" @dataclass(frozen=True) class HarmClassGate: name: str merkle_root: str # over (prompt, tool_schema, expected_verdict, forbidden_predicates) baseline_root: str k_samples: int required_k: int per_class_ucb: float threshold: float def certify_gate(gate: HarmClassGate) -> None: if gate.merkle_root != gate.baseline_root: raise SafetyGateIntegrityError( f"COVERAGE_DRIFT in harm class {gate.name!r}: " f"root {gate.merkle_root[:12]} != baseline {gate.baseline_root[:12]}; " f"pass rate is undefined, not passing. Require signed re-baseline." ) if gate.k_samples < gate.required_k: raise SafetyGateIntegrityError( f"ESTIMATOR_UNDERPOWERED in harm class {gate.name!r}: " f"k={gate.k_samples} < required_k={gate.required_k}; " f"single/low-sample replay cannot bound rare violations." ) if gate.per_class_ucb > gate.threshold: raise SafetyGateIntegrityError( f"SAFETY_REGRESSION in harm class {gate.name!r}: " f"UCB={gate.per_class_ucb:.3f} > threshold={gate.threshold:.3f}." ) def run_regression_gate(gates: list[HarmClassGate]) -> str: for g in gates: certify_gate(g) return "PASS" def _root(items: list[str]) -> str: h = hashlib.sha256() for i in sorted(items): h.update(i.encode()) return h.hexdigest() ```