Repository navigation
fix(tools): terminate an unterminated last line before inserting after it - #6357
Merged
Merged
Conversation
Closed
75 of 86 tasks
VascoSch92
approved these changes
Nov 2, 2026
VascoSch92
left a comment
Member
There was a problem hiding this comment.
Thanks! I checked the test fails without the fix, and tried a one-line file, insert at line 0, an empty file and undo locally. All correct.
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.
HUMAN:
Fixed the no-trailing-newline insert merge from #6348. I reviewed the diff and the test; an insert must start on its own line.
AGENT:
Why
FileEditor.insertcopied the file's lines verbatim, so when the file's last line had no trailing newline and the insert landed after it (insert_line == num_lines), the inserted content fused onto that line: editinga\nbwithinsert_line=2, new_str="x"produceda\nbx\n.Summary
test_insert_after_last_line_without_trailing_newlinefrom theworktree-test-edge-casesbranch (commit f2fcf6e) without itsxfail(strict=True)marker, per the [Bug]: Edge-case tests expose ~70 bugs across the SDK, agent server, tools and workspaces #6348 menu's acceptance criteria.Issue Number
Part of #6348 (menu sub-item: "insert after a last line with no trailing newline merges lines")
How to Test
Before this change the test fails (
['a', 'bx']); after, it passes (['a', 'b', 'x']), and the fulltests/tools/file_editor/suite is 168 passed / 1 skipped (platform) with no regression.ruff check/formaton the touched files are clean.Type
Notes
None.