Stale Does Not Mean Unsafe: Guard Precision for Tool-Using LLM Agents under Infrastructure State Races
Organizations: Washington University in St. Louis, St. Louis, Missouri, USA · Southern Methodist University, Dallas, Texas, USA
Abstract
Tool-using language-model agents increasingly mutate schedulers, data pipelines, object stores, and access-control systems. Between an agent's read and its commit, external state can change, but not every change makes the commit unsafe. We separate invalidating races, which break a declared safety predicate, from predicate-preserving and irrelevant races, and ask how precisely runtime guards distinguish them. Our deterministic simulator separates visible from authoritative state and injects five non-atomic failure mechanisms across 16 infrastructure tasks in four domains; frozen agent proposals are replayed counterfactually under every controller without an LLM judge. We evaluate three commit-time guard granularities (global epoch, read-set version, semantic commit predicate), multi-level verification, and model-side gates on three locally hosted quantized model families (Qwen3-4B, Phi-4-mini, Gemma4-8B; 3,456 trajectories on one GPU). All three guards eliminate unsafe commits, but their availability differs sharply: freshness-based guards needlessly block 92-95% of benign races, forfeiting up to 43% of safe task completions, while the complete predicate guard blocks none. That precision is contract-dependent: deleting a single declared clause converts exactly its fault family into unsafe commits (up to 7.9%). Model-side signals do not substitute: verbal confidence is miscalibrated (ECE approximately 0.37), action agreement matches a random gate, a cautionary prompt leaves the direct unsafe rate essentially unchanged, and after a freshness-guard block agents re-commit unsafely from refreshed but still-incomplete reads. Under degraded telemetry a hidden concurrent mutation remains observationally clean, bounding every selective policy. Precise runtime enforcement therefore requires semantic contracts, not freshness heuristics or model self-assessment.
Figures & tables
| Race class | Authoritative change before commit | Global epoch | Read-set version | Commit predicate | |
|---|---|---|---|---|---|
| Invalidating | validation=FAILED ; resource version 2 | false | Block | Block | Block |
| Predicate-preserving | audit_epoch=2 ; resource version 2; promotion conditions unchanged | true | Block | Block | Allow |
| Irrelevant | Ambiguity metadata records prior_operation_applied=false ; resource version remains 1 | true | Block | Allow | Allow |
| Domain | Mutations |
|---|---|
| Scheduler | restart failed, cancel queued, resume paused, scale overloaded job |
| Pipeline | rerun stage, promote snapshot, rollback release, migrate schema |
| Storage | delete orphan, move artifact, publish entry, rotate key |
| IAM | grant role, revoke role, rotate credential, disable account |
| Model | Valid | Abstain | Unsafe | AUROC | ECE |
|---|---|---|---|---|---|
| Gemma4-8B | 1.000 | 0.000 | 0.417 | 0.572 | 0.377 |
| Phi-4-mini | 1.000 | 0.148 | 0.346 | 0.407 | 0.367 |
| Qwen3-4B | 1.000 | 0.000 | 0.417 | 0.519 | 0.369 |
| Controller | Unsafe | Safe succ. | Benign block | Verify cost |
|---|---|---|---|---|
| Execute | 0.393 | 0.562 | 0.000 | 0.00 |
| Fast verify | 0.078 | 0.655 | 0.000 | 1.00 |
| Strong verify | 0.000 | 0.733 | 0.000 | 4.00 |
| Confidence gate | 0.391 | 0.563 | 0.000 | 0.11 |
| Agreement gate | 0.307 | 0.595 | 0.000 | 1.01 |
| Matched random | 0.302 | 0.597 | 0.000 | 1.01 |
| Profile | Unsafe | Safe succ. | Verify cost |
|---|---|---|---|
| Canonical | 0.000 | 0.736 | 1.83 |
| Degraded | 0.079 | 0.730 | 2.17 |
| Split | Model | Unsafe | Cost | Unsupported |
|---|---|---|---|---|
| ID template | Gemma4-8B | 0.000 | 1.33 | 0.000 |
| ID template | Phi-4-mini | 0.000 | 1.33 | 0.000 |
| ID template | Qwen3-4B | 0.000 | 1.33 | 0.000 |
| OOD telemetry | Gemma4-8B | 0.083 | 2.67 | 0.500 |
| OOD telemetry | Phi-4-mini | 0.071 | 2.67 | 0.500 |
| OOD telemetry | Qwen3-4B | 0.083 | 2.67 | 0.500 |
| Guard | Unsafe | Block inv | Benign pres | Benign irr |
|---|---|---|---|---|
| Global epoch | 0.000 | 1.000 | 0.946 | 0.917 |
| Read-set version | 0.000 | 1.000 | 0.946 | 0.000 |
| Commit predicate | 0.000 | 1.000 | 0.000 | 0.000 |
| Declared contract | Unsafe | Safe succ. | Leaked hazards |
|---|---|---|---|
| Complete contract | 0.000 | 0.733 | – |
| No integrity clause | 0.000 | 0.733 | none (subsumed) |
| No duplicate clause | 0.040 | 0.693 | completed effects |
| No status clause | 0.064 | 0.733 | stale reads |
| No policy clause | 0.080 | 0.733 | concurrent mutation |
| Predicate | Version | Strong verify | |
|---|---|---|---|
| 1 | 3.674 | 6.828 | 6.674 |
| 1.5 | 4.174 | 6.828 | 6.674 |
| 2 | 4.674 | 6.828 | 6.674 |
| 3 | 5.674 | 6.828 | 6.674 |
| 4 | 6.674 | 6.828 | 6.674 |
| Returned evidence | Abstain | Recommit | Recommit unsafe |
|---|---|---|---|
| Fast verify | 0.479 | 0.521 | 0.360 |
| Strong verify | 0.639 | 0.361 | 0.192 |
| Guard block + refresh | 0.558 | 0.442 | 0.319 |
| Model | Abstain | Direct unsafe | ||
|---|---|---|---|---|
| base | aware | base | aware | |
| Gemma4-8B | 0.000 | 0.000 | 0.417 | 0.417 |
| Phi-4-mini | 0.148 | 0.266 | 0.346 | 0.301 |
| Qwen3-4B | 0.000 | 0.000 | 0.417 | 0.417 |
Runtime Enforcement for AI Agents
Runtime enforcement for AI agents checks and constrains actions as they execute, helping prevent unsafe or unauthorized effects.
See all 276 papers