智能工具库

Your coding agent shouldn't grade its own homework

Your coding agent shouldn't grade its own homework
I lead an engineering team of eight at Momentic that has eagerly adopted background agents. My team frequently awes at the raw intelligence of these f
0来源:Stack Overflow Blog

本文由「Your coding agent shouldn't grade its own homework」的公开内容整理,完整内容与后续更新请点击文末链接阅读原文。

I lead an engineering team of eight at Momentic that has eagerly adopted background agents. My team frequently awes at the raw intelligence of these frontier models, but they also often complain that their agents will confidently declare that a feature was complete, only for basic functionality to fail when they opened the application for testing.The problem isn't just that agents make mistakes. It's that their own verification often fails to catch them, leading to overconfidence.Concretely, our engineering team has found three recurring problems: agents rely on shallow checks, inherit their own implementation blind spots, and become less reliable under the combined pressure of growing context and repeated failures.1. Shallow checksCoding agents gravitate toward checks that are easy to write and easy to pass. That usually means unit tests.Unit tests have their place, but a green test suite doesn't necessarily mean the software works end to end.At Momentic, we recently conducted a human-reviewed audit of 1,000 AI-authored unit tests in our monorepo. The result: only 9.6% were useful verification checks.The remaining 90.4% provided little meaningful value. Nearly a third were low-consequence tests checking basic argument passing or formatting. Another 22.8% duplicated existing coverage, while 22.4% relied excessively on mocking that poorly reflected production behavior.Figure 1: AI-authored unit testsOur findings aren't isolated. In a recent experiment, AI researcher Kun Chen compared coding agents allowed to write their own tests against agents explicitly prohibited from doing so.Across 111 coding tasks, the agents that wrote tests achieved a 65.3% success rate, compared with 66.2% for those that didn't.This doesn't mean unit tests are useless in general. It means an agent can author massive volumes of unit tests, get seemingly reassuring results, and still fail to verify the behavior that matters.2. Shared blind spotsWhen an engineer writes a feature, they first form an understanding of what needs to be built. They then make implementation decisions based on that understanding.On the surface, coding agents work similarly. The problem is that when they write their own tests, those tests reflect the same, possibly erroneous, assumptions that went into the implementation in the first place.For example, suppose you ask an agent to build a rich text editor. It implements bold, italic and, underline formatting, then creates tests for those buttons.But perhaps you never specified that the undo button should also undo any applied formatting. Even though this makes natural sense to humans, if those scenarios weren't explicitly considered in the initial prompting, there's a good chance they won't appear in the agent's tests either.To that point, a 2026 study on coding-agent verification found that tests agents wrote for their own patches often accepted incorrect implementations.So the problem isn't that agents can't write valid tests. It's that they often test what they built, rather than what they should have built.3. Completion pressureModern coding agents run autonomously for hours. During that time, they accumulate enormous amounts of context: source files, terminal output, screenshots, debugging logs, and so on.This creates another problem. The longer an agent works on a task, the harder it can become to distinguish the original requirements from all the decisions made along the way. And although agents can compact their context, the original material can never be preserved with perfect fidelity.Chroma's 2025 Context Rot study evaluated 18 LLMs and found that performance deteriorated dramatically as context grew. In one experiment, Claude Sonnet 4's accuracy dropped from 89% to just 38% when context increased from 300 to 113,000 tokens.Anthropic has done its own research on the topic as well.In a study conducted this April, Anthropic gave Claude Sonnet 4.5 coding tasks with impossible requirements. Researchers isolated a certain "d

A horizontal bar chart analyzing 1,000 AI-authored unit tests, showing that only 9.6% are categorized as

本文基于 Stack Overflow Blog 的公开内容,由 AI 辅助整理改写后发布。

原标题:Your coding agent shouldn't grade its own homework

阅读原文