DEV Community

Cover image for Why Coding Agent Commits Are 3x Larger and How to Keep PRs Reviewable

Why Coding Agent Commits Are 3x Larger and How to Keep PRs Reviewable

Sean Kwon on November 17, 2026

A 2026 empirical study of 128,018 GitHub repositories (arXiv:2601.18341) measured how autonomous coding agents like Cursor, Claude Code, and Codex ...
Collapse
 
iictp profile image
IICTP •

The 31 vs 11 median lines up with what I've seen too — the fix itself is usually small, and the rest is the agent tidying things it touched along the way. The pre-commit budget is the part I'd steal first: a hard 10-file/300-line ceiling beats asking the agent nicely to keep things small. Have you tried checking the staged spread mid-session, after each agent turn, or do you only catch it at commit time?

Collapse
 
seanjhkwon profile image
Sean Kwon •

Mid-session checks catch drift way earlier than a pre-commit hook, because an agent that wanders into three extra helpers on turn two can still pause right there before editing ten more files.

A lightweight diff stat check in a turn-end hook nudges the session to stop and checkpoint the current fix early, before unrelated edits accumulate by commit time.

Collapse
 
iictp profile image
IICTP •

That turn-end hook idea is the most concrete part for me — catching the drift at turn two instead of at commit time makes a lot of sense. Do you use a threshold for the diff-stat check, like a number of files or lines added, to decide when it nudges the session to checkpoint?

Thread Thread
 
seanjhkwon profile image
Sean Kwon •

A soft warning at roughly half the commit ceiling works well mid-session, since nudging around five modified files leaves room to finish the current fix before hitting a hard 10-file or 300-line pre-commit block.

Directory spread is an even cleaner signal in that same hook. Multiple edits inside one feature folder usually belong together, whereas changes crossing into unrelated top-level directories almost always mean the agent wandered into unrequested cleanup.

Collapse
 
gautamtalksdev profile image
Gautam K •

Larger commits from agents make sense, they don't feel the pain of a messy diff the way a reviewer does. Asking the agent to commit after each passing test, and keeping refactors in their own commits, seems to help reviewers the most.

Collapse
 
seanjhkwon profile image
Sean Kwon •

Explicit file staging helps there too, since agents still tuck unrelated helper renames into a passing-test commit when staging the whole tree at once. Scoping git add by path keeps each checkpoint focused on the actual behavior change.

Collapse
 
gautamtalksdev profile image
Gautam K •

Good point, scoping git add per file is the simplest fix for that. A passing test can hide an unrelated rename in the same commit, and explicit staging makes the agent say what it meant to change.

Collapse
 
prachitparikh profile image
Prachit Parikh •

Splitting mechanical commits from behavior commits helps whoever checks the work against the story too. I'd ask each fix: commit to name the acceptance criterion it changes. Then a commit that touches behavior but names no criterion is either scope creep or a missing requirement, and either way it's a question before merge, not after.

Collapse
 
seanjhkwon profile image
Sean Kwon •

Generic commit messages like "fix validation" often mask speculative fallback logic or extra cleanup tucked inside a coding-agent diff. Asking each behavior commit to name the exact acceptance criterion it satisfies forces unmapped edits into the open right away.

Once a change sits outside every listed criterion, you know immediately whether to drop the extra hunk or open a ticket for an undocumented edge case before merge.

Collapse
 
sansakamoto profile image
San •

The 31 vs 11 lines number stuck with me because it's exactly what I've been seeing — the actual fix is maybe 20 lines and then there's a pile of import cleanup and formatting around it that makes the diff look scary for no reason. The pre-commit budget is the part I'll actually try, 10 files / 300 lines feels strict enough to force a split without me just turning it off after a day. My only worry is a legit big refactor tripping it all the time, do you just bump the numbers for those or split anyway?

Collapse
 
seanjhkwon profile image
Sean Kwon •

Most large refactors still split cleanly into two phases without raising the 10-file limit: move shared types or module renames first, then migrate callers a slice at a time. Each checkpoint stays fast to verify and leaves automated formatting noise outside the behavioral change.

For single-shot changes that truly cannot be sliced, like a database migration or generated schema update, gating the hook with a one-off skip environment variable beats raising the budget globally. Once people raise the threshold past 300 lines, they rarely turn it back down.