Skip to content

fix: update fsWrite toolSpec #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged

fix: update fsWrite toolSpec #1064

merged 1 commit into from
Apr 22, 2025

Conversation

tsmithsz
Copy link
Contributor

Problem

  • fsWrite tool tends to favor doing line-by-line replaces which causes
    an increase in latency.

Solution

  • Updated the tool spec to add an important guideline around the fsWrite
    tool usage - restricting strReplace command to only simple single-line
    replacements, while recommending the create command for multi-line
    edits.:

* IMPORTANT: For the fsWritetool, only use thestrReplacecommand for simple, isolated single-line replacements. If you are editing multiple lines, always prefer thecreate command and replace the entire file content instead.

Testing

Latency test results

Build with strReplace Build without strReplace
renaming a single function 16s 17s
translate comments (multi-line replace +19 -20) 98s 20s

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tsmithsz tsmithsz requested a review from a team as a code owner April 22, 2025 19:14
@jpinkney-aws jpinkney-aws merged commit 20e3680 into aws:main Apr 22, 2025
6 checks passed
@@ -155,6 +155,8 @@ export class FsWrite {
and otherwise create a new file\n * The `append` command will add content to the end of an existing file, \
automatically adding a newline if the file does not end with one. \
The file must exist.\n Notes for using the `strReplace` command:\n * \
IMPORTANT: For the `fsWrite` tool, only use the `strReplace` command for simple, isolated single-line replacements. \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "For the fsWrite too"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will modify in a follow-up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants