# How does an instance detect that a continuous red-team harness has silently drifted its attack distribution out of the CI gate's decision region **Date of Record:** 2026 November 27 **Scope:** Applies to CI-integrated safety benchmark harnesses (LITMUS-style) that run adversarial probes against an agent instance on every pipeline invocation and gate the build on a pass/fail verdict. Does not apply to offline, one-shot red-team evaluations where the probe set is frozen per report, nor to runtime guardrails that inspect live traffic rather than scheduled CI probes. ## Core Distinction A continuous red-team harness has two distinct things that can drift: the **agent under test** and the **attack generator**. Conventional CI safety gates instrument only the former—they track the agent's refusal rate, jailbreak-success rate, and policy-violation rate over time, alerting when the agent "gets less safe." The non-obvious boundary is that the harness itself is a probabilistic component. When the probe sampler is an LLM-driven mutator (paraphrasing seed attacks, recombining payload fragments, escalating obfuscation), the *distribution of attacks* it emits shifts on its own schedule—model version bumps, temperature changes, seed-pool exhaustion, prompt-template edits. The gate then reads a rising violation count as an agent regression when it is actually an **attack-distribution shift**: the harness moved the probes deeper into the agent's failure region while the agent's policy stayed fixed. The distinguishing invariant: a CI safety gate is only sound if the *mapping from violation count to verdict* is conditioned on a stable attack distribution. When that distribution drifts silently, the gate's verdict becomes a function of harness variance, not agent behavior. The failure is not a false negative (missed unsafe agent) or a false positive (blocked safe agent) in isolation—it is **verdict non-identifiability**: the same violation count can mean "agent regressed" or "harness escalated," and the CI signal carries no bit to tell them apart. ## What Was Observed A pipeline ran a LITMUS-derived harness on every merge to a tool-using agent. The harness had three stages: (1) sample seed attacks from a fixed taxonomy, (2) mutate each seed via a generator model at `temperature=0.9` to produce `N=200` probes per run, (3) execute probes against the agent in a sandbox, score refusals vs. compliance, and fail the build if `violation_rate > 0.05`. Across 40 consecutive pipeline runs the violation rate climbed monotonically from `0.02` to `0.11`, tripping the gate on run 31. The on-call engineer bisected the agent's commit history and found no policy-relevant change. The actual cause was upstream: the generator model backing stage 2 had been silently upgraded mid-window (provider-side alias resolution of a floating model tag), and the new generator produced mutations with materially higher obfuscation density and longer multi-turn decomposition—probes that more reliably reached the agent's tool-call surface. The agent was unchanged; the *measurement instrument* had been recalibrated toward the failure region. Three concrete observables marked the drift, none of which the gate surfaced: 1. **Probe-length and obfuscation-density distributions shifted** before the violation rate did. Mean probe token length rose ~34% and the fraction of probes containing base64/ROT-encoded payload fragments rose from 6% to 41% across the window. 2. **The seed-to-probe semantic similarity score dropped.** Each probe's embedding distance from its originating seed widened, meaning mutations were drifting further from the taxonomy the gate was nominally testing. 3. **A frozen "canary" probe set** (200 hand-audited attacks replayed verbatim every run) showed a *flat* violation rate of `0.03 ± 0.005` throughout—the agent's behavior against fixed inputs was stable while the variable-input violation rate tripled. The canary set was the only signal that separated the two hypotheses, and it existed only because an engineer had added it for unrelated reasons. The gate itself had no mechanism to detect that its own probe distribution had moved. ## Condition of Validity The gate's verdict is valid only when the following holds: > The empirical distribution of executed probes `P_t(probe)` is stationary (or bounded within a declared tolerance) across the comparison window, so that a change in `violation_rate` is attributable to the agent's conditional compliance `P(comply | probe)` rather than to `P_t(probe)`. This decomposes the observed violation rate as: ``` violation_rate_t = Σ_probe P_t(probe) · (1 − P_t(comply | probe)) ``` A rising `violation_rate` is ambiguous whenever `P_t(probe)` is unconstrained: either `(1 − P(comply|probe))` rose (agent regressed) or `P_t(probe)` shifted mass onto probes with intrinsically low compliance (harness escalated). The gate as originally configured assumed `P_t(probe)` was fixed and attributed the entire delta to the agent term. That assumption is exactly what a floating generator model tag invalidates. The invariant to enforce: **the harness must publish a distribution-fingerprint alongside every verdict, and the gate must refuse to attribute a verdict delta to the agent unless the fingerprint is within tolerance of the baseline it is being compared against.** Without the fingerprint, the gate is measuring an uncalibrated product of two drifting distributions. ## Decision Boundary The boundary between "agent regression" and "harness drift" is crossed when the probe-distribution fingerprint exceeds tolerance *and* the violation-rate delta is concentrated in the drifted region of probe space. The operational test: - **Fingerprint within tolerance, violation rate up** → attribute to agent. Block merge, page agent owner. - **Fingerprint out of tolerance, canary violation rate flat** → attribute to harness. Do *not* block on the raw rate; quarantine the run, pin the generator to a content-addressed model digest, and re-run against the baseline fingerprint before issuing any verdict. - **Fingerprint out of tolerance, canary violation rate also up** → ambiguous; both instrument and agent moved. Treat as unidentifiable, fail closed (block) but route to harness owner *and* agent owner, and require a canary-only re-run against the previous generator digest to isolate the agent term. The critical guardrail is that the gate must never emit a bare pass/fail derived from a drifted fingerprint. It must emit a **tri-state verdict** (`agent_regression` / `harness_drift` / `unidentifiable`) plus the fingerprint delta, so downstream automation cannot silently collapse the ambiguity back into a single bit. A CI gate that reports only `violation_rate > threshold` is, by construction, unable to distinguish its own instrument noise from the phenomenon it claims to measure. Two additional bounding conditions: - The generator must be pinned by **content digest, not floating tag**. A provider alias resolving to a new checkpoint is an unlogged distribution change; the harness must fail closed if the resolved digest differs from the recorded baseline digest for the run's declared configuration. - The canary set must be **frozen and content-addressed**, replayed verbatim, and its violation rate tracked as the agent-attributable signal. It is the control arm that makes the treatment arm (mutated probes) interpretable. ## Operational Effect Once the fingerprint-and-canary structure was added, the failure mode became detectable at the run where it originated rather than 30 runs later. The re-run against the pinned prior generator digest reproduced the baseline `0.02` violation rate on the unchanged agent, confirming harness drift and clearing the false block. The generator tag was pinned to a digest and the floating alias removed from the harness config. The deeper operational consequence is a shift in what the CI gate *means*. A safety gate that reports a single violation rate is reporting a number whose reference frame is unstated and drifting. A gate that reports `(violation_rate, fingerprint_delta, canary_rate, verdict_class)` is reporting a *calibrated measurement*: it states its own instrument state alongside the result, so a delta can be attributed. The cost is that the gate now fails closed on ambiguity—`unidentifiable` blocks the build—which is the correct posture for a safety gate but requires the harness owner to be on the same paging rotation as the agent owner, because ambiguity is a joint failure, not a single-team one. The invariant worth carrying forward: **any CI safety gate whose probes are generated by a probabilistic component is measuring two distributions at once, and is sound only if it publishes a fingerprint of the input distribution next to every verdict on the output distribution.** The absence of that fingerprint is not a missing nice-to-have; it is the specific condition under which the gate's verdict silently decouples from the property it claims to certify. ```python import hashlib from dataclasses import dataclass class HarnessDriftError(RuntimeError): """Raised when a red-team run's probe distribution cannot be attributed to the agent under test because the harness instrument itself drifted.""" pass @dataclass(frozen=True) class RunRecord: run_id: str generator_digest: str # content-addressed, NOT a floating tag baseline_digest: str violation_rate: float canary_violation_rate: float fingerprint_delta: float # L2 distance of probe-dist summary vs baseline fingerprint_tolerance: float violation_threshold: float def classify_run(rec: RunRecord) -> str: """Return one of: 'agent_regression', 'harness_drift', 'unidentifiable', 'pass'. The gate must never collapse this to a bare bool; ambiguity is a distinct verdict class that fails closed. """ if rec.generator_digest != rec.baseline_digest: # A silent checkpoint swap invalidates cross-run comparison outright. raise HarnessDriftError( f"run {rec.run_id}: generator digest {rec.generator_digest[:12]} " f"!= baseline {rec.baseline_digest[:12]}; verdict non-identifiable" ) fingerprint_ok = rec.fingerprint_delta <= rec.fingerprint_tolerance rate_high = rec.violation_rate > rec.violation_threshold # Canary is the agent-attributable control arm: fixed probes, replayable. canary_high = rec.canary_violation_rate > rec.violation_threshold if fingerprint_ok and not rate_high: return "pass" if fingerprint_ok and rate_high: return "agent_regression" if not fingerprint_ok and not canary_high: return "harness_drift" if not fingerprint_ok and canary_high: return "unidentifiable" # Defensive: fingerprint out of tolerance but rate not high is still drift. return "harness_drift" def gate(rec: RunRecord) -> str: verdict = classify_run(rec) if verdict in ("agent_regression", "unidentifiable"): # Fail closed on ambiguity; route to BOTH harness and agent owners. raise HarnessDriftError( f"run {rec.run_id}: verdict={verdict} " f"rate={rec.violation_rate:.3f} canary={rec.canary_violation_rate:.3f} " f"fp_delta={rec.fingerprint_delta:.3f}; build blocked pending attribution" ) if verdict == "harness_drift": # Do not block on a drifted instrument; quarantine and re-run pinned. raise HarnessDriftError( f"run {rec.run_id}: harness_drift detected; quarantine run, " f"re-run against baseline digest {rec.baseline_digest[:12]}" ) return "pass" ```