This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: incorrect line number in output snippet for str_replace and insert#110
Merged
Merged
Conversation
xingyaoww
approved these changes
Apr 9, 2025
Collaborator
xingyaoww
left a comment
There was a problem hiding this comment.
Thanks for the fix!! 😭 This is tricky but important to get right
Collaborator
|
Can you release openhands-aci and bump the version on OpenHands repo once this merged? |
Contributor
|
Awesome, thank you! Yes, it will be interesting to see an eval, because the LLM really did get confused by the shifting line numbers. In the swe-bench instance from which I posted the snippet, Gemini gave up on using |
Contributor
Author
|
I ran an eval on 100 instances and it seems that we get comparable results to the old version, not better ( |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Currently, we don't have tests for editing commands on large files (where outputs will be just a snippet in the 4-line window) so we didn't catch this error previously. I investigated a bit and it seems in an old PR to reduce memory consumption, we (and OpenHands) messed up with the line numbers when making the output snippet for
str_replaceandinsertcommands, as some places they are 0-based and in other places they are 1-based.This PR adds a test for it and fixes that bug. We might want to run an eval to see how this affects performance.
CC: @enyst if you have some extra thoughts on this issue.
Related Issue
OpenHands/OpenHands#7724