-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(enh) AgentSkills: fix \n handling with file editing (iPython) #3904
base: main
Are you sure you want to change the base?
Conversation
I'm still looking into formatting issues with linebreaks with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a stab at this! This is a very tricky issue that somewhat lead me to believe we need to implement an EditAction (#3777) 😢
f'[File: {temp_file_path} (4 lines total after edit)]\n' | ||
'(this is the beginning of the file)\n' | ||
'1|Line 1\\n\n' | ||
'2|Line 2\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this Line 2
get replaced? because to_replace='Line 2\r\nLine 3\\r\\n',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not in this case as the search term is Line 2\r\nLine 3\\r\\n
(note the \r
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, since "Line 2\r\nLine 3\r\n" is the search term, shouldn't Line 2
completely goes way in the new fine, since it it replaced?
@xingyaoww - this should be ready for you eval, if you like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot -- this looks much cleaner! Just had a few questions before i can start kick off eval
f'[File: {temp_file_path} (4 lines total after edit)]\n' | ||
'(this is the beginning of the file)\n' | ||
'1|Line 1\\n\n' | ||
'2|Line 2\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, since "Line 2\r\nLine 3\r\n" is the search term, shouldn't Line 2
completely goes way in the new fine, since it it replaced?
Kicked off eval on the latest commit! |
Thank you! 🚀 |
Short description of the problem this fixes or functionality that this introduces. This may be used for the CHANGELOG
Fixed handling of literal "\n" in file editing operations via iPython.
Give a summary of what the PR does, explaining any non-trivial design decisions
file_ops.py
andCodeActAgent.py
fixed handling of literal line breaksedit_file_by_replace
but errors with[No exact match found in xxx]
this contributed to an excessive amount of steps needed (and often failing the bench test instance)
TODO:
In below example, the
to_replace
value with this PR has the\n
correctly treated as text, whereas inmain
it would be shown as an actual line break:Link of any specific issues this addresses
Fixes #3650