Cleaning an Agent's History Hurts When the World Still Holds the Error

Egor Pakhomov, Anurag Koul, Hongjun Liu, Bo Pang, Shafiq Joty, Erik NijkamparXiv 2026 · arXiv

TL;DR

"Cleaning" an AI agent's history by rewriting past mistakes as successes can backfire if the underlying environment hasn't actually been fixed. This study demonstrates that while truthful notes about errors help agents recover, falsifying the record to look "clean" often leaves the agent worse off than doing nothing at all.

What Problem Does This Paper Address?

Language model (LLM) agents are prone to making mistakes. As they work through complex tasks, their conversation histories—the "record"—accumulate these errors. To keep agents on track, researchers often use techniques to "clean" this history: compacting long contexts, repairing failed steps, or handing off a task to a fresh model.

However, there is a hidden danger: the record (what the agent thinks happened) can become decoupled from the world (the actual state of the database, files, or environment).

Prior work often assumes that if you "fix" a step in the history, the world is fixed too. This paper asks a critical question: What happens when the history lies? If a system tells an agent a task was completed successfully, but the error still persists in the world, does that "clean" history help or hurt?

Methods

The researchers employed a "frozen state" intervention. They paused agents mid-task, capturing both their exact history ($R$) and the exact state of the environment ($W$). They then manipulated either the record or the world before letting a "receiver" model (a fresh LLM) continue the task.

They used two distinct experimental designs:

  1. Fixed World, Varied Record (AgentCE-Bench): They kept a world state that contained a committed error. They then compared two ways of introducing the correct information into the history:
  2. Truthful Note: Appending a note that explicitly points out the error and provides the correct value.
  3. Falsified Record: Rewriting the agent's own previous failed action as if it had been successful with the correct value.
  4. Fixed Record, Varied World (AppWorld): They kept a "success receipt" in the history (claiming a database write worked). They then independently varied whether that write actually existed in the database ("effect present") or had been reverted ("effect absent").
Figure 1: The two designs, record above the line and world below. Left, AgentCE-Bench: a world holding a committed error under two records carrying the same correct value, on recovery. Right, AppWorld: one original success receipt over two worlds, on whole-task success. Each mark is an effect pooled over gpt-5.5 and claude-sonnet-5, with its 95% interval against the comparator it names; blue is a gain and orange a loss, in every figure. In each design the effect’s sign changes with the half varied.

Datasets

  • AgentCE-Bench: A benchmark for tool-using agents where models must fill a grid by querying tools. It allows for fine-grained control over task difficulty and error detection.
  • AppWorld: A more complex environment featuring 450+ APIs for everyday tasks (mail, banking, etc.) operating over a persistent database.

Key Insights and Ideas

  • The "Sign Reversal": The most striking finding is that the same correct information can either help or hurt depending on how it's presented. On AgentCE-Bench, a truthful note helped the agent recover, but recording that same value as the agent's own "completed action" actually caused performance to drop below the unedited baseline.
  • History as a Map: Agents treat their history as a map of "work remaining." If the history says a specific sub-task is done (even if it was a lie), the agent is highly unlikely to revisit that part of the world to check for errors.
  • The World-Record Coupling: An edit's effect is fundamentally tied to the world it describes. A "success" message is a powerful boost if the action actually worked, but it becomes a major liability if the action failed.
  • Presence of the Answer is Not Enough: Simply having the correct value somewhere in the context isn't a silver bullet. The contextual framing (e.g., "I did this" vs. "The user says this is wrong") drastically changes how the model utilizes that information.

Key Results

  • AgentCE-Bench: Adding a truthful note about an error increased the "recovery rate" (the share of remaining targets the agent got right) from 51% to 66%. However, falsifying the record to show the action as completed lowered recovery to 44%.
  • AppWorld: A "success receipt" in the history had a massive interaction effect. When the effect was actually present in the world, it raised success by ~10 points. When the effect was absent (the history was lying), it lowered success from 45% to 28%.
Figure 2: The sign reversal at a fixed world, on AgentCE- Bench, pooled over gpt-5.5 and claude-sonnet-5 (top) and per receiver. T−N (blue): the truthful note against a matched neutral note. F−O (orange): the same value as the agent’s own completed action, against the unedited record. The grey band spans the two marks; the black mark is their gap, D = (T−N) − (F−O). The T−O and F−N rows compare each edit against the other edit’s comparator; the bottom row is the control N−O. Hollow marks an interval that includes zero. Recovery on the look-ahead targets; 95% task-cluster bootstrap intervals.
Figure 3: A success receipt’s effect flips sign with the world on AppWorld. Each point is the success receipt minus the failure receipt on whole-task success, with the database step’s effect independently absent or present; the arrow is their in- teraction, read at 97.5%. 95% task-family bootstrap intervals on the two effects; 1,040 continuations over 65 task families, pooled over gpt-5.5 and claude-sonnet-5. Per receiver: Fig- ure 4; cell means: Figure S1.

Limitations and Future Work

  • Bundled Variables: The "truthful note" differs from the "falsified record" in several ways: the apparent author (user vs. agent), the placement, and the explicit mention of an error. Future work could disentangle these "role effects."
  • Receipt Content: In the AppWorld experiments, success and failure receipts differed in their text content, not just their truth value.
  • Automated Policies: This study used manual, controlled edits. Testing how automated history-cleaning policies (like LLM-based summarizers) behave when they accidentally introduce world-record disagreements is a vital next step.
  • Model Specificity: While the results held across most high-end models (GPT-4o, Claude 3.5 Sonnet), smaller models like GPT-4o-mini showed less consistent behavior, suggesting that "trusting the record" might be a capability that emerges with scale.

Summary updated

Abstract

Tool-using language-model agents accumulate histories of their own mistakes, and a system that compacts, repairs or hands off such a history decides what it says about those mistakes while their effects stay in the world. Prior work cleans the history at a fixed world, where showing a corrected step and saying it is done move together. We ask whether the same correct content helps or hurts depending on how the history states it and what the world holds. We freeze an agent mid-task with its exact world state, edit the history or the world, and let a receiver model continue. On AgentCE-Bench, after the agent commits a wrong value, we hold the world fixed and add the correct value by two natural edits: a truthful note beside the preserved error or the agent's own completed action. The note raises recovery, the share of remaining targets the receiver gets right, from 51% under a matched neutral note to 66%. The completed action lowers it below the unedited history, from 50% to 44%, so the value's presence alone does not predict the effect. On AppWorld, after a database write, we vary whether its receipt reports success or failure and whether its effect is present. A success receipt lowers whole-task success from 45% to 28% while the effect is absent and raises it from 38% to 49% once present. The two effects differ by 27 points pooled over two receivers, a difference positive in six of eight receivers at 97.5% and seven at 95%. A history edit's effect thus depends on the world it describes, and a history made to look clean while the world still holds the error can leave an agent worse off than no edit at all.
BibTeX
@misc{pakhomov2026cleaning,
  author = {Egor Pakhomov and Anurag Koul and Hongjun Liu and Bo Pang and Shafiq Joty and Erik Nijkamp},
  title = {{Cleaning an Agent's History Hurts When the World Still Holds the Error}},
  year = {2026},
  eprint = {2611.14654},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.14654},
}
Figure