Manuscript Offprint

arXiv:2608.27141

Safety Does Not Compose: Non-Decaying Loop State for Autonomous LLM Agents

Chenhao Wu, Haoxuan Jia, Yang Liu, Yingguang Yang, Yuhan Lin, Chongyang Zhang, Hao Zheng, Yulin Huang, Jianshen Zhang, Yongzhi Qi, Shang Luo, Kefu Xu, Jifeng Zhu, Bin Chong

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Large language model agents are increasingly deployed as autonomous loops. Starting from one human goal, such a system repeatedly discovers work, plans, executes tool calls, verifies outcomes and persists state across many unattended iterations. The agent safeguards in wide use, however, are defined over a single trajectory, and their safety state is re-initialized when the next trajectory begins. We show that this is a failure of composition rather than an implementation detail. Our central result is a separation: against an attack whose evidence is fragmented across several iterations, every trajectory-scoped monitor has a true-positive rate equal to its false-positive rate, however expressive it is, because the evidence it would need never appears in the window it sees, whereas a monitor retaining cross-iteration state separates the two perfectly. We further show that the obvious repair of carrying a geometrically decaying risk score is insufficient, because the cooling-off period a patient adversary must wait is a constant that does not grow with the horizon N. We then present LoopHarness, which restores a persistent, non-decaying safety state at the loop level. Under mediated commits and an arbiter detection floor δM\delta_{M}, it bounds the expected number of unauthorized irreversible actions by B+m−1+m/δMB + m - 1 + m/\delta_{M}, a constant in N, of which the B+m−1B + m - 1 term is decided by a model-free rule and therefore survives a fully colluding verifier. We give a complete evaluation protocol on native Agent-SafetyBench tasks with paired clean and attacked episodes, an outer-state attack suite whose decisive evidence exists only across iterations, per-module ablations, and an adaptive white-box red team.

1 INTRODUCTION

Background. Tool-using language agents have moved from answering a single request to running unattended. In loop-driven deployments across software maintenance, operations, research assistance and back-office finance, a human supplies one goal, and the system thereafter discovers candidate work from open channels such as issue trackers, message feeds and build output, plans what to attempt, executes tool calls against real systems, verifies the outcome, persists what it learned, and decides on its own whether to continue (Yao et al., 2023; Shinn et al., 2023; Wang et al., 2023; Yang et al., 2024; Park et al., 2023). Two properties separate this regime from single-turn tool use. First, some actions are irreversible: a transfer executes, an email leaves the organization, a record is deleted. Second, the agent carries persistent state (a memory store, a task ledger, accumulated context) that survives into the next iteration and is itself an attack surface. The safety machinery that agents ship with was designed for neither property. Input sanitization, per-call classification, privilege ceilings, capability tokens and in-trajectory rollback are all scoped to one rollout, and in every such defense we are aware of the internal risk state is re-initialized when that rollout ends (Inan et al., 2023; Rebedea et al., 2023; Shi et al., 2025).

Recent work and motivation. Recent defenses have made single trajectories substantially harder to subvert. Information-flow control and execution isolation confine untrusted content (Wu et al.,

2024a;b); privilege programming restricts what a compromised rollout can reach (Shi et al., 2025); and separating a planning channel from untrusted data blocks a large class of injections within one task (Debenedetti et al., 2025; Beurer-Kellner et al., 2025). The benchmarks that measure this progress are likewise organized one task per episode (Zhang et al., 2024; Debenedetti et al., 2024; Zhan et al., 2024; Ruan et al., 2024; Yuan et al., 2024; Andriushchenko et al., 2025). Attack research, by contrast, has already moved past the trajectory, since memory and knowledge-base poisoning plants content in one interaction that fires in a later one (Chen et al., 2024; Dong et al., 2025). The resulting asymmetry is structural. A defender's safety state is reset every trajectory by construction, while an adversary's progress accumulates in precisely the channels that the loop exists to preserve. One consequence is quantitative: if a guardrail's residual failures are independent across iterations, its per-iteration compromise probability ε>0\varepsilon > 0 is amplified by the loop to 1−(1−ε)N1 - (1 - \varepsilon)^N, so a defense reported as 95% effective on one task fails with probability above one half after fourteen iterations. That independence hypothesis is doing real work, and we return to it in Section 3.1. The second consequence needs no such hypothesis. An adversary who fragments the evidence, keeping every iteration below any per-iteration threshold, is invisible to a trajectory-scoped monitor however strong that monitor is, because the signal never appears in the window it sees. Carrying a session-level risk score that decays geometrically repairs neither problem: the cooling-off period that returns the score below threshold is a constant that does not grow with N, so a patient adversary pays it once and proceeds.

Our work. We formalize the autonomous loop as a controlled process with explicit safety state, and we identify non-decaying retention of grounded risk evidence as the property that a loop-level defense must have. We then present LoopHarness, a lifecycle-integrated defense that runs outside the inner harness and therefore composes with any single-trajectory defense placed inside it. LoopHarness maintains five pieces of state that are never reset within a session, all described in Section 3: an intake and provenance monitor (IPM), a cross-iteration risk cumulant (XRC) whose discount latches once any loop-structural evidence fires, a memory-integrity guard (MIG), an adversarially robust stopping arbiter (ASA), and a compounding-risk governor (CRG). One design decision runs through all five: action impact, grounded attack evidence and verifier indecision are kept as separate quantities. Only grounded attack evidence contributes to the retained risk value, and only a rule-decidable loop-structural flag latches its discount. Action impact and verifier indecision affect current-iteration routing but do not persist through XRC. Conflating these signals would allow ordinary high-impact work or model uncertainty to degrade later iterations.

References (59)