fix(tools): stop prefixing edit tool responses with line numbers - #790
Open
Pixie-19 wants to merge 2 commits into
Open
fix(tools): stop prefixing edit tool responses with line numbers#790Pixie-19 wants to merge 2 commits into
Pixie-19 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency between read_file and the edit tools (write_file, string_replace) by removing per-line line-number prefixes from the file contents those edit tools return. This makes follow-up content-based edits (especially string_replace, which requires exact matches) less likely to fail due to formatting differences introduced by tool output.
Changes:
- Update
write_fileto return the post-write file contents without per-line line numbers. - Update
string_replaceto return the updated file contents without per-line line numbers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| source/tools/file-ops/write-file.tsx | Removes the %4d: prefixing loop and returns the raw post-write file contents. |
| source/tools/file-ops/string-replace.tsx | Removes the %4d: prefixing loop and returns the raw updated file contents. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Fixes #765.
This PR removes line-number prefixes from the responses returned by the
string_replaceandwrite_filetools.Previously these tools returned file contents like:
while
read_filereturned raw file contents without numbered prefixes. This inconsistency could cause follow-up edits to fail becausestring_replaceexpects the exact file contents.The tools now return the raw file contents, making their output consistent with
read_file.Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
npm run test:types)Manual Testing
Checklist