Docker terminal state
Describe the bug
Currently, our DockerInteractive terminal loses some state. In particular, if the agent runs a cd command, the next command doesn't run inside that directory.
Steps to Reproduce
uvicorn opendevin.server.listen:app --reload --port 3000websocat ws://127.0.0.1:3000/ws(in a second terminal)- send these messages:
{"action": "run", "command": "ls"}
{"action": "run", "command": "mkdir foo && cd foo && touch file.txt"}
{"action": "run", "command": "ls"}
Expected behavior
- output of second
lscommand showsfile.txt
Actual behavior
- output of second
lscommand shows directoryfoo
Additional context
I'm not sure what other state we might be losing with docker's exec command. The only other one I can think of is exported environment variables.
Suggested solution Two ways we could go here:
- Create a long-lived shell connection to the running docker container, e.g. via
ssh - Figure out
cwdat the end of eachexec, and use that as workdir for the nextexec
CC @xingyaoww who pointed this out
Another data point: the agent keeps trying to use virtualenv, and then getting confused when it doesn't work 🙃
I am little confused, I try the step locally in latest main branch. But when sending {"action": "run", "command": "ls"}, will trigger the code logic here and get NotImplementedError. what did I miss?
@yufansong Thanks for bringing up the issue! We had some lengthy discussion about this yesterday -- basically we were thinking whether it make sense for us to support sending actions from the user's end at this early stage. We temporarily decided to remove the ability from the user for them to execute commands directly, so websocket might not be a good direction to reproduce this yet.
Here's another step to reproduce this issue:
- at root directory:
mkdir workspace python3 opendevin/sandbox/sandbox.py -d workspacelsmkdir foo && cd foo && touch file.txtls
See this screenshot for more details:
Closing this in favor of https://github.com/OpenDevin/OpenDevin/issues/226