AI Coding Agent Evaluation: The Most Expensive Option Is Not the Strongest

    This article presents a two-stage evaluation of mainstream AI coding agents, separating first-pass code generation from multi-round debugging. It shows why strong generation scores often collapse on bug-fixing tasks, why debug gain matters more than first-pass success, and why higher pricing does not guarantee better end-to-end results. It also outlines practical engineering recommendations, including mandatory regression checks, diff size limits, layered context supply, reusable evaluation sets, and clear human-AI division of labor.

    1. Why “Can Write Code” Does Not Mean “Can Modify Code”

    In real software delivery, coding is only one part of the workflow. Requirement clarification, solution design, implementation, defect localization, regression verification, and post-release observation form a closed loop. Over the past two years, AI coding tools have made significant progress at generating functional code from scratch. As a result, many teams still evaluate these tools at that level only: whether the first generated version passes, how much code is produced, and whether the cost per call is low enough.

    Problems appear once these tools are connected to an existing codebase. A pattern observed repeatedly is that the same tool may score highly on writing new features, but its score drops noticeably when the task shifts to fixing existing defects. In some cases, the result is even worse than the baseline of making no changes at all. In other words, the code after modification is worse than before.

    This behavior is similar to a new engineer with uneven skills: productive and fast when building a new module, but likely to change unrelated logic and introduce new issues when touching production code. The difference is that a new engineer is protected by code review and tests, while an unconstrained tool can push damage directly into the main branch.

    2. Evaluation Method: Separate Generation from Debugging

    To make the conclusions credible, the evaluation design must reflect engineering reality. This horizontal evaluation covered more than ten mainstream AI coding solutions. All of them ran on the same repository snapshot, with the same task descriptions and the same acceptance scripts. The design has three key points.

    First, two-stage scoring. Stage one evaluates first-pass generation only: given a requirement, the tool must produce code that passes acceptance in one attempt, and the pass rate is recorded. Stage two allows the tool to read runtime results, error logs, and failing test cases, perform multiple rounds of debugging, and then records the pass rate again. The difference between the two stages is the “debug gain.”

    Second, a no-change baseline. For defect-fixing tasks, the pass rate with no modification is also measured as a reference. Only when the result is higher than this baseline can the modification be considered a positive gain.

    Third, controlled variables. Context window strategy, maximum iteration rounds, and whether test execution is allowed are unified to avoid mistaking toolchain differences for model capability differences.

    A simplified evaluation flow can be described as follows:

    1. def evaluate(agent, repo, task, max_rounds=5):
    2. # Stage 1: first-pass generation
    3. patch = agent.generate(repo, task)
    4. score_first = run_acceptance(repo, patch, task)
    5. # Baseline: no changes
    6. baseline = run_acceptance(repo, [], task)
    7. # Stage 2: iterate with failure feedback
    8. for _ in range(max_rounds):
    9. if score_first >= task.full_score:
    10. break
    11. feedback = collect_logs_and_failures(repo, patch, task)
    12. patch = agent.debug(repo, task, feedback)
    13. score_first = run_acceptance(repo, patch, task)
    14. return {
    15. "first_round": score_first,
    16. "after_debug": score_first,
    17. "baseline": baseline,
    18. "debug_gain": score_first - baseline,
    19. }

    3. Key Finding 1: Strong at Generation, Weak at Repair

    The most notable signal in the evaluation is the gap between first-pass generation and post-debugging performance. Some solutions rank at the top when used directly for code generation, but their scores fall by more than ten percentage points in defect-fixing scenarios. Some even end up more than ten percentage points below the no-change baseline, which means negative gain.

    This is not an isolated case but a common constraint of the current technical approach. There are roughly three root causes.

    First, context localization is difficult. Fixing a defect requires locating the real cause across a large number of files, while generating new code only requires completion at a given location. If the localization is wrong, even elegant code will miss the target.

    Second, the principle of minimal changes is hard to enforce automatically. Models tend to “optimize along the way,” reordering structures, replacing patterns, and renaming identifiers. This makes the diff much larger than necessary, increases review cost, and amplifies regression risk.

    Third, there is a lack of awareness of implicit contracts in existing code. Legacy code often contains conventions that are not written in comments: field meanings, call order, idempotency requirements, and compatibility branches. If the tool cannot see these constraints, it may overwrite critical logic with a more “modern” style.

    4. Key Finding 2: Debugging Ability Is the Real Dividing Line

    Another group of solutions shows the opposite pattern: first-pass pass rates are not outstanding and may even be below the leading solutions, but after being allowed to read runtime feedback, their pass rates rise to the highest among all solutions, with an improvement of more than ten percentage points.

    This shows that judging AI coding tools by first-pass pass rate alone can be seriously misleading. In real projects, code is almost never correct on the first attempt. The value lies more in whether the tool can converge based on failure information. High debug gain means the tool has three underlying capabilities: it can read stack traces and logs and locate the exact statement; it can distinguish symptoms from root causes instead of repeatedly patching the wrong place; and it can verify changes after modification instead of submitting an unverified guess.

    A practical criterion is to treat debug gain, defined as post-debug pass rate minus the no-change baseline, as the primary metric, first-pass pass rate as the secondary metric, and cost per task plus average iteration rounds as constraints. Only the combination of these three approximates real engineering value.

    5. Key Finding 3: Price and Capability Are Not Positively Correlated

    The evaluation also measured the overall cost per task, and the conclusion is straightforward: the most expensive solution did not achieve the best overall performance. Some high-priced solutions even had negative gain on repair tasks, while some lower-cost solutions performed better in end-to-end completion thanks to stable debugging convergence.

    The reason is not hard to understand. High-priced solutions billed by usage or seats often consume more on long contexts and multi-round reasoning. If the task is mainly small-step modification, this overhead is wasted. In contrast, a lower-priced solution with fewer iterations and a reasonable first-pass hit rate can achieve lower total cost. Therefore, selection should be based on the end-to-end cost of completing the same batch of tasks, not the unit price.

    6. Engineering Recommendations

    First, make regression verification a mandatory step. Any change produced by a tool must pass unit tests, static checks, and key-path integration tests. If it fails, roll it back. Do not allow “sick code” to be merged.

    Second, constrain diff size. Task descriptions should explicitly require changing only necessary lines and prohibit unrelated refactoring. The review pipeline should also alert when the change scale exceeds a threshold.

    Third, provide layered context. Do not send the entire repository to the model at once. Instead, trim the context by call chain, related tests, interface definitions, and historical defect records. This significantly improves localization accuracy and reduces cost.

    Fourth, build a reusable evaluation set. Turn the team’s historical defects into a fixed task set and run the two-stage evaluation every time the tool or model changes. Use data rather than impressions to make decisions.

    Fifth, clarify the division of labor between humans and AI. Let the tool handle deterministic work such as boilerplate code, unit test completion, and initial log screening, while leaving architecture trade-offs and implicit contract judgments to humans. When conditions allow, general capabilities such as container platforms, log services, and monitoring alerts on Baidu AI Cloud can be used to turn evaluation and regression workflows into observable and measurable automated pipelines.

    7. Conclusion

    “The most expensive is not the strongest” is not a joke but a selection reminder based on evaluation data. The value of AI coding tools is shifting from “whether it can write code” to “whether it can modify correctly and verify.” For teams, the right path to turn these tools into real delivery efficiency is to establish a two-stage, baseline-based evaluation standard, combined with minimal-change constraints and mandatory regression.