fix(coding-agent): count edit occurrences in the matched space - #1648
Closed
yuzhiyang1 wants to merge 1 commit into
Closed
fix(coding-agent): count edit occurrences in the matched space#1648yuzhiyang1 wants to merge 1 commit into
yuzhiyang1 wants to merge 1 commit into
Conversation
|
Hi @yuzhiyang1, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/PrimeIntellect-ai/prime-agent/blob/main/CONTRIBUTING.md for more details. |
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.
applyEditsToNormalizedContentmatchedoldTextexactly (viafuzzyFindText's exact-match path) but always counted occurrences afternormalizeForFuzzyMatch. If the file contained text that normalizes to the same string asoldText(e.g. bothit’sandit'sare present), a unique exact match was rejected with "Found 2 occurrences".Occurrences are now counted in the same space the match was found in: exact matching counts in the original content, fuzzy matching counts in normalized content. Also avoids
String.split("")blowups whenoldTextnormalizes to an empty string.Added unit tests covering: unique exact match not rejected by normalization collisions, fuzzy duplicates still rejected, and genuine exact duplicates still rejected.
Note
Fix edit tool to count occurrences in the matched space
Fixes duplicate-occurrence detection in
applyEditsToNormalizedContentso it counts in the same space as the initial match. When the match used fuzzy normalization, both content andoldTextare normalized before counting; otherwise exact substring counting is used on the original text.countOccurrencesnow returns 0 for emptyoldText.Risk: a fuzzy match that has multiple occurrences in normalized space will still be rejected, so edits relying on fuzzy matching against near-duplicate text may now fail where they previously succeeded.
Macroscope summarized 32c1a81.