You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
string_replace returns the entire file after every edit, uncapped #763
Every edit, every time. Tool results persist in the conversation, so each edit's copy is re-sent on all subsequent steps of the agent loop. A task with several edits to a large file compounds badly.
Fix
Return a window around the edit rather than the whole file. The tool already computes startLine and newEndLine (source/tools/file-ops/string-replace.tsx:68-81), so the range is available.
Suggested: 20 lines either side of the changed range, with a marker showing it is a window. That preserves the genuinely useful part (letting the model confirm surrounding context survived the edit) while dropping the rest.
Open question worth discussing on the issue: whether even the window is needed, or whether the confirmation line alone is enough. string_replace already fails loudly on a non-unique or absent match, so the model has strong feedback without the echo.
Related
Same pattern as the write_file echo, but this one is less trivially removable, since unlike write_file the model did not author the full resulting file.
Hi @will-lamerton, I’d like to take #763. I’ll replace the unbounded post-edit file echo with a bounded context window around the changed range, include a clear elision marker when surrounding content is omitted, and preserve the replacement/range summary and read-before-edit guard. I’ll add focused coverage for edits near the start, middle, and end of a file, including multiline size changes, then open a ready-for-review PR after validation.
The fix bounds successful string_replace output to a 20-line context window on each side of the edited range, includes omitted-range markers, and preserves line-number orientation for inline and multi-line edits. I added regression coverage for large files and file boundaries, plus a patch changeset.
Validation passed: focused 42-test suite, formatting, lint, type-checking, unused-code analysis, and dependency audit. The full AVA suite still has one unrelated existing failure in source/app/components/settings-tabs.spec.tsx:109 where the test expects Display but the rendered output does not include it.
Activity
will-lamerton commentedon Aug 3, 2026
Part of #772.
RealBhupesh commentedon Aug 4, 2026
Hi @will-lamerton, I’d like to take #763. I’ll replace the unbounded post-edit file echo with a bounded context window around the changed range, include a clear elision marker when surrounding content is omitted, and preserve the replacement/range summary and read-before-edit guard. I’ll add focused coverage for edits near the start, middle, and end of a file, including multiline size changes, then open a ready-for-review PR after validation.
RealBhupesh commentedon Aug 4, 2026
Implemented in ready-for-review PR #784: #784
The fix bounds successful
string_replaceoutput to a 20-line context window on each side of the edited range, includes omitted-range markers, and preserves line-number orientation for inline and multi-line edits. I added regression coverage for large files and file boundaries, plus a patch changeset.Validation passed: focused 42-test suite, formatting, lint, type-checking, unused-code analysis, and dependency audit. The full AVA suite still has one unrelated existing failure in
source/app/components/settings-tabs.spec.tsx:109where the test expectsDisplaybut the rendered output does not include it.