You asked for a disabled state on the submit button. The diff also re-sorts imports in six files, drops an unused type in a sibling, and rewrites index.ts barrel exports “while we were here.” The bugfix is five lines. The noise is two hundred.
I’ve started treating drive-by cleanup as a reason to reset the PR, not a free lint gift. Unrelated import churn hides the actual change and picks fights with every other branch.
Why agents love to tidy
- The file had an unused import, and the model has been trained to “leave the campground cleaner”
- Auto-organize-imports in the agent’s editor loop ran on every file it touched
- It opened a barrel file to add one export, then reordered the rest
- A formatter or eslint --fix ran at repo root instead of on the changed hunk
Some of those are good in a dedicated chore PR. They are bad inside “fix the pay button.”
A simple policy
- A bugfix PR may change imports only in files that also have a behavior change, and only for symbols the fix requires
- No barrel reorders, no mass
import typeconversions, no prettier-on-the-whole-file unless that file’s behavior changed and your repo already formats on save - Unused-import removal is OK in a file you already had to edit, if it’s obviously unused — not as an excuse to open neighbors
- If cleanup is truly needed, split it:
fix: disable pay CTA when cart is emptyvschore: organize imports in checkout
Reviewers should be able to read the behavior diff without a side-by-side import puzzle.
What to put in the prompt
Change only the files and lines needed for this bug. Do not re-sort, re-export, or “clean up” imports in files you did not otherwise need to touch. Do not run formatters on the whole repo. If you add or remove a symbol, adjust that file’s imports and leave the rest. If you have a path allow-list, paste it. “Only edit PayButton.tsx and its test” is a stronger constraint than “keep the PR small.”
How to catch it in review
git diff --stat git diff -U0 -- '*.ts' '*.tsx' | rg -n "^[+-](import|export )" Ask, for each file in --stat:
- Is there a non-import behavior change?
- If not, the file shouldn’t be in the PR
- If yes, is the import diff limited to symbols used by that change?
If the agent already pushed a messy branch, don’t spend review comments itemizing every import. Ask it to revert unrelated files (git checkout origin/dev -- src/foo/index.ts) and re-apply the five-line fix. Faster than arguing.
Reject / send back
Reject
- Barrel or index files that only changed order
- Six files of import-only diffs around a one-file fix
- “I also fixed unused vars in the folder”
- A formatter pass over paths that aren’t in the bug
Accept
- Import lines that add/remove a symbol the fix uses, in the same file as the fix
- A test file import for a new case
- A follow-up chore PR if the unused exports are actually worth deleting
Tiny habit
When you ask an agent to fix one UI bug, tell it the only legal import changes are the ones the fix needs, in the files the fix needs. Cleanup can have its own PR. The bugfix should be readable in a minute.