Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Tweak error message for insert_line#118

Merged
ryanhoangt merged 3 commits into
OpenHands:mainfrom
enyst:patch-1
May 12, 2025
Merged

Tweak error message for insert_line#118
ryanhoangt merged 3 commits into
OpenHands:mainfrom
enyst:patch-1

Conversation

@enyst
Copy link
Copy Markdown
Contributor

@enyst enyst commented May 11, 2025

Tweak error message for the wrong insert_line parameter for str_replace_editor insert command, to try to avoid suggesting to the LLM that it's exactly a line.

Issue stems from confusing LLMs like this:

Let's re-read the error: "It should be within the range of lines of the file: [0, 110]". This sounds like line numbers are 0-indexed for insert_line in the API, but 1-indexed in view_range and cat -n.
If cat -n shows 111 lines, then 0-indexed lines are 0 to 110.
If I want to insert after the current last line (line 110 in 0-indexed, which is line 111 in 1-indexed cat -n output), I should use insert_line = 110.

The change proposed here and on the tool description are in testing.

Reference slack discussion

Copy link
Copy Markdown
Collaborator

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

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

LGTM - maybe @ryanhoangt could take a look too

@ryanhoangt ryanhoangt merged commit 5efbe15 into OpenHands:main May 12, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants