Repository navigation
fix(core): refuse an edit whose new text mixes read_file line numbers - #505
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
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.
What changed
oldsometimes matches only after read_file'sN<TAB>gutter is stripped from it. Before this change, anewthat had line numbers on some lines and not others was written as-is, so the file got lines like2 BETA. Now:newhas the gutter, it is stripped (same as before).newhas the gutter,newis used as-is (same as before).newmixes the two, the edit is refused. Nothing is written, and the model gets this message:edit N: invalid_edit: old matched only without its read_file line numbers, but new mixes numbered and unnumbered lines; remove the N<TAB> line-number prefixes from newThe
invalid_edit:prefix is already classified asToolErrorKind::Correction, the same as the other edit argument errors. No protocol change was needed.Verification
matching.rs: the mixed case is refused (failed onorigin/mainwithOk(... replacement: " 2\tBETA\nadded\n 3\tgamma\n")); an all-gutternewis still stripped; a plainnewstill applies as-is; content that really starts with digits and a tab still matches exactly.edit_filechecks the exact refusal text, theCorrectionclassification, and that the file is unchanged.cargo xtask checkpassed.