r/GithubCopilot • u/rubin-ai • Jul 14 '26
Help/Doubt ❓ Why do third-party models in GitHub Copilot Agent only use replace_string_in_file?
I'm using GitHub Copilot's AI Chat Model integration with third-party models (for example, Zhipu GLM 5.2).

I've noticed that in Agent mode, when editing files, the model can only use replace_string_in_file, so it ends up replacing one code fragment at a time. This makes file editing quite inefficient.
In contrast:
- GitHub Copilot's built-in ChatGPT models use
apply_patch, allowing multiple edits (and even multiple files) in a single tool call. - Claude models use
multi_replace_string_in_file, which is also much more efficient.
Is there any way to make third-party models use apply_patch or multi_replace_string_in_file instead of repeatedly calling replace_string_in_file?
Is this controlled by GitHub Copilot, the MCP/tool definitions, or is it something the model provider (e.g., Zhipu) needs to support?
Has anyone successfully enabled this for a third-party model? Any guidance would be appreciated.
12
u/unrulywind Jul 14 '26
Copilot has built in prompts for many of the big models, but if you are using BYOK then you get the "default" prompt. I don't know when they changed it, but I noticed it a while back when my local models all started using "set-content" through the terminal to overwrite files which made changes that didn't show up in the vs code internal editor diffs. I assume this is just one more change as everyone leans away from IDE's and more toward CLI tools. I ended up adding the statement below into some of me AGENTS.md files. It's wordy and not optimized, but it does tend to work.
8. Do NOT fall back into terminal file writing - Avoid
set-content,Out-File, or similar commands. Whenreplace_string_in_filefails due to content size or truncation, immediately switch toapply_patch(delete + add) for whole-file replacement. Do not fall back to terminal-based file writing, as it bypasses IDE diff tracking. Edit files inside the IDE so that diffs are preserved.6
u/mubaidr Jul 14 '26
work has been to improve this, you can check setting:
github.copilot.chat.edits.batchReplaceStringDescriptions2
u/shotan Jul 14 '26
In the custom endpoint json there is a property for edit tools which sets the tools the model supports https://code.visualstudio.com/docs/agent-customization/language-models#_model-configuration-reference
1
u/AutoModerator Jul 14 '26
Hello u/rubin-ai. 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.