Skip to content

fix(tools): count chained StrReplaceFile edits against intermediate content - #2569

Open
aalhadxx wants to merge 1 commit into
MoonshotAI:mainfrom
aalhadxx:main
Open

fix(tools): count chained StrReplaceFile edits against intermediate content#2569
aalhadxx wants to merge 1 commit into
MoonshotAI:mainfrom
aalhadxx:main

Conversation

@aalhadxx

@aalhadxx aalhadxx commented Jul 29, 2026

Copy link
Copy Markdown

Problem

The StrReplaceFile tool tallied every edit against the original file text. When a later edit looked for text produced by an earlier one, it was counted as zero even though it was successfully applied.

Reproduction

Before this fix the tool reported 1 total replacement but the file ended up as .

Fix

Move the replacement counter into the edit-application loop so each edit is scored against the content as it exists just before that edit.

Test

Added test_replace_chained_edits_count to verify that chained edits report the correct total replacement count.

Fixes #2526


Open in Devin Review

…ontent

The StrReplaceFile tool tallied every edit against the original file
text. When a later edit looked for text produced by an earlier one, it
was counted as zero even though it was successfully applied.

Move the replacement counter into the edit-application loop so each
edit is scored against the content as it exists just before that edit.

Fixes MoonshotAI#2526

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

StrReplaceFile reports too few total replacements for chained edits

1 participant