Skip to content
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

[Bug]: CodeAct repeatedly edits the wrong file #1890

Open
2 tasks done
rbren opened this issue May 18, 2024 · 9 comments · May be fixed by #2384
Open
2 tasks done

[Bug]: CodeAct repeatedly edits the wrong file #1890

rbren opened this issue May 18, 2024 · 9 comments · May be fixed by #2384
Assignees
Labels
bug Something isn't working severity:medium Problems that affect many users

Comments

@rbren
Copy link
Collaborator

rbren commented May 18, 2024

Is there an existing issue for the same bug?

Describe the bug

I'm asking CodeAct to repeatedly switch between editing two related files. Often File A is open, then CodeAct sends an edit command intended for File B. This usually happens when I issue a new instruction.

It'd be neat to show/emphasize the currently open file in CodeAct's prompt.

Side note: maybe we should just stop making open a thing, and put filenames directly into the commands? The agent has to look back over previous commands to determine current state, instead of just having a deterministic instruction it can write.

Current Version

Main, as of `0ecba83e53c6f2abfb0fdbaf134842a0298234f6`

Installation and Configuration

docker run

Model and Agent

gpt-4-turbo, CodeAct

Reproduction Steps

repeatedly prompt codeact to edit different files

Logs, Errors, Screenshots, and Additional Context

Screenshot 2024-05-18 at 3 40 18 PM
@rbren rbren added the bug Something isn't working label May 18, 2024
@li-boxuan
Copy link
Collaborator

Side note: maybe we should just stop making open a thing, and put filenames directly into the commands?

I also had the same wonder when I saw SWE agent commands. Apparently LLM often forgets that it needs to open a file before edits it.

@xingyaoww
Copy link
Collaborator

Yep! I think we should plan for one major iteration of the existing file operations now that we have a good way of comparing the performance.

@mamoodi mamoodi added the severity:medium Problems that affect many users label Jun 6, 2024
@edwardbrazier
Copy link

I vote for including the file name as the first parameter supplied by the AI to the edit command, as suggested above by rbren.

(This mix-up happened a bunch of times on the very first day that I used OpenDevin.)

@tobitege
Copy link
Contributor

tobitege commented Jun 9, 2024

I'd take this up since I'm already on the agentskills with append_file and get to the edit_file changes for this PR afterwards.

cc @rbren @xingyaoww

@li-boxuan
Copy link
Collaborator

I encountered something funny with this symptom recently. The agent was trying to edit a javascript file but it forgot to open it. Since the last file it opened was an HTML file, the agent simply wrote javascript code to HTML file. When it browsed the webpage, it saw those javascript code printed out - and it thought that meant the code had been working!

@tobitege
Copy link
Contributor

tobitege commented Jun 9, 2024

Proposal: right now open_file serves more as a list_file (like cat) and shouldn't be required prior to edit_file?

@li-boxuan
Copy link
Collaborator

right now open_file serves more as a list_file (like cat) and shouldn't be required prior to edit_file?

+1

@SmartManoj SmartManoj assigned SmartManoj and tobitege and unassigned SmartManoj Jun 10, 2024
@xingyaoww
Copy link
Collaborator

@tobitege i've been thinking about the same thing too -- feel free to starts a PR and add "filepath" to the edit command!

@tobitege
Copy link
Contributor

@tobitege i've been thinking about the same thing too -- feel free to starts a PR and add "filepath" to the edit command!

Already done, waiting for review: #2346

@tobitege tobitege linked a pull request Jun 11, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity:medium Problems that affect many users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants