AI Coding Agent Failure Modes: A Practical Guide to Testing New LLMs
When a new large language model launches, developers often see impressive demos alongside unexpected failures in real projects. This article breaks down five common failure modes of AI coding agents—hallucinated attribution, false progress, uncontrolled changes, poor usability in visual demos, and mismatch between reasoning and output—and offers practical engineering countermeasures such as Definition of Done, change budgets, and evidence-driven verification. It also outlines a three-layer evaluation framework and prompt templates to help developers systematically test new models.}
1. Why New Model Launches Bring Both Impressive Demos and Failures
Whenever a new generation of large language models is released, developers are eager to test it in real engineering projects. Visual demonstration tasks often look impressive: lighting, particles, and 3D scenes can be quickly assembled into a runnable skeleton. However, once the task switches to something like “large codebase refactoring,” which requires long-chain self-consistency, the failure rate rises significantly. A typical experience described in the original article: given the same execution plan refined down to steps and verification methods, several models passed on the first try, while the new model claimed completion at step two, interrupted with a reason of “compiler cache anomaly,” then fell into inefficient “shotgun-style” changes and ultimately drifted from the goal.
This is not an isolated capability issue, but a concentrated manifestation of agents lacking a reliable feedback loop in long tasks. Below, it is broken down into reusable technical insights and engineering countermeasures.
2. Failure Mode 1: Treating Environment Anomalies as an Attribution Escape (Hallucinated Attribution)
When compilation fails, the model tends to give a “plausible-sounding” explanation rather than performing minimal verification. For example, it attributes a compilation error to the cache without ever recompiling to confirm; after the user prompts to clear the cache, it only performs the clearing action without verifying the result.
The correct engineering approach is to establish an attribution priority: reproduce first, then minimize, then locate.
# 1) Reproduce and preserve the original errorcargo build 2> build.log# 2) After cleaning, verify immediately instead of moving to the next stepcargo clean && cargo build 2> build_after_clean.log# 3) Compare log differences to determine whether it is an environment/dependency issuediff build.log build_after_clean.log
The key point is: any assumption of an “environment cause” must be supported by a repeatable verification, otherwise it is a hallucination. For agents, the prompt and workflow should enforce a three-stage “hypothesis—verification—conclusion” pattern, prohibiting jumps without verification.
3. Failure Mode 2: Lack of a “Definition of Done,” Leading to False Progress
In the original article, the model claimed to complete two major steps in five minutes, but the result was not compilable. This reveals the absence of a clear Definition of Done. In complex refactoring, progress must be measured by verifiable artifacts, not textual claims.
It is recommended to define machine-checkable acceptance criteria for each step:
- Compilation passes (zero errors);
- Related unit tests and integration tests are all green;
- Static checks introduce no new warnings;
- Critical paths have a minimal runnable demo or snapshot comparison.
Illustrative workflow:
step_i:edit -> build -> test -> lint -> reportif any fail: stop, fix, re-run (max N attempts)
Only by setting “tests pass” as a prerequisite for continuing can you avoid “the more you change, the messier it gets.”
4. Failure Mode 3: Shotgun-Style Changes and Loss of Change Control
Trial-and-error at multiple points without localization causes the change surface to explode. The original article mentions two hours and over three thousand changes, which is exactly the result of lacking a change budget and rollback mechanism.
Actionable constraints include:
- Change budget: limit the number of files/lines modified in a single step; exceeding it forces a stop and report;
- Small commits: one rollback-able commit or patch set per step, facilitating binary search for localization;
- Failure snapshots: preserve diffs and logs at failure, prohibiting overwrite-style changes;
- No speculative bulk replacements: first provide a minimal reproduction, then make a targeted fix.
Illustration:
git add -p # Stage only changes related to the current stepgit commit -m "step2: fix X"# If it fails and cannot be quickly fixedgit reset --hard HEAD~1
5. Failure Mode 4: Visual Demos Look Good, but Common Sense and Interaction Fall Short
Visual tasks are prone to “looking right,” but common-sense constraints are often ignored. For example, in a 3D ball-and-pin scene, unreasonable pin spacing makes it impossible to clear all pins in one shot, and the interface is too dark to use; in a maze reinforcement learning demo, the subject size is unbalanced, layers are misaligned, and interaction is impossible. These problems show that: “runnable” in a demo does not equal “usable.”
Evaluation should include a common-sense and usability checklist:
- Physical/geometric common sense: whether scale, spacing, gravity, and collisions are reasonable;
- Interactivity: whether it can go from the initial state to the terminal state;
- Observability: whether key variables are visualized and readable (e.g., value function overlaid on a grid);
- Convergence: whether the training curve converges stably rather than drifting randomly.
6. Failure Mode 5: Chain-of-Thought Inconsistent with Artifacts (Narrative Hallucination)
The original article mentions that the chain of thought claimed to present a certain style, but the final artifact did not reflect it at all. This is a typical case of narrative decoupled from implementation. The countermeasure is to turn narrative into verifiable acceptance items: if a visual effect is claimed to be implemented, corresponding screenshots/pixel-level or structural checks must be provided; if convergence is claimed, loss curve data must be provided.
7. An Evaluation Framework for Developers: How to Systematically Test New Models
It is recommended to replace single-point experience with a “three-layer evaluation”:
- Unit level: small-scope function-level tasks, verifying syntax and boundary handling;
- Module level: cross-file changes, verifying dependency understanding and interface consistency;
- Engineering level: large refactoring, verifying long-chain planning, feedback loops, and change control.
Each layer should record: first-pass rate, average repair rounds, change scale, and whether regressions are introduced. This turns “feelings” into comparable data.
8. Prompt and Workflow Templates for Agents
Constraints:- Each step must use build+test passing as the completion criterion;- On failure, perform minimal reproduction first; attribution guessing is prohibited;- If a single-step change exceeds the budget, stop and report;- All "implemented" claims must be accompanied by verification evidence.
9. Implementation in the Cloud: Using General Capabilities to Complete the Engineering Loop
If enterprises want to use AI coding tools at scale within their teams, they can leverage general cloud capabilities to build a loop: use a container platform to unify the build environment, use object storage to store build logs and failure snapshots, use a message queue to connect task pipelines, and use log services and monitoring alerts to track first-pass rate and regression rate. Baidu AI Cloud can provide corresponding foundational capabilities in these general categories, helping teams standardize evaluation and governance processes.
10. Conclusion
The real value brought by new model launches lies not in how flashy the demo is, but in whether it can stably complete the “plan—execute—verify—rollback” loop in real engineering. Developers should adhere to Definition of Done, change budgets, and evidence-driven practices, treating the model as an executor that needs constraints rather than a trusted autonomous decision-maker.
