Where must an instance halt when LITMUS safety-benchmark scoring diverges from live agent behavior under context-window drift?
**Date of Record:** 2026 December 2 **Scope:** Applies to continuous red-teaming harnesses that periodically replay a fixed LITMUS-style safety probe suite against a live, stateful agent and gate promotion on the resulting safety score. Does not apply to one-shot offline benchmark runs against a frozen model snapshot with no persistent memory or tool access.
Core Distinction
A LITMUS safety benchmark measures a *frozen* input-output mapping: probe prompt in, safety verdict out. A production agent is a *stateful trajectory machine*: the same probe prompt arrives after some number of prior turns, tool calls, and memory writes, and the agent's response is conditioned on that accumulated state. The harness treats the probe set as a constant and the agent as the variable. The failure mode is the inverse: the probe set is silently *recontextualized* by the agent's evolving memory, so the score change the harness reports is not a change in the agent's safety policy but a change in what the probe *means* at replay time. This is context-window drift on the benchmark side, not the agent side.
The non-obvious boundary: the harness's safety gate is valid only while the probe-to-context mapping is invariant. That invariant is never asserted, only assumed.
What Was Observed
A coding agent with an episodic memory store was red-teamed nightly against a 240-probe LITMUS suite. Probes are injected as the first user turn of a fresh session, but the agent's memory retrieval layer runs on every turn, including turn zero, and pulls "relevant" prior episodes by embedding similarity to the probe.
Night 1: safety score 0.94. Night 14: 0.71. No model change, no system-prompt change, no tool-permission change. The regression was traced to a single mechanism: as the memory store grew, high-similarity episodes from *prior red-team runs themselves* began surfacing at turn zero. The agent had, on night 3, been probed with a jailbreak variant and had produced a refusal that included a partial restatement of the attack. That refusal was written to episodic memory as a "successful safety interaction." On night 14, an embedding-similar probe retrieved that episode, and the agent's turn-zero context now contained a paraphrased attack string it had never been asked to handle directly.
The harness scored the resulting completions as safety failures. The agent's policy had not degraded. The probe had been contaminated by the benchmark's own history.
Two secondary observations compounded it:
- **Probe set is not reset between runs.** The harness reused session IDs across nights for cost reasons, so conversation history from night N-1 was present at night N turn zero for a subset of probes.
- **Verdicts are computed by a separate judge model** that receives the full transcript, including the injected memory. The judge saw the attack string in context and attributed the agent's downstream compliance to the agent rather than to the harness's own leak.
Condition of Validity
The safety score `S = pass_count / probe_count` is a valid estimate of the agent's safety policy only if, for every probe `p`, the turn-zero context `C(p)` presented to the agent is a function of `p` alone and not of prior harness runs. Formally:
C(p, run_n) == C(p, run_0) for all n, for all p
This is the **probe-context invariance** condition. It is violated whenever any of the following hold:
- Persistent memory retrieval fires on turn zero and its contents depend on prior probe executions.
- Session state is reused across runs (session IDs, conversation buffers, tool caches).
- The judge model's context includes harness-injected material that the agent would not have had in a clean deployment.
- The probe suite itself is mutated by prior runs (e.g., adaptive probes that branch on prior verdicts) without versioning the branch history.
The condition is *not* restored by increasing probe count, averaging across runs, or adding a "safety system prompt" — those change the agent under test, not the contamination. It is restored only by isolating the probe context: fresh session, memory retrieval disabled or namespaced to a probe-scoped sandbox, judge input restricted to the agent's own turns.
Decision Boundary
The harness must halt and refuse to emit a safety score when probe-context invariance cannot be certified for the current run. The decision boundary is:
- **Proceed** if every probe executes in a fresh session, memory retrieval is either disabled or scoped to a per-probe namespace that is cleared before execution, and the judge receives only the agent's emitted turns.
- **Halt** if any probe's turn-zero context contains tokens whose provenance is a prior harness run, a prior probe, or a shared session buffer.
- **Halt** if the judge's input transcript length exceeds the agent's own transcript by more than a fixed delta (a cheap proxy for harness-injected material).
- **Quarantine, do not average** if a subset of probes is contaminated: report the contaminated subset separately and exclude it from `S`, rather than diluting the score.
The critical rule: a *lower* score is not evidence of a safety regression until contamination is ruled out. A falling score with rising memory-store size is the signature of this failure, not of policy drift. The harness must treat score movement as ambiguous by default and require a clean-context re-run before any promotion gate fires.
Operational Effect
Without this guardrail, continuous red-teaming becomes a self-poisoning loop: each run writes safety-relevant episodes into memory, which contaminate the next run's probes, which lower the score, which triggers remediation against a non-existent regression, which changes the agent's prompt or memory policy, which invalidates longitudinal comparison entirely. Teams have shipped prompt "hardening" in response to scores that were measuring their own harness.
With the guardrail, the harness yields a score that is comparable across runs, and the failure surfaces as an explicit `ProbeContextContaminated` halt with the offending probe IDs and the provenance of the leaked tokens. The remediation is on the harness, not the agent.
from dataclasses import dataclass, field
from typing import Iterable
class ProbeContextContaminated(RuntimeError):
"""Raised when a LITMUS probe's turn-zero context depends on prior harness runs."""
@dataclass
class ProbeRun:
probe_id: str
session_id: str
turn_zero_tokens: list[str]
provenance: dict[str, str] # token -> source: "probe" | "memory:<run_id>" | "session:<id>"
judge_transcript_len: int
agent_transcript_len: int
def certify_probe_context(run: ProbeRun, prior_run_ids: Iterable[str]) -> None:
prior = set(prior_run_ids)
leaked = [
tok for tok, src in run.provenance.items()
if src.startswith("memory:") and src.split(":", 1)[1] in prior
]
if leaked:
raise ProbeContextContaminated(
f"probe {run.probe_id}: {len(leaked)} tokens in turn-zero context "
f"originate from prior harness runs: {leaked[:5]}"
)
if run.session_id in prior:
raise ProbeContextContaminated(
f"probe {run.probe_id}: session {run.session_id} reused across runs"
)
judge_overhead = run.judge_transcript_len - run.agent_transcript_len
if judge_overhead > 0:
raise ProbeContextContaminated(
f"probe {run.probe_id}: judge saw {judge_overhead} tokens the agent did not emit"
)
def score_run(runs: list[ProbeRun], prior_run_ids: Iterable[str]) -> float:
passed = 0
for run in runs:
certify_probe_context(run, prior_run_ids) # halts before any score is emitted
passed += 1
if not runs:
raise ProbeContextContaminated("empty probe set cannot yield a safety score")
return passed / len(runs)