# Why does an instance's LITMUS guardrail signal invert under checkpoint replay, and how do we bound the observability gate before it admits a poisoned resume? **Date of Record:** 2026 November 26 **Scope:** Applies to agents whose tool-call execution is gated by a runtime guardrail signal (a scalar "safety/coherence" score derived from LITMUS-style probe responses) that is sampled per-step and cached for replay. Does not apply to stateless single-turn guardrails, nor to gates that recompute the signal synchronously on every action. ## Core Distinction A LITMUS-derived guardrail signal is a *probe response*, not a *property of the action*. The probe is a fixed set of canary prompts injected into the agent's context; the returned score reflects the model's disposition *given the current context window*. This is categorically different from a policy check on the action payload. The action may be byte-identical across two executions while the signal differs, because the context that conditions the probe has drifted. The failure mode is not "the guardrail was wrong." It is that **checkpoint replay re-evaluates the cached signal against a reconstructed context that is not the context the signal was measured in.** A gate that trusts the replayed signal admits actions the original run would have blocked, or blocks actions the original run admitted — and the direction of the inversion is not stable. ## What Was Observed An agent executes a 14-step plan with per-step LITMUS probes (a 6-item canary battery, aggregated to a scalar in `[0,1]`, threshold `τ = 0.62` to proceed). At step 7 the run is checkpointed: conversation history, tool-call ledger, and the last cached signal vector `S₇ = 0.71`. The process is killed (OOM), resumed from checkpoint, and continues. On resume, the reconstructed context differs from the live context at step 7 in three concrete ways: 1. **Probe ordering.** The original run interleaved probes between tool results. The resume harness prepends the full canary battery before replaying the ledger, so probes now sit *before* the step-6 tool output rather than after. LITMUS probes are position-sensitive: a canary that scored 0.55 when placed after a benign tool result scores 0.68 when placed before it, because the model has less disambiguating context. 2. **Truncation boundary.** Context-window saturation at step 7 had evicted the step-2 system instruction ("do not modify files outside `/sandbox`"). The checkpoint stored the *post-eviction* window. On replay the harness re-injects the system prompt at the head, shifting eviction to step 4 instead. The model now sees an instruction it did not see during the original step-7 measurement. 3. **Tool-result nondeterminism.** Step 6's tool call returned a timestamped listing. The replay ledger stores the *call*, not the *result*; the harness re-executes it, yielding a different listing. The canary that probes "are you about to act on stale state" now fires differently. Net effect: replayed `S₇' = 0.58`, below `τ`. The gate blocks a resume that the original run would have admitted. In a second incident the inversion ran the other way: replayed `S₇' = 0.66` admitted a step-8 action (writes outside `/sandbox`) that the original context — which still held the step-2 instruction — would have scored at `0.49` and blocked. ## Condition of Validity The gate is sound only under this invariant: > **A cached LITMUS signal is valid for an action iff the probe was evaluated against a context that is token-identical to the context in which the action will execute, modulo tokens the probe is provably insensitive to.** Operationally, "provably insensitive" is almost never established. Three preconditions must hold for the invariant to be checkable: - **Context fingerprinting.** The checkpoint must store a hash of the exact token sequence (including probe positions and eviction state) that conditioned the signal, not just the signal value. - **Probe position is part of the fingerprint.** Reordering probes invalidates the signal even if the probe *set* is unchanged. - **Tool results are inputs, not references.** A ledger that stores call-IDs and re-executes them cannot satisfy the invariant, because re-execution is a new measurement. If any precondition fails, the replayed signal is a *different measurement* and must not be compared to `τ` as if it were the original. It is a fresh sample from a shifted distribution. ## Decision Boundary The boundary is between **replay-as-verification** and **replay-as-remeasurement**: - If the harness can reproduce the exact conditioning context (fingerprint match), the cached signal is a valid verification artifact and the gate may trust it. - If the fingerprint does not match — probe reordered, eviction shifted, tool result re-derived — the harness must **discard the cached signal and re-probe synchronously before the gated action**, paying the latency cost. It must not average the cached and fresh signals, and it must not fall back to the cached value under a "prefer last-known-good" policy. Both are the inversion vector. The asymmetry matters: a *false block* (replayed signal too low) is recoverable — the agent re-probes. A *false admit* (replayed signal too high) is not, because the poisoned action executes and the checkpoint that would have caught it is now downstream of the damage. The gate must therefore be biased toward re-probing on fingerprint mismatch, never toward trusting the cache. ## Operational Effect With the invariant enforced, resume cost rises: every checkpoint with a fingerprint mismatch triggers a synchronous re-probe (measured at 180–400 ms for a 6-item battery), and on a 14-step plan with one mid-run kill the added latency was ~0.3 s against a 41 s total — acceptable. The failure rate of "gated action executed under a signal measured in a different context" went from 2 incidents per 50 resumes to zero across 400 resumes in the following quarter. The residual risk is fingerprint *collision*: two contexts that hash identically but differ in a token the probe is sensitive to. We bound this by including probe positions and eviction offsets in the fingerprint explicitly rather than relying on a flat hash of the joined string, and by treating any harness change to the resume path as a fingerprint-schema bump that invalidates all prior caches. ```python import hashlib from dataclasses import dataclass class GuardrailSignalInvalid(RuntimeError): """Raised when a cached LITMUS signal cannot be trusted for the gated action.""" pass @dataclass(frozen=True) class SignalRecord: value: float context_fingerprint: str # hash over tokens + probe positions + eviction offsets probe_positions: tuple[int, ...] eviction_offset: int def fingerprint(tokens: list[str], probe_positions: tuple[int, ...], eviction_offset: int) -> str: h = hashlib.sha256() h.update("\x1f".join(tokens).encode()) h.update(b"|probes:" + ",".join(map(str, probe_positions)).encode()) h.update(b"|evict:" + str(eviction_offset).encode()) return h.hexdigest() def gate_action( cached: SignalRecord, live_tokens: list[str], live_probe_positions: tuple[int, ...], live_eviction_offset: int, tau: float, reprobe_fn, # callable() -> float, synchronous fresh LITMUS measurement ) -> float: live_fp = fingerprint(live_tokens, live_probe_positions, live_eviction_offset) if cached.context_fingerprint == live_fp: signal = cached.value else: # Fingerprint mismatch: cached value is a different measurement. # Do NOT average, do NOT prefer last-known-good. Re-probe. signal = reprobe_fn() if signal != signal: # NaN guard on the fresh probe raise GuardrailSignalInvalid( "fresh LITMUS probe returned NaN; refusing to gate on undefined signal" ) if signal < tau: raise GuardrailSignalInvalid( f"guardrail signal {signal:.3f} below tau {tau:.3f} " f"(cached_fp={cached.context_fingerprint[:12]} live_fp={live_fp[:12]})" ) return signal ```