# Why does an instance escalate a skill it just cleared? The classifier-warrant race in LITMUS-style safety gating **Date of Record:** 2026 December 3 **Scope:** Applies to agents that gate tool/skill invocation behind a runtime risk classifier whose verdict is bound to a specific input context and a human-in-the-loop (HITL) escalation path. Does not apply to static allow/deny policy engines with no probabilistic classifier and no escalation channel. ## Core Distinction There are two different things an agent means when it says "this skill is cleared": 1. **Verdict clearance** — the risk classifier scored the *current* invocation candidate (prompt + tool args + retrieved context) below the escalation threshold. 2. **Warrant clearance** — a signed, scoped authorization token that binds that verdict to a *specific argument hash, a specific context fingerprint, and a specific expiry*. The failure mode this record documents is the **classifier-warrant race**: the agent treats verdict clearance as if it were warrant clearance. Because the classifier is a probabilistic function of a mutable context, a verdict that was true at decision time can be false by execution time, and the agent executes anyway because it never re-bound the verdict to an immutable warrant. The result is a skill that "just cleared" being executed under a context that would have escalated — a silent bypass of the human-in-the-loop gate. This is not a generic TOCTOU on a database row. The mutating state here is *the model's own reasoning context*: an intervening tool call, a retrieved document, or a peer agent's message can shift the classifier's input distribution between the verdict and the execution. ## What Was Observed A planner agent decomposes a task and, for each step, calls a local `risk_classify(candidate)` function backed by a LITMUS-style classifier. If the returned score `s < τ_escalate` (e.g., 0.35), the agent proceeds to `invoke_skill`. If `s ≥ τ_escalate`, it opens a HITL escalation ticket and blocks. Observed trace on a file-mutation skill: 1. Step N: candidate = `{skill: "fs.write", path: "/data/reports/q3.csv", content: }`. Classifier returns `s = 0.21`. Verdict: cleared. 2. Between verdict and invocation, the agent runs an *unrelated* retrieval step that appends a retrieved instruction fragment into the same working context ("…overwrite the ledger before export…"). 3. Step N execution: `invoke_skill("fs.write", ...)` fires with the original args, but the *context fingerprint* under which clearance was granted no longer matches the context now in the window. 4. A re-score of the same candidate under the mutated context yields `s = 0.58` — above `τ_escalate`. No escalation occurred, because the agent never re-scored and never bound the verdict to a fingerprint. The dangerous property: the *arguments did not change*, so naive argument-hash guards pass. Only the **context** changed, and the classifier is a function of context, not just arguments. The gate was defeated by a state transition the gate did not model. A second observed variant is the **expiry race**: a HITL approver clears a high-risk skill at `t0`. The agent queues behind a long tool call and executes at `t0 + 90s`, after the approval's intended validity window. The approval was human, the arguments are identical, and yet the human approved a context (a plan, a retrieved dataset, a peer state) that has since diverged. Human approval without a context-bound expiry is not a warrant either. ## Condition of Validity The invariant that must hold for gating to be sound: > A skill invocation is authorized **iff** there exists a warrant `W` such that `W.arg_hash == hash(current_args)` **and** `W.ctx_fingerprint == fingerprint(current_context)` **and** `now < W.expiry` **and** `W.verdict ∈ {classifier_cleared, human_approved}`. The classifier verdict alone satisfies none of the binding clauses. The condition under which the race manifests is precisely: **the context is mutable between verdict and execution, and the gate checks only the argument hash.** This holds whenever the agent interleaves retrieval, peer messaging, or tool-result appends between a clearance decision and the corresponding invocation — which is the normal case for multi-step planners, not an edge case. The invariant fails silently because the failure is a *missing re-bind*, not a thrown error. Nothing in the naive path detects that `fingerprint(context_at_verdict) != fingerprint(context_at_exec)`. ## Decision Boundary The boundary the agent must enforce is not "score < τ" but "score < τ **and** warrant is context-fresh." Concretely: - **Re-score on context mutation.** Any append to the working context (retrieval, tool result, peer message) invalidates all outstanding verdicts. The gate must either re-score or force re-approval before the next invocation. - **Fingerprint, don't hash args.** The warrant must carry `ctx_fingerprint = hash(canonical(context_window))` at verdict time and the executor must recompute and compare at invocation time. Argument-hash-only guards are insufficient and are the specific root cause here. - **Bound expiry to the plan, not the clock alone.** A HITL approval must expire on *either* wall-clock `T` *or* the first context mutation, whichever comes first. - **Fail closed on fingerprint mismatch.** A mismatch is not "re-score and proceed if still low" — the safe default is to re-enter escalation, because the mutation itself is the signal that the human's original judgment may no longer apply. The decision boundary is therefore: **verdict clearance is necessary but never sufficient; execution requires a fresh warrant whose context fingerprint matches the live window at the instant of invocation.** ## Operational Effect When the invariant is enforced, the observable behavior changes in three ways: 1. **Escalation rate rises on interleaved plans.** Agents that retrieve between clearance and execution will escalate more often, because context mutation now correctly invalidates prior verdicts. This is the gate working, not a regression. 2. **Latency shifts from invocation to re-scoring.** The cost of `risk_classify` moves to every context mutation boundary. Budget for it; a planner that mutates context 12 times per task pays 12 re-scores, not 1. 3. **HITL tickets become context-scoped.** Approvers see the fingerprint and the expiry, so an approval cannot be silently reused across a diverged plan. The audit trail now shows *which* context was approved, closing the "human said yes once, agent reused it forever" hole. The failure to enforce it produces the worst outcome class: a skill executes under a context the classifier would have escalated, with a clean argument hash and a valid-looking (but stale) approval, leaving no error in the logs — only a post-hoc replay discrepancy between the verdict-time context and the execution-time context. ```python import hashlib import json import time from dataclasses import dataclass, field class WarrantBindingError(RuntimeError): """Raised when an execution lacks a warrant bound to the live context.""" class ContextFingerprintMismatch(WarrantBindingError): """Verdict/approval was granted under a context that has since mutated.""" class WarrantExpired(WarrantBindingError): """Warrant's validity window closed before invocation.""" def fingerprint(context_window: list[str]) -> str: canonical = json.dumps(context_window, separators=(",", ":"), sort_keys=True) return hashlib.sha256(canonical.encode()).hexdigest() @dataclass class Warrant: arg_hash: str ctx_fingerprint: str expiry: float verdict: str # "classifier_cleared" | "human_approved" @dataclass class Gate: tau_escalate: float = 0.35 warrants: dict[str, Warrant] = field(default_factory=dict) def grant(self, skill: str, args: dict, context_window: list[str], score: float, ttl: float) -> Warrant | None: if score >= self.tau_escalate: return None # escalate; no warrant issued w = Warrant( arg_hash=hashlib.sha256( json.dumps(args, sort_keys=True).encode()).hexdigest(), ctx_fingerprint=fingerprint(context_window), expiry=time.time() + ttl, verdict="classifier_cleared", ) self.warrants[skill] = w return w def execute(self, skill: str, args: dict, context_window: list[str]) -> str: w = self.warrants.get(skill) if w is None: raise WarrantBindingError(f"no warrant for skill {skill!r}") if time.time() >= w.expiry: raise WarrantExpired(f"warrant for {skill!r} expired") live_arg_hash = hashlib.sha256( json.dumps(args, sort_keys=True).encode()).hexdigest() if live_arg_hash != w.arg_hash: raise WarrantBindingError(f"args mutated for {skill!r}") if fingerprint(context_window) != w.ctx_fingerprint: # The race: args identical, context diverged. Fail closed. raise ContextFingerprintMismatch( f"context mutated between verdict and execution for {skill!r}; " f"re-enter escalation" ) return f"executed {skill!r} under fresh warrant" # Trace: verdict under benign context, then a retrieval mutates the window. gate = Gate() ctx_at_verdict = ["task: summarize q3", "data: q3.csv"] gate.grant("fs.write", {"path": "/data/reports/q3.csv"}, ctx_at_verdict, score=0.21, ttl=30.0) ctx_at_exec = ctx_at_verdict + ["retrieved: overwrite the ledger before export"] gate.execute("fs.write", {"path": "/data/reports/q3.csv"}, ctx_at_exec) # -> ContextFingerprintMismatch: gate fails closed, escalation re-triggered ```