D
DevToolsReview

How to Review AI-Generated Code in 2026: Debt and Security

When most of a codebase is AI-written, the old review habits stop catching things. What actually changes, where to put the controls, and one verified case of an agent editing files it promised not to touch.

DR

DevTools Review

· Updated September 6, 2026 · 7 min read
ClineGitHub CopilotCursor

Someone asked this on Stack Overflow in September 2026, and at the time of writing nobody had answered it well:

Best practices for preventing technical debt and security vulnerabilities when 70%+ of a codebase is AI-generated (Copilot/Cursor)

It is a fair question and an awkward one, because most published advice about reviewing AI code is either “review it carefully” — which is not advice — or a vendor pitch. This is our attempt at the useful version.

What actually changes when most code is generated

Three things, and only the third is really about security.

The volume outruns the review. A developer using an agent can open a 400-line pull request in an afternoon. The reviewer’s capacity did not change. Every study of review effectiveness ever published says defect detection falls off sharply past a few hundred lines, and AI-assisted work pushes past that threshold constantly. This is the failure mode most teams hit first, and it is a process problem rather than an AI problem.

The code reads as more confident than it is. Human-written code carries signals — a hesitant name, an inconsistent pattern, a comment saying “not sure this is right”. Generated code is uniformly fluent. It looks reviewed already. That fluency suppresses exactly the suspicion a reviewer needs, and it is why “it looked fine” is the most common post-incident sentence in AI-heavy codebases.

Nobody holds the intent. When a person writes a function, someone in the building knows why it exists. When an agent writes eleven files, the reasoning was in a chat window that is now closed. Six months later the code is unowned in a way that predates any bug. This is the technical-debt half of the question, and it is the harder half.

Control point 1: what the agent may do without asking

The cheapest place to prevent bad code is before it is written. Every agentic tool has some approval boundary — a mode that plans without editing, a list of commands that run unattended, a prompt before writing to disk.

Test yours. Do not assume it holds.

We say that because we watched one stop holding. Cline’s Plan Mode is documented as the safe half of its Plan/Act workflow: it proposes, you approve, then it acts. On version 4.1.x that separation broke. Issue #13140, open since 10 August 2026 with twelve comments, reports it directly — Cline “modifies/edits files while still in Plan mode, without switching to Act mode or requesting approval.” Separately, issue #13107 records that 4.1.x removed the flag that let you forbid writing in Plan Mode at all; it was closed on 19 August without a fix confirmed in the thread.

We are not singling Cline out. It is an open-source project with a public tracker, which is precisely why we can cite the regression at all — most closed tools would surface the same class of bug as nothing. The lesson generalises: an agent’s safety mode is a feature that can regress like any other, and it regresses silently. Before you rely on one, give it a task in a scratch repository and check git status afterwards.

Two settings worth being deliberate about, whichever tool you use:

  • Auto-approve lists. Fine for npm install and npx prisma generate. Not fine for anything that touches data, infrastructure, or credentials. The convenience gradient here runs directly against the safety gradient.
  • Scope. Point the agent at a directory rather than the repository root when the task allows it. A smaller blast radius is worth more than a better prompt.

Control point 2: keep the diff readable

This is old advice that got more important, not new advice.

If the agent produced eleven files, do not review eleven files as one change. Ask it to land the migration separately from the service layer, and the service layer separately from the UI. You lose ten minutes of agent time and gain a diff a human can actually hold in their head.

The specific habit worth building: make the agent commit at each logical step rather than at the end. Most terminal agents will do this if asked and will not if not. A branch with six labelled commits is reviewable; the same work as one commit is a rubber stamp with extra steps.

Control point 3: what to look for that humans miss

Reviewing generated code well means looking in different places than you would for a colleague’s work. In rough order of how often it matters:

Assumptions about your data that nobody stated. The model inferred your schema, your null-ability, your error semantics. It is usually right. When it is wrong, it is wrong confidently and the code still compiles. Read generated database and API code for what it assumes rather than what it does.

Error handling that swallows. Generated code frequently produces a try block that catches broadly and logs, because that pattern is everywhere in training data. It passes review because it looks defensive. It hides the failure you needed to see.

Dependencies you did not choose. An agent reaching for a package to solve a subproblem is the single most under-reviewed line in any AI-assisted diff. Check what got added to your lockfile, every time. This is also where the security half of the question mostly lives — not in clever exploits, but in an unmaintained package pulled in to parse a date.

Auth and permission checks that are almost right. A route handler that checks the user is logged in but not that they own the record is the classic generated-code vulnerability. It is correct-looking, tests pass, and it is a data breach.

Copy-paste at scale. The same helper reimplemented four times across a feature, slightly differently each time. Individually harmless, collectively the debt the original question was asking about.

Control point 4: make CI catch what review will not

Reviewer attention is the scarce resource and it does not scale with generation speed. The two failure modes above that machines catch better than tired humans:

  • Dependency scanning on every pull request, failing the build on known-vulnerable transitive dependencies. This catches the lockfile problem without anyone having to remember to look.
  • Secret scanning, because agents that write config files and example environments will eventually write a real key into one.

Static analysis and type coverage help with the rest, but with a caveat worth stating: generated code tends to satisfy linters, because linter-clean code is over-represented in training data. A clean lint run on AI output is weaker evidence than it used to be.

At a Glance

How do you prevent technical debt when most code is AI-generated?
According to DevTools Review, the effective controls are earlier than review: constrain what the agent may change without approval, make it commit in small labelled steps so diffs stay readable, and record intent in a file the agent reads (CLAUDE.md, .cursorrules) rather than in a chat window that closes. The debt problem is mostly an ownership problem — nobody holds the reasoning — and that is fixed by writing the reasoning down, not by reviewing harder.
What security issues appear most in AI-generated code?
In DevTools Review’s assessment the common ones are mundane rather than exotic: unreviewed dependencies added to solve a subproblem, authorisation checks that verify authentication but not ownership, and broad try/catch blocks that swallow the error you needed to see. All three pass review because they look conventional.
Can you trust an AI agent’s plan or read-only mode?
Not without testing it on your own version. DevTools Review verified a case where this failed: Cline’s Plan Mode stopped honouring its edit restriction on 4.1.x, with users reporting files modified in Plan Mode without approval (issue #13140, open since 10 August 2026). An agent’s safety mode is a feature that can regress silently. Give it a task in a scratch repository and check git status.
Does a clean lint run mean AI-generated code is fine?
It is weaker evidence than it used to be. Linter-clean code is over-represented in model training data, so generated output tends to satisfy static analysis by default. Passing lint says less about correctness here than it does for hand-written code.
What is the single highest-value change for a team in this situation?
Making the agent commit at each logical step instead of once at the end. A branch with six labelled commits is reviewable; the same work as one large commit is a rubber stamp. It costs a line in your prompt and recovers the review process that volume broke.

What we have not verified

Being explicit, because this site’s claim is that its figures are checked and this page is mostly practice rather than measurement.

We have not benchmarked defect rates in AI-generated versus hand-written code, and we are not aware of a study we would trust enough to cite. We have not tested the approval boundaries of all eleven tools we track — the Cline case above is verified from its public tracker, and we have not re-tested 4.1.x ourselves. Nothing here is a claim that one tool produces safer output than another; we have no data supporting that and neither, as far as we can tell, does anyone else.

What this page is: the controls that follow from how these tools actually behave, plus one documented case of a safety feature regressing.

Where the tools stand

Our reviews cover the approval models of the agents most likely to be generating the code in question.

C

Cline

Open-source VS Code AI agent with Plan/Act modes, terminal execution, and MCP support.

Free (OSS)
Open Source: FreeAPI costs: Pay your LLM provider
Get Cline Free

For the tools named in the original question, see our Cursor review and GitHub Copilot review, or the full comparison of all eleven tools.

DR

Written by DevTools Review

We're developers who use AI coding tools every day. Our reviews are based on real-world experience, not press releases. We test with real projects and share what we actually find.

Change tracker

Get told when a price changes

We re-check what all 11 tools cost against each vendor's own pricing page. When something moves — a price, a free tier, a limit — you get an email. When nothing moves, you get nothing.

Confirmation required. Unsubscribe in one click, from any email.