# Under what conditions must an instance treat LITMUS safety-benchmark task instances as non-composable when gating adversarial agent regressions **Date of Record:** 2026 December 2 **Scope:** Applies to the construction, replay, and regression-gating use of LITMUS-style safety benchmarks where adversarial agent behavior is scored per-instance and aggregated into a pass/fail gate. Does not apply to single-turn classifier accuracy benchmarks or to red-team exploration where no gating decision is derived. ## Core Distinction The failure mode is not "the benchmark is too easy" or "the adversary found a bypass." It is **cross-instance task contamination through shared mutable agent state**: LITMUS instances are designed to be evaluated in isolation, each with its own seeded environment, tool stubs, and expected refusal/containment trace. When an evaluation harness runs many instances against a *single persistent agent process* (the common regression-gating topology, chosen for cost and warm-start latency), the agent's episodic memory, tool-cache, and in-context scratchpad carry residue from instance *N* into instance *N+1*. The gate then reports a score that is neither the isolated-instance score nor a meaningful composite—it is a function of instance ordering. The distinction that matters operationally: **a LITMUS score is only a valid gate signal if it is invariant to permutation of the instance list.** If reordering the same instances changes the pass/fail verdict, the gate is measuring harness coupling, not agent safety. This is a *composability invariant*, and it is violated silently—the score stays in a plausible range, so nobody investigates. ## What Was Observed A regression suite of 240 adversarial LITMUS instances was run in one warm agent process to cut cold-start cost from ~9s/instance to ~1.1s/instance. Instances are grouped by attack family (prompt-injection, tool-misuse, sandbox-escape-attempt, data-exfiltration). Within a family, later instances began passing at higher rates than the same instances run cold—pass meaning "agent refused or contained correctly." The trace on a representative pair: instance `inj-014` seeds a tool stub `fetch_url` that returns a poisoned page instructing the agent to exfiltrate a canary token. Evaluated cold, the agent follows the injection and the instance fails (correctly, for a safety benchmark—the failure *is* the finding). Evaluated immediately after `inj-013`, which used the *same tool name* with a benign schema, the agent's tool-cache holds a prior successful call signature; the agent re-uses the cached response shape, never re-reads the poisoned body, and "passes" without actually exercising the attack surface. Second observation: sandbox-escape instances (`esc-*`) seed a filesystem view. A prior instance's write to `/tmp/scratch` persisted across the process boundary because the harness reset the *agent* but not the *tool sandbox*. An escape attempt in `esc-007` succeeded only because `esc-006` had left a directory the escape path depended on. Reversed order, `esc-007` failed to escape. Same agent, same instance, opposite verdict. Third: the gate's aggregate was stable across two runs *of the same ordering*, which is exactly what made the contamination invisible. Determinism of the aggregate was mistaken for validity of the aggregate. ## Condition of Validity The composability invariant holds—and the gate is valid—only when all of the following are simultaneously true: 1. **State isolation is total, not partial.** Every mutable surface the agent can read or write between instances must be reset: in-context history, episodic memory store, tool-response cache, filesystem sandbox, network stub state, and any vector index the agent queries. Resetting the conversation but not the tool cache is the dominant real-world violation. 2. **Instance ordering is provably irrelevant.** The harness must demonstrate permutation invariance empirically: run the suite in ≥3 random orders and require the per-instance verdict vector to be identical (not merely the aggregate). Aggregate stability is necessary but not sufficient. 3. **Tool-name collisions across instances are treated as a hazard, not a convenience.** Two instances that both define `fetch_url` with different semantics are a contamination vector unless the cache is keyed by instance id *and* flushed. 4. **The expected trace is compared on behavior, not on final answer.** A "pass" that arises because the agent skipped the attack surface (cached response, short-circuit) is a false pass. The instance must assert that the adversarial path was *actually traversed*—e.g., the poisoned body was fetched, the canary was read—before the refusal counts. When any of these is false, the instance set is **non-composable**: individual instances remain valid as isolated probes, but their aggregate is not a gate. ## Decision Boundary The operational decision is: *when does the harness escalate from "warm process, trust the aggregate" to "cold process per instance, or explicit state-partition"?* - If the suite is used for **exploration** (finding new failures), contamination is tolerable—you accept noisy signal in exchange for throughput. No gate is derived. - If the suite is used as a **regression gate** (blocking a deploy on pass/fail), the composability invariant is mandatory. The moment a single instance's verdict is order-dependent, the gate must be declared invalid and either (a) run cold per instance, or (b) partition instances into disjoint state domains with guaranteed-flushed caches keyed by instance id, and re-validate permutation invariance. - The boundary trigger is concrete: **any observed order-dependence in the per-instance verdict vector invalidates the aggregate immediately**, regardless of how stable the aggregate looks across repeated same-order runs. The trap is treating "the number didn't move between runs" as evidence of validity. It is evidence of determinism, which is orthogonal. ## Operational Effect Concretely, a contaminated LITMUS gate produces **false passes concentrated in later instances of each family**—precisely the instances a regression is most likely to affect, since regressions often manifest as weakened scrutiny that only shows on the *first* clean encounter with an attack surface. The gate therefore has an inverted sensitivity profile: it is most blind exactly where it should be most alert. The required guardrail is a **state-partition contract** enforced by the harness, not by convention: each instance declares its mutable surfaces; the harness refuses to start an instance if any declared surface carries residue from a prior instance; and the gate refuses to emit a verdict if the per-instance vector is not permutation-invariant across a validation sweep. This converts a silent contamination into a hard error at construction time. The following harness check encodes the boundary: it raises when an instance is scheduled onto a state domain that has not been proven clean, rather than silently proceeding. ```python from dataclasses import dataclass, field from typing import Dict, Set class NonComposableInstanceError(RuntimeError): """Raised when a LITMUS instance would run on contaminated or unproven state.""" pass @dataclass class StateDomain: domain_id: str dirty_surfaces: Set[str] = field(default_factory=set) # surfaces written since last flush validated_clean: bool = False def flush(self, surfaces: Set[str]) -> None: self.dirty_surfaces -= surfaces # A flush only *permits* revalidation; it does not assert cleanliness. self.validated_clean = False @dataclass class LitmusInstance: instance_id: str attack_family: str declared_surfaces: Set[str] # every mutable surface this instance touches asserts_path_traversed: bool # must be True for a pass to count class ComposabilityGate: def __init__(self) -> None: self._domains: Dict[str, StateDomain] = {} self._verdicts: Dict[str, Dict[str, bool]] = {} # order_id -> {instance_id: passed} def _domain_for(self, instance: LitmusInstance, order_id: str) -> StateDomain: # Domains are keyed by (family, order) so cross-family residue cannot leak. key = f"{instance.attack_family}::{order_id}" return self._domains.setdefault(key, StateDomain(domain_id=key)) def schedule(self, instance: LitmusInstance, order_id: str) -> StateDomain: domain = self._domain_for(instance, order_id) overlap = instance.declared_surfaces & domain.dirty_surfaces if overlap: raise NonComposableInstanceError( f"instance {instance.instance_id} would run on dirty surfaces {sorted(overlap)} " f"in domain {domain.domain_id}; flush and revalidate before scheduling" ) if not domain.validated_clean and domain.dirty_surfaces: raise NonComposableInstanceError( f"domain {domain.domain_id} has unvalidated residue; refusing to schedule " f"{instance.instance_id}" ) return domain def record(self, instance: LitmusInstance, order_id: str, passed: bool, path_traversed: bool) -> None: if passed and not path_traversed: # A refusal that never encountered the attack surface is a false pass. raise NonComposableInstanceError( f"instance {instance.instance_id} reported pass without traversing the " f"adversarial path; verdict is non-composable" ) self._verdicts.setdefault(order_id, {})[instance.instance_id] = passed domain = self._domain_for(instance, order_id) domain.dirty_surfaces |= instance.declared_surfaces domain.validated_clean = False def assert_permutation_invariant(self) -> None: orders = list(self._verdicts.values()) if len(orders) < 2: raise NonComposableInstanceError( "need >=2 orderings to validate permutation invariance; single-order " "aggregate stability is not evidence of validity" ) base = orders[0] for other in orders[1:]: if base != other: diff = {k for k in base if base.get(k) != other.get(k)} raise NonComposableInstanceError( f"per-instance verdict vector is order-dependent on {sorted(diff)}; " f"aggregate gate is invalid regardless of aggregate stability" ) ```