AImunk
NewsBy Oliver Hayes6 min read

Does AI-written code make a codebase fragile?

Not by nature, but often by volume. Studies find more issues in AI-written changes, issues that linger after merge, and code review slowing as AI output grows. Some evidence cuts the other way: AI-written tests can match human ones. The fix is small changes, real test checks and time for reviewers.

Source: fion.ac/jellyfish.pdf

AI-written code makes a codebase fragile when it arrives faster than the team can check it, and the measured evidence says that is what often happens in practice. The studies that count defects find more issues in AI-written changes, and the best large study of real companies finds the strain landing on code review. Some evidence points the other way, though, and that matters for what you do next.

As a test engineer, I am not too concerned with whether AI-generated code looks pretty. I care whether anyone can tell when it breaks. That is the lens for everything below.

The claim that started the argument

Evan Merz's post "AI usage generates a fragile codebase", published on 7 November, gives four reasons AI-heavy codebases get brittle: shallow tests, over-built code, fewer people who understand the system, and pull requests arriving faster than anyone can read them. He also describes incidents piling up where he works.

It is a well-written post, and a lot of it will ring true to anyone who reviews code. But it is one engineer's experience, with no counts and no comparison group. The useful question is which parts of it the measured studies back up.

What the Harvard study actually measured

The strongest evidence is a working paper by Fiona Chen and James Stratton at Harvard, "Artificial Intelligence in the Firm: Bottlenecks in Software Production". The current version, dated 19 November 2026, uses data from the engineering analytics firm Jellyfish covering 720,542 workers at 655 firms from January 2021 to August 2026. It compares firms before and after they adopted AI tools, using differences in when each firm adopted them.

The headline is that code went up a lot and finished work went up much less. After firms adopted AI coding agents, lines of code rose 44.0%, commits 36.0% and pull requests 35.7%. Resolved Jira issues, the closest thing to shipped work, rose 13.7%, and the authors call that effect only borderline significant.

The bottleneck they found is review. After agents arrived, the time from a change being submitted for review to being merged rose 56.1%. The share of changes getting at least one review comment rose 13.1%, and comments per change rose 38.6%. AI review tools did not clear the queue: 79.1% of firms had adopted one, yet humans still wrote the overwhelming majority of reviews and comments.

The paper's own model also assumes AI lowers the quality of code entering review, so each change takes more effort to check. One engineer interviewed for the paper described new rules requiring senior sign-off for AI-generated code after outages caused by AI commits. That is a single interview, not a measured outage rate, but it is the same story Merz tells.

A note on versions. ComplexDiscovery's October write-up of an earlier draft reported time to merge up 49% and formal change requests nearly doubling. The November version gives different figures. The direction is the same, but quote the version you actually read. ComplexDiscovery also points out that Jellyfish has a commercial interest and a partnership with the authors, and that the paper had not been through peer review.

What the Harvard study does not measure is bugs. It shows review getting slower and heavier. It does not show production breaking more often. For that, you need other studies.

The studies that count defects

CodeRabbit, which sells AI code review, compared 470 open-source pull requests in a December 2025 report. AI co-authored pull requests averaged 10.83 issues against 6.45 for human-only ones. Logic and correctness problems were 75% more common, and security issues up to 2.74 times higher. The authors admit they could not confirm authorship directly, so some "human" pull requests may have had AI help.

A larger academic study, "Debt Behind the AI Boom" by Yue Liu, David Lo and colleagues, followed 302.6k verified AI-authored commits across 6,299 GitHub repositories. Between 7.5% and 14.8% of each assistant's commits introduced at least one issue, and 89.3% of the issues found were code smells rather than outright bugs. The number that matters for fragility is persistence: 22.7% of the AI-introduced issues they tracked were still in the latest version of the code. Debt that goes unpaid is exactly what makes a codebase brittle.

A third paper looked at 1,210 merged bug-fix pull requests written by coding agents in Python projects. In my opinion, its conclusion belongs on every developer's wall: merge success does not reliably reflect post-merge code quality. The same paper found that differences between agents mostly vanished once you adjusted for how much code each change touched. Bigger changes carry more problems, whoever writes them.

The vendor surveys go further, but they are less credible. Cortex's 2026 benchmark reported incidents per pull request up 23.5% and change failure rates up about 30%, alongside pull requests per author up 20%. Its blog describes a survey of over 50 engineering leaders and does not explain how the metrics were collected, so I treat it as a signal, not a measurement.

The evidence that cuts the other way

The most surprising result, to me, is about tests, the very thing Merz says AI does worst. Douglas Leith scored hundreds of real tests from Django and Pandas using fault injection and a design rubric, and found that tests written by recent Claude models were no weaker than the human-written ones. That is one preprint on two Python projects. However, it measured test strength directly, and it does not support "AI only writes trivial tests" as a general rule.

Code size is another twist. A September preprint comparing 787,562 pairs of human and AI functions found the AI versions about half as large and as branched as the human code. The security picture split by language: more findings, and more severe ones, in Python and Java, but fewer high-severity memory-safety findings than humans in C. Whether "AI code is worse" depends on what you are writing.

Google's 2025 DORA report, based on nearly 5,000 professionals, describes AI as a "mirror and a multiplier". It found AI adoption linked to higher delivery throughput, and 59% of respondents said AI had improved code quality. That is self-reported, and 30% said they had little or no trust in AI-generated code. Still, the framing fits the rest of the evidence: teams with good habits get faster, and teams with weak ones get their weaknesses amplified.

The PHP2Shell story is about old code, not new

The IEEE Spectrum piece in this debate is easy to misread. PHP2Shell was a critical flaw in PHP itself, found by a researcher at the security firm Calif who was aided by AI tools. The underlying bug had been reported back in 2024 but was treated as a plain crash. AI did not write the weakness. It helped find and exploit one that humans had left in place.

The PHP Foundation's own write-up shows the side effect. It rated the flaws 9.2 on the CVSS scale and said AI-assisted research had raised the volume of reports, with more than 100 reports that were invalid, duplicates or could not be reproduced. A person still makes every decision and works on every patch.

This, to me, is the real link to fragility. If AI makes weaknesses cheaper to find, then every bug in any codebase, human or AI-written, is worth more to an attacker. Code that piles up unreviewed debt becomes riskier faster than it used to.

What to do with this

Put together, the evidence says AI code is not fragile by nature, but it is fragile by volume. More code arrives, review slows down, issues persist, and a merge is a poor signal that a change is sound. Banning the tools does not fix any of that. Moving effort to where the bottleneck now sits does.

In practice, that means keeping AI pull requests small, since issue counts track change size. It means judging tests by whether they catch injected faults rather than by line coverage, which works whether a person or an agent wrote them. It means tracking how long changes wait for review and how many issues survive merging, not just how many pull requests you ship. And it means giving reviewers time, because the Harvard data suggests that is now the scarce resource.

The one thing I would not do is assume a green merge means a safe change. The studies above say it does not.

AI helped draft this from the source linked below, and a person checked it against that source before publishing.

Report

9 replies

Ankit YadavSeeker

"Merge success does not reliably reflect post-merge code quality." I would stop reading there, because that sentence makes the case for human review on every AI change by itself.

People read the Harvard number, review time up 56.1%, as a problem to remove. I read it as the bill for the extra code. If code volume goes up and review time does not, something went through unread.

So my rule is plain. An agent can write it. A person who understands the system signs it. No exceptions for "routine", because nobody labels the dangerous change as dangerous in advance.

Report

A rule like "no exceptions" suits a team with spare reviewers. The article describes a world where reviewers are the scarce part.

By its own figures, 79.1% of firms adopted an AI review tool and humans still wrote most of the reviews. So the plan on offer is: more code, the same people, and a rule that they must read all of it. That does not give you careful review. It gives you tired review, which is the kind that approves things.

I would rather spend human attention where it counts. Let a well-tested agent land the routine change, and judge its tests by whether they catch injected faults, which the article says works whoever wrote them. Then put the people on the changes that touch money, data or security. A reviewer who has read forty renames is not sharper for the forty-first change.

I can't argue with "tired review is the kind that approves things", so part of this I accept. The article says issue counts track the size of a change. A small, dull change with strong tests is a different animal, and I can live with a lighter check there.

The rest I keep. "Routine" is a label the author of the change picks, and the author is now the agent. Somebody who knows the system still has to decide what counts as routine, and that decision is review whatever you call it.

89.3% of the issues in the large commit study were code smells, not outright bugs. I think this thread is arguing as if every AI change carries a live defect, and the article does not say that.

It also says the Harvard study does not measure bugs at all. It shows review getting slower, not production breaking more. So I would be careful with the word "fragile". The figure that worries me is the other one: 22.7% of those issues were still in the latest version. Smells that nobody cleans up are how routine changes stop being routine.

Reply to Ankit Yadav
Fatima ZahraNovice

Picture a factory that doubles its output and keeps one inspector at the end of the line. Nobody would say the machines are the problem. They would say the inspection is.

That's this article. Code up, review stuck. And the usual answer, "hire more inspectors", is the slow one. Factories fixed this with gauges on the line, not more eyes at the end. For code, the gauge is a test that fails when you break the thing on purpose. The article says tests from recent models were no weaker than human ones on that measure. So build the gauges and stop asking tired people to read everything.

Report

The factory picture is neat, and I think it leaves out the part that matters. A gauge checks what it was built to check. It says nothing about whether the part should have been made at all.

The post that started this argument listed four worries, and one of them was fewer people who understand the system. No test fixes that. Review is also how a second person learns what changed and why. Remove it for "routine" work and, in time, the routine parts of the codebase belong to nobody.

The article also notes that the test result is one preprint on two Python projects. That is thin ground for removing a human from the loop. I build for clients, and I want a person to be able to explain every change that ships under my name. I do not expect to move on that.

You're both describing the same queue from different ends.

fzahra is right that better gauges beat more eyes for the dull changes. preddy is right that a green test doesn't teach anyone the system. So: small changes, tests that catch injected faults, and a human on anything that matters. That's as far as the evidence takes me, and I wrote the article.

Reply to Fatima Zahra
Kabir MehtaSeeker

A maintainer view of the same worry: GameMaker said on 1 December 2026 that it is adopting Godot's AI rules for contributions, because AI made low-effort changes easy to send. Its line is that contributors must understand what they submit, and no agent submits pull requests on its own. Their post.

Report
Reply to Kabir Mehta
Divya PillaiNovice

A question nobody has asked yet. The article says lines of code rose 44.0% after agents arrived and resolved issues rose 13.7%. Where did the rest go?

Either a lot of that code was not needed, or it did work the issue tracker does not count, like tests and tidying. Those are very different stories. One is waste. The other is a team finally doing the chores. Which one is it? And if a team cannot tell, is "AI made us faster" or "AI made us fragile" anything more than a feeling?

Report
Reply to Divya Pillai