AI coding agents can produce detailed, plausible implementation plans, yet often fail to deliver working code changes. The core reason is that planning is a text-generation task, while delivering a working change requires precise, context-aware modification of a live codebase, and agents frequently lack the full, current state of that codebase, its dependencies, and the unspoken conventions of the project.
The Gap Between Plan and Execution
An AI coding agent typically works in two phases. First, it reads the user’s request and generates a step-by-step plan: which files to modify, what functions to add, and how to test the result. This plan is essentially a summary of what the model believes should happen, based on its training data and the files it has seen. Second, it attempts to execute that plan by editing files, running commands, and checking outputs. The failure occurs when the plan is internally coherent but does not match the actual codebase. For example, the agent might plan to call a function format_date() that exists in its training data, but the project actually uses to_display_string(). The plan looks perfect on paper, but the executed change breaks the build.
Another common failure is that the agent’s plan is based on a partial understanding of the codebase. It may only have read the file it was told to modify, not the entire module, the test suite, or the configuration files. A change that seems isolated in the plan can have ripple effects—a renamed variable in one file breaks an import in another, or a new dependency isn’t added to the package manifest. The plan doesn’t account for these because the agent never saw them.
Context Window Limits and Information Loss
Modern AI models have a finite context window—the amount of text they can process at once. Large projects have thousands of files, and even a single file can exceed the context limit if it’s long. Agents use techniques like retrieval (searching for relevant files) and summarization to work around this, but both lose information. Retrieval might miss a crucial file because the search query doesn’t match its name. Summarization compresses a file’s contents into a few bullet points, losing the exact variable names, edge cases, and comments that matter for a correct edit.
When the agent plans, it works from this incomplete, compressed view. The plan is a reasonable inference from what it knows, but it’s not a blueprint of the actual code. When execution starts, the agent may try to apply a change that contradicts a detail it never saw—like a function that’s already defined elsewhere, or a constant that’s used in a test. The result is a diff that looks right in isolation but fails when the project is built or tested.
Ambiguity in Natural Language Requirements
Human requests are rarely precise. “Make the login faster” could mean optimize the database query, add caching, or reduce the number of network calls. The agent must interpret the intent, and its interpretation is a guess. The plan reflects that guess, but the user might have meant something entirely different. Even when the request is specific, it often contains implicit assumptions: “update the user profile page” assumes the agent knows where that page is, what fields it has, and how the backend API is structured. If the agent’s plan assumes a different API endpoint or a different data model, the delivered change won’t work.
This ambiguity is compounded by the fact that agents don’t ask clarifying questions as readily as a human developer would. They are trained to produce an answer, not to probe for missing information. So they generate a plan based on their best guess, and that guess is often wrong in ways that only become apparent when the change is tested.
Testing and Verification Are Weak Points
A working change is one that passes tests and doesn’t introduce regressions. AI agents are poor at writing and running tests for several reasons. First, they may not know the project’s test framework or how to run a single test. Second, they often don’t have a reliable way to execute code in the project’s environment—they might be sandboxed, lack the right dependencies, or not have permission to run commands. Third, even when they can run tests, they may not interpret the output correctly. A test failure might be due to the agent’s change, but it could also be a pre-existing failure or an environment issue. The agent’s plan rarely includes a robust verification step, so it delivers a change that “looks done” but hasn’t been proven to work.
For example, an agent might add a new function and write a unit test for it, but the test fails because the function returns a string when the test expects an integer. The agent might not even run the test—it just assumes the code is correct because it matches the plan. The user is left with a change that compiles but fails at runtime.
Common Problems and Typical Failure Modes
- Incorrect file paths: The agent plans to edit
src/utils/helper.jsbut the file is actuallylib/helper.js, so the edit is applied to the wrong place or not at all. - Missing imports or dependencies: The plan adds a new library but doesn’t update
package.jsonorrequirements.txt, so the code fails on import. - Breaking existing functionality: The agent changes a function’s signature to suit its plan, but other parts of the codebase still call the old signature, causing errors.
- Assuming a clean state: The plan assumes the codebase is in a known state, but there are uncommitted changes, merge conflicts, or a different branch checked out, leading to conflicts.
- Overfitting to the plan: The agent becomes so focused on following its own plan that it ignores error messages or test failures that indicate the plan is wrong.
Why Human Developers Succeed Where Agents Fail
Human developers have several advantages that current AI agents lack. They can see the entire codebase at once, or at least navigate it quickly. They understand the project’s history—why a certain function exists, what a comment means, which parts are legacy. They can run the code, see the error, and iterate. They can ask clarifying questions. They can also make judgment calls about trade-offs: is it better to refactor this module or just add a quick fix? Agents, by contrast, are often single-shot: they generate a plan, execute it, and stop. They don’t have the same ability to step back, reassess, and try a different approach when the first one fails.
Another key difference is that humans understand the intent behind the code. A plan to “add a new field to the user model” is trivial for a human who knows the model is in models/user.py and that the database migration needs to be updated too. An agent might only see the model file and miss the migration, the API serializer, and the frontend form. The plan is incomplete because the agent doesn’t have the mental model of the system that a human developer builds over time.
How to Improve the Chances of Success
There are practical steps to get better results from AI coding agents. First, provide as much context as possible: point to the exact files, describe the expected behavior, and mention any constraints. Second, break a large task into smaller, incremental changes. A plan to “add a login system” is more likely to fail than a series of plans to “create a user table,” “add a registration endpoint,” and “build a login form.” Third, ask the agent to run tests after each change and to report the output. Fourth, review the plan critically before letting the agent execute it—if the plan mentions files or functions you know don’t exist, correct it. Finally, use agents that can iterate: ones that can see test failures and attempt to fix them, rather than giving up after the first attempt.
It’s also important to set realistic expectations. AI coding agents are best for well-defined, isolated tasks like “rename this variable” or “add a unit test for this function.” They are much less reliable for large, ambiguous, or cross-cutting changes. For those, a human developer is still necessary to guide the process and verify the result.
Frequently Asked Questions
Why does the agent’s plan look so good but the result is broken?
The plan is generated from a model that has seen many codebases and can mimic the style of a good plan, but it doesn’t have the full state of your project. It may miss a file, misunderstand a dependency, or assume a function exists when it doesn’t. The plan is a plausible story, not a verified blueprint.
Can I trust an AI coding agent to make a change without me reviewing it?
Not for anything beyond trivial edits. Even a simple change can break a test or a build. Always review the diff, run the tests yourself, and check the changed behavior in a real environment. Treat the agent’s output as a suggestion, not a finished product.
Why does the agent sometimes edit the wrong file?
This usually happens because the agent’s retrieval step didn’t find the right file, or because it matched a similar name from its training data. It may also be that the file path is ambiguous or the project has multiple files with similar names. Providing the exact path in your request reduces this risk.
What’s the best way to give the agent context?
Include the file paths, relevant code snippets, and a description of the expected behavior. If possible, mention the test framework and how to run a specific test. The more structured and explicit your input, the better the agent’s plan will match reality.
Are there tasks that AI coding agents simply can’t do?
Yes. Tasks that require deep architectural understanding, like refactoring a large module for performance, or tasks that involve subjective judgment, like choosing between two design patterns, are beyond current agents. They also struggle with tasks that require knowledge of external systems, like a proprietary API that isn’t in their training data.
Will these issues improve with newer models?
Some will, as models get larger context windows and better tool use. But the fundamental issue—that the agent doesn’t have a complete, live understanding of your codebase—will persist. Tools that integrate directly with your IDE and can read the entire project, run tests, and see errors in real time are more promising than standalone chat-based agents.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Steam Tags & Screenshots: Reaching the Right Players
- Leather vs Faux Leather: Which Is Better for a Matching Set?133.33 USD/year
- Pascal Programming on Raspberry Pi: Setup & Code
- Glass vs Plastic Food Storage: Which Is Better?2.00 USD/year
- Ridgid Nuke vs Brushless: When Is Extra Power Worth It?
- GGUF vs EXL2: Which Local LLM Format Should You Use?