Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
fix context rotAI agent self-conditioningcontext pruning

Context Rot in 2025: Which AI Agent Failures Are Still Real?

Hands-on tests across Qwen and Gemini models reveal which context-rot failures still break AI coding agents and which fixes actually work.

Edited by Luis Chavez-Mattos, Director of Product RSS
Context Rot in 2025: Which AI Agent Failures Are Still Real?

What is context rot in AI agents?

Context rot describes the way a long-running AI agent’s performance degrades as its context window fills up with files, tool outputs, logs, and its own notes. Even though frontier models now support huge context windows, a bigger window doesn’t guarantee the model keeps paying attention to the right things. Researchers have broken this degradation into five named failure modes: context poisoning, context distraction, context confusion, context clash, and self-conditioning. A hands-on test across Qwen models and Gemini 3 Flash found that most of these failures barely show up in modern models anymore. One, however, still broke every model tested.

TL;DR

  • Context rot is the general term for an agent’s accuracy dropping as its working memory fills with tool results, logs, and self-written notes, even when the actual task hasn’t changed.
  • Researchers have defined five distinct failure modes: context poisoning, context distraction, context confusion, context clash, and self-conditioning (trusting your own past work).
  • In controlled tests across two local Qwen models and Gemini 3 Flash, poisoning, distraction, clash, and tool confusion all passed cleanly, 15 out of 15 runs each, suggesting these specific failures are largely fixed in current models.
  • Self-conditioning was the one failure that still broke every model, with 0 out of 15 runs catching a bug the agent had silently introduced in its own earlier work.
  • The fix that actually worked wasn’t a better note or prompt, it was giving the agent outside evidence, like a canary deploy log showing real failures, which raised the fix rate to 10 out of 15 runs.
  • Compaction (summarizing history) didn’t fix any failures in these tests, but it cut prompt tokens by 23x to 59x, meaning its real value right now is cost reduction, not correctness.
  • Pruning old context breaks prompt caching, and cached tokens can run roughly 10 times cheaper, so pruning should happen at clear task boundaries rather than on every single step.
› Build a safety-inspection app for 60 plants.
already included:✓ SOC 2✓ role-based access✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

What are the five failure modes, exactly?

The context window is everything a model reads before deciding its next action: the system prompt, the task, tool definitions, and a growing log of file contents, test outputs, and error messages. A task that starts as a few lines of instructions can balloon into a context holding hundreds of thousands of tokens after an hour of agent work. Researchers have identified five specific ways that growth causes problems.

Context poisoning happens when a wrong fact enters the window and the agent treats it as established truth from then on. If an agent misreads documentation and writes itself a note saying a new database driver “retries automatically,” it may later delete legitimate retry code because its own note told it the code was redundant. Google documented a real version of this in a Gemini agent playing Pokémon, where a bad goal note derailed the agent for a long stretch before it was corrected.

Context distraction is when the sheer size of the history starts to steer behavior. Language models continue patterns, so if the window is dominated by an hour of repetitive past actions, the agent may keep repeating that pattern (like reading “one more log file”) instead of asking what the task actually needs next. This is considered especially risky for smaller models.

Context confusion comes from tool definitions. Every connected tool adds its definition to the context whether or not the agent ever uses it. With hundreds of tools loaded, the agent has to pick correctly from an unnecessarily large set, raising the odds of calling the wrong one.

Context clash occurs when the window holds information that contradicts itself, such as an old wrong note sitting alongside its later correction. Research from Microsoft and Salesforce found that models perform noticeably worse when a request gets split across multiple turns, because they anchor on an early wrong answer and struggle to recover.

Self-conditioning, the least discussed of the five, is when a model sees its own earlier mistakes in its history and becomes more likely to repeat or build on them. In published research, one model’s accuracy fell below 50% within 15 turns even though it could execute each individual step almost perfectly, and simply using a larger model didn’t fix it (enabling extended “thinking” mode did, in that study).

Which context-rot failures still break models today?

To find out which of these five still matter for current frontier-class models, a test harness was built around a concrete coding task: migrating a small orders service to a new database driver that only makes a single connection attempt, meaning old retry-loop code needs to be preserved rather than deleted. Hidden tests, invisible to the agent, checked for the exact correct behavior, so the agent could pass every test it could see and still ship a bug.

Everyone else built a construction worker.
We built the contractor.

🦺
CODING AGENT
Types the code you tell it to.
One file at a time.
🧠
CONTRACTOR · REMY
Runs the entire build.
UI, API, database, deploy.

Each failure mode was deliberately injected into the context, and every setup ran five times across three models: two Qwen models running locally, and Gemini 3 Flash via API. In a clean baseline with no injected failure, every single run passed.

The results by failure mode:

  • Poisoning: a fabricated note claiming the new driver retries automatically was planted in context. All 15 runs across the three models kept the retry loop and passed. Trace review showed the agents re-reading the actual documentation, which overrode the planted note.
  • Clash: both the wrong note and its correction were left in context together. All 15 runs passed.
  • Distraction: the window was padded with roughly 145,000 tokens of the agent’s own past log reads before the real task began. All runs finished and passed except one case where a 27-billion-parameter model stopped early.
  • Tool confusion: up to 100 tools were added, including deliberate traps like a deprecated file writer that silently saves to a backup folder. All three models passed every run and rarely touched the trap tools.
  • Self-conditioning: the agent was seeded with two files it had supposedly already migrated itself, one of which quietly dropped the required retry loop. There was no wrong note to catch this time, just the agent’s own prior work sitting in history. Zero out of 15 runs across all three models caught the bug, even though most agents re-read documentation confirming the driver only makes one attempt.

Why does self-conditioning survive when the others don’t?

The pattern across the other four failures is that the agents could still check claims against something external, like the actual documentation or the actual set of available tools. That verification step broke the spell of bad notes, contradictory information, and distracting history.

Self-conditioning is different because there’s no external note to double-check. The “mistake” lives directly in code the agent already wrote and already trusts as its own finished output. Models treat their own past actions as the most credible thing in the context window, more credible than a plain text note, which makes a silent bug in prior work much harder to catch through re-reading or reasoning alone.

The fix that worked wasn’t a smarter prompt or a reminder to “double check your work.” It was adding a canary deploy log to the context, showing real failed requests during a database failover. With that outside evidence present, 10 out of 15 runs went back and fixed the retry loop. A note describing the same problem wasn’t available in this test, and no model version caught the issue through documentation review alone. Real evidence from the environment, not restated instructions, is what moved the result.

Is compaction or pruning still worth doing?

Based on these results, compaction and pruning aren’t solving correctness problems at these context sizes, since none of the five failures needed them to be fixed. But they still carry real value as cost controls. Adding compaction (summarizing history into a short handoff note) kept pass rates identical while cutting prompt tokens per run by somewhere between 23x and 59x depending on the model.

Developers have their tools. Enterprises have Remy.
Developers · AI coding tools
Claude Code
Codex
Cursor
GitHub Copilot
Enterprises · built into Remy
⌂Self-hosted
✓SOC 2
✚HIPAA
☰Audit log

Pruning old context comes with a tradeoff worth knowing: it breaks prompt caching, and cached tokens can be roughly 10 times cheaper than fresh ones. The practical takeaway is to prune at clear boundaries, such as the end of a completed subtask, rather than continuously on every step, to avoid giving up caching discounts for no accuracy gain.

What should you actually change in your agent setup?

Given how narrow the surviving failure mode is, the highest-value fix is making sure an agent has access to real evidence about code it has already written, not just its own notes about that code. That means behavioral tests the agent can’t see in advance, canary or staging logs showing actual runtime behavior, or a separate reviewer step that reads the diff with fresh eyes rather than trusting the implementing agent’s self-assessment.

It’s worth being clear about the limits of this kind of test: it covers one coding task, five runs per setup, and three models, so it’s a signal rather than a definitive benchmark. But the consistency of the pattern, four failure modes resolved and one unresolved across every single model tested, suggests self-conditioning deserves disproportionate attention when designing verification steps for autonomous coding agents.

Frequently Asked Questions

Is context rot still a real problem in 2025?

Partly. Hands-on testing across Qwen and Gemini 3 Flash found that context poisoning, context distraction, context clash, and context confusion (tool overload) no longer caused failures in a coding migration task. Self-conditioning, where an agent trusts its own earlier work, was the one failure mode that still broke every model tested.

What is self-conditioning in AI agents?

Self-conditioning is when a model sees its own prior actions or output in its context history and becomes more likely to repeat or build on mistakes contained in that work, because it treats its own past actions as highly trustworthy. Unlike a bad note, there’s no simple fact to verify, the error is embedded in code or output the agent already produced.

Does compaction fix context rot?

Not in the failures tested here. Compaction (summarizing history and continuing from the summary) kept the same pass rate as full history while cutting prompt tokens by 23x to 59x. It functions mainly as a cost optimization rather than a correctness fix, at least at the context sizes tested.

How do you fix an agent that trusts its own flawed work?

The approach that worked in testing was introducing outside evidence rather than more self-review: a canary deploy log showing real failures raised the catch rate from 0 out of 15 runs to 10 out of 15. Practical equivalents include hidden behavioral tests, staging or production logs, and independent reviewer passes over a diff.

Does pruning context hurt performance or cost?

Pruning can increase cost indirectly because it breaks prompt caching, and cached tokens can be around 10 times cheaper than uncached ones. The suggested approach is to prune at natural task boundaries, like the end of a subtask, rather than continuously after every step.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.