Skip to content
Failure cases/Failure mode

Agent changed unrelated files

With no scope boundary, the agent edited modules far outside the task to satisfy the validator.

What happens

Asked to fix one thing, the agent touches unrelated files — reformatting, refactoring, or “improving” code that was not in scope — making the change risky and hard to review.

Why it happens

No boundary scoped the change, and a broad validator (e.g., “build passes”) rewards any edit that keeps the build green, related or not.

The loop engineering fix

Add a boundary: “Do not modify unrelated files.”
Scope validation to the change (the specific test/behavior), not just a global build.
Review the diff size — a fix that touches dozens of files is a red flag.

Related