Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your Agent's PR Grows Three 'While I Was in Here' Cleanups, and Now You Can't Review It

You ask your agent to add one endpoint. You come back to a diff that contains: the endpoint you asked for, a renamed variable across fourteen files, a rewritten error helper because the old one "looked inconsistent," and a formatting pass that touched forty lines you never mentioned. The tests pass. CI is green. And now you are stuck: you cannot tell which hunk implements the feature and which…

When you give an agent a coding task, you must set clear boundaries. An agent may see the whole codebase and fix inconsistencies, but this can have unintended consequences. Each tiny cleanup the agent makes during your review multiplies the surface area you must verify. Renames, refactors, and formatting changes can break unexpected things like string references or test snapshots.

By the time you finish reviewing, you're not just reviewing the requested feature, but also auditing the agent's changes across the entire codebase.

The best approach is to make the smallest possible diff that satisfies the original request. Do not let the agent rename, refactor, reformat, or touch unrelated files. If the agent notices something that could be cleaned up, list it as a follow-up task in the pull request description and stop. This allows the agent to focus on the core change without getting sidetracked.

Separating the clean-up tasks from the original feature diff is crucial. The follow-up list may seem slower, but it makes each change easier to review. A small rename done as its own PR takes only a few seconds to review, while bundling it with the feature can make it difficult to find and understand later. Small, focused diffs are not just an aesthetic choice; they are essential for efficient reviews.

When you hand an agent a task, you're granting them permission to touch the entire codebase. Be explicit about the boundaries of the task you're giving them. List any drive-by clean-ups as separate follow-up items instead of merging them into the main diff. This allows you to review the feature quickly and efficiently, without getting bogged down in unnecessary changes.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Monday 12 October →