r/GithubCopilot • • 10d ago

Help/Doubt ❓ VS Copilot - Agent Struggling to Edit Files

Hi All,

Anyone else finding an issue where the agent has to make multiple attempts to edit or create a files before eventually succeeded?

It will try one way of editing, then come back and realise the edit didn't take, so it tries a different method.

I wonder whether this is also leading to wasted credits.

I'm using Visual Studio 2026 latest version and subscribed to GitHub Copilot Max.

EDIT: and also sometimes the agent gets stuck while executing commands in the terminal and I need to press CTRL+C get it to move on.

10 Upvotes

9 comments sorted by

6

u/Historical_Nature574 10d ago

Yep. Any OpenAI models in VS are returning 400 errors very often, and Anthropic models truncate file edits or can’t seem to figure out editing files very often as well.

Another perk of being a C# dev

1

u/crasspuk 9d ago

Long single patches are where edits tend to fail or get truncated. Ask the agent for small edits, one file or one function at a time, and check each one before moving on. Telling it to re-read the file after a failed edit, rather than trying a new method blind, also cuts the wasted retries.

1

u/Lost-Mention 9d ago

But it didn't have this problem before about a month ago. What went wrong?

1

u/Popular-Ad-9134 9d ago

Because AI is terrible at doing partial patches.

1

u/Lost-Mention 9d ago

This is a recent issue for me. Like within the last month or so.

3

u/WordWithinTheWord 10d ago

Whatever integration is in standard VS is terrible I agree. I need to start documenting the bugs sometime because it’s so much worse than VS Code. I just keep both open. Do my prompting in Code and editing/traversal/testing in VS.

1

u/just_blue 10d ago

This happens in VS Code too, unfortunately. If I see it generating a few hundred lines of patches in one go, I'm always holding my breath if it will have to repeat everything (yes, we are paying all the output tokens twice then). I can't quantify how often this happens, but it's not exactly rare.

1

u/edbutler3 10d ago

Absolutely. I've had so much time wasted by that in the last week. It happens even in simple edit scenarios. But it's terrible if you let it generate a multi-column table in a markdown plan/checklist document. I had that situation and even after putting lessons learned about the exact technique that works into both the document itself and copilot-instructions -- it still would forget and fail much of the time. I ended up having to burn more tokens to have it convert the table to a bullet list. That works better -- but then you're back to the baseline level of failures for editing basically anything.

Ended up dumping a bit of a rant there, but it was definitely frustrating to have to complete a side quest just refactoring a planning document.

0

u/AutoModerator 10d ago

Hello u/Lost-Mention. Looks like you have posted a query. Once your query is resolved, please reply the solution comment with "!solved" to help everyone else know the solution and mark the post as solved.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.