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

Docker terminal state #124

Closed
rbren opened this issue Mar 24, 2024 · 5 comments
Closed

Docker terminal state #124

rbren opened this issue Mar 24, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@rbren
Copy link
Collaborator

rbren commented Mar 24, 2024

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

  1. uvicorn opendevin.server.listen:app --reload --port 3000
  2. websocat ws://127.0.0.1:3000/ws (in a second terminal)
  3. 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 ls command shows file.txt

Actual behavior

  • output of second ls command shows directory foo

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 cwd at the end of each exec, and use that as workdir for the next exec
@rbren rbren added the bug Something isn't working label Mar 24, 2024
@rbren
Copy link
Collaborator Author

rbren commented Mar 24, 2024

CC @xingyaoww who pointed this out

@rbren
Copy link
Collaborator Author

rbren commented Mar 24, 2024

Another data point: the agent keeps trying to use virtualenv, and then getting confused when it doesn't work 🙃

@yufansong
Copy link
Collaborator

yufansong commented Mar 26, 2024

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?

@xingyaoww
Copy link
Collaborator

@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:

  1. at root directory: mkdir workspace
  2. python3 opendevin/sandbox/sandbox.py -d workspace
  3. ls
  4. mkdir foo && cd foo && touch file.txt
  5. ls

See this screenshot for more details:

image

@rbren
Copy link
Collaborator Author

rbren commented Mar 30, 2024

Closing this in favor of #226

@rbren rbren closed this as completed Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants