Topic 4 of 5 · 4 min read
Partial edits and silent breaks in IDE agents
Goal: Spot a partial or misapplied IDE agent edit in a diff and name the check that would have caught it.
IDE agents rarely fail loudly; they fail by looking finished, so learn the four quiet failures and the cheap check that exposes each. The four are partial edits, stale context, the wrong target and unrun checks.
Check yourself · 1 of 3
After an agent renames a function, which quick check best finds a partial edit?
Why it matters
An agent edit is a patch applied to your files, often by a second step that merges the model's text into the file. That step can fail without a loud error. The chat then says "done" while the files say otherwise. Because the code that did land is clean, the break hides until a build, a test or a user finds it.
The four quiet failures
- Partial edit. The agent changes the function but not its callers, the interface but not its implementers, or three of four files. Check: search the codebase for the old name or signature. Zero hits should remain.
- Stale context. The agent works from an old index or an old open tab and edits code that no longer matches the file. Check: look for unrelated context lines in the diff and for lines it "removes" that you do not recognise.
- Wrong target. Two files share a name (
utils.tsin two packages), or the agent edits a generated or copied file. Check: read the full path of every file in the changed list. - Unrun checks. The agent says tests pass, but never ran them, ran a different command, or ran a subset. Check: run the full check yourself and read the output.
Before and after
An agent renames getUser(id) to fetchUser(id). The summary says the rename is complete.
--- a/src/api/users.ts
+++ b/src/api/users.ts
-export function getUser(id: string) {
+export function fetchUser(id: string) {
return db.users.find(id);
}
Only the definition changed. Two other files still import getUser. A text search finds them in seconds, and the type checker fails on them at once. The fix is to ask the agent to update every reference and then run the type check as the finish line.
What goes wrong
- Trusting the "applied" label. A merge step can place code in the wrong spot or skip a hunk. Read the final file, not the chat.
- Duplicate blocks. An edit lands twice, or leaves the old block next to the new one, so there are two competing definitions.
- Green by omission. Tests pass because the changed code is not covered. A passing run proves only what the tests exercise.
- Dead edits. The agent edits a copy under
dist/orbuild/that the real build overwrites.
Examples
The missed call site
An agent changes a function to take an options object instead of two arguments. It updates four callers and misses one in a cron job. Unit tests pass. The cron job fails at midnight. A search for the function name, or the type checker, would have flagged the old call.
Edit in the generated file
The changed-files list shows src/generated/schema.ts. The agent fixed a type there, but the file is rebuilt from schema.graphql on the next build and the fix disappears. Revert it and change the source file.
Key points
- IDE agent failures are usually quiet: the code that landed looks clean while part of the change is missing.
- After a rename or signature change, search for the old name; any hit means a partial edit.
- Read the full path of every changed file to catch edits to the wrong or generated file.
- A type check and a full test run, executed by you, are the cheapest proof that nothing broke.
- A passing test run proves only what the tests cover, so ask whether the changed code is exercised.
Common mistakes
- Believing the chat summary that says every change was applied.
- Skipping a search for the old name after a rename or signature change.
- Not reading the full path of each file in the changed list.
- Treating a green test run as proof when the changed code has no test.
Check yourself · 2 of 3
An agent reports "all tests pass". What is the best response?
Check yourself · 3 of 3
The changed-files list includes dist/app.js but not src/app.ts. What probably happened?
Practice items, not counted towards your mastery.
Start here
- Build with AI in VS Code (opens in a new tab)DocsFree
An overview of inline suggestions, chat and agents in one editor, with the controls for each.
- Add context to chat (VS Code docs) (opens in a new tab)DocsFree
How to attach files, symbols and other context so the agent answers from the right code.
- Review AI code edits (VS Code docs) (opens in a new tab)DocsFree
Keep and undo controls, and what restoring a chat checkpoint does and does not undo.
More for this topic
- Use tools with agents (VS Code) (opens in a new tab)DocsFree
Describes the terminal and edit tools an agent uses, which shows where an edit or a command can fail quietly.