fix: clarify apply_diff is for surgical edits only, not full file rewrites #6182
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.
Summary
This PR addresses the issue where some models get confused and try to use
apply_diffto write entire files instead of making surgical edits.Changes
Impact
This should help prevent models from misusing
apply_diffto rewrite entire files when they should be usingwrite_to_fileinstead. The clearer guidance and examples make it explicit that:apply_diff= surgical edits (changing specific lines/functions)write_to_file= creating new files or complete rewritesTesting
Important
Clarified
apply_diffis for surgical edits only, not full file rewrites, with updated descriptions, rules, and tests.apply_diffdescription inmulti-file-search-replace.tsandmulti-search-replace.tsto emphasize surgical edits only.apply_difffor full file rewrites.rules.tsto preferapply_diff,insert_content, orsearch_and_replaceoverwrite_to_filefor existing files.system-prompt.spec.tsto reflect changes inapply_diffusage and rules.with-diff-enabled-true.snap,with-diff-enabled-false.snap, andwith-diff-enabled-undefined.snapto match new descriptions and rules.This description was created by
for 647823f. You can customize this summary. It will automatically update as commits are pushed.