fix: prevent model from using shell scripts to modify file contents#11863
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: prevent model from using shell scripts to modify file contents#11863roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Add explicit prohibitions in write_to_file and execute_command tool descriptions to prevent the model from falling back to shell scripts (sed, echo, cat, printf, tee, etc.) when modifying file contents. Instead, the model is directed to use the dedicated file editing tools (apply_diff, edit, or write_to_file). Closes #11861
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to address Issue #11861.
Problem
When
write_to_filefails or seems unsuitable for large files, the model falls back to usingexecute_commandto create shell scripts that modify file contents (viased,echo,cat,printf,tee, etc.). This is problematic and was not observed when XML tooling was used.Changes
write_to_filetool description - Added explicit guidance namingapply_diffandeditas the preferred alternatives, plus a clear prohibition against usingexecute_commandwith shell commands as a workaround for file modifications.execute_commandtool description - Added a prohibition against using this tool to modify file contents, directing the model to use the dedicated file editing tools instead.Why prompt-level changes
The model resorts to shell scripts because nothing in the tool descriptions explicitly prevents it. Adding clear instructions at the prompt level steers the model toward the correct tools.
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud