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]: CodeAgent issues with venv management #1739

Open
2 tasks done
Pychnight opened this issue May 12, 2024 · 5 comments
Open
2 tasks done

[Bug]: CodeAgent issues with venv management #1739

Pychnight opened this issue May 12, 2024 · 5 comments
Labels
bug Something isn't working severity:low Minor issues, code cleanup, etc

Comments

@Pychnight
Copy link

Is there an existing issue for the same bug?

Describe the bug

Right now, it seems OpenDevin is really really bad at creating and managing virtual envs or testing them, I have tried claude, gpt4, gpt3.5. they all seem to get stuck when trying to run files.

python3 -m venv my_env
source my_env/bin/activate

There are also some other situations that that code agent completely forgets it has access to file creation, modification and other elements of being a agent. (this is already been reported in anther issue) and sometimes on chat gpt 3.5 it will get stuck in a endless loop of saying the same thing over and over without actually doing the task.

Current Version

opendevin:main

Installation and Configuration

create a test case around creating, modify and examining and running files within a venv within opendevin

Model and Agent

CodeAgent

Reproduction Steps

1- tell it to manage a file within a venv and tell it to create 4-5 files within that venv and tell it to resolve a error with a module 'sys' has no attribute 'warnoptions' error issue.
2- it will proceed and usually get to the point where it actually has to enter the venv and usually gets stuck around that and tends to get stuck trying to run the python file and never gets the next response / corrects it.

Logs, Errors, Screenshots, and Additional Context

No response

@Pychnight Pychnight added the bug Something isn't working label May 12, 2024
@xingyaoww
Copy link
Collaborator

enter the venv and usually gets stuck around that

What do you mean by gets stuck? Does the command line actually get stuck (hangs) - or the model just stuck in some sort of loops that did not get the task solved?

If former, i suspect it might has something to do with how pxssh works: when a venv is activated, there's a pre-fix added (e.g., (venv) $) which messes up pxssh's parsing. -- @iFurySt is working on an alternative paramiko to pxssh, which hopefully might fix this.

If latter, it will be great if you could provide some screenshots / trajectories of model / agent behavior to help us debugging issues.

@Pychnight
Copy link
Author

Pychnight commented May 13, 2024

visually looks it looks stuck / hanging / frozen.
Screenshot 2024-05-12 201807

it gets stuck on step 6 usually during the entry to a python file within a venv, it won't do anything else after step 6... the only way for it to get unstuck is restarting the agent to a new task, attempting to resume the same task will not have it progress any further then this specific step.

There is no error logs ether and can't really tell what the agent is thinking ether as it's a blank state.

seems likely the agent is misunderstanding the context of the message or the error confusing the entire sys to be missing rather then what the actual error.. it's last thoughts where before on step 5 was this

"To ensure the program works correctly, let's try running it:
COMMAND:
python main.py my_env
15:30:18 - OBSERVATION
CmdOutputObservation(content='Traceback (most recent call last):\r\n  File "/workspace/agentsystembot/main.py", line 155, in <module>\r\n    main()\r\n  File "/workspace/agentsystembot/main.py", line 113, in main\r\n    install_requirements(conda_env_name)\r\n  File "/workspace/agentsystembot/main.py", line 23, in install_requirements\r\n    subprocess.check_call(["conda", "create", "--name", conda_env_name, "python=3.9", "--yes"])\r\n  File "/usr/lib/python3.10/subprocess.py", line 364, in check_call\r\n    retcode = call(*popenargs, **kwargs)\r\n  File "/usr/lib/python3.10/subprocess.py", line 345, in call\r\n    with Popen(*popenargs, **kwargs) as p:\r\n  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__\r\n    self._execute_child(args, executable, preexec_fn, close_fds,\r\n  File "/usr/lib/python3.10/subprocess.py", line 1793, in _execute_child\r\n    for dir in os.get_exec_path(env))\r\n  File "/usr/lib/python3.10/os.py", line 630, in get_exec_path\r\n    import warnings\r\n  File "/usr/lib/python3.10/warnings.py", line 538, in <module>\r\n    _processoptions(sys.warnoptions)\r\nAttributeError: module \'sys\' has no attribute \'warnoptions\'', command_id=-1, command='python main.py my_env', exit_code=1, observation='run')"

which a user can see that it was trying to run a python file and solve the attribute error... but it thought "sys" module was missing rather then the more important " no attribute 'warnoptions'', " section of the error prompt. which after it executed this it went to step 6 which is where it froze.

EDIT: seems like your commit did sort of resolve this issue, though it seems to still failing on editing files within the venv
her questions or if you'd like me to review any other files in the agent project.", wait_for_response=True, action='message')
05:56:42 - opendevin:INFO: agent_controller.py:201 - Setting agent(CodeActAgent) state from AgentState.RUNNING to AgentState.AWAITING_USER_INPUT
05:56:42 - opendevin:INFO: session.py:40 - WebSocket disconnected, sid: 40979f94-1a8e-45f1-955b-4535cb6cbf45
INFO: connection closed

@SmartManoj
Copy link
Collaborator

can't really tell what the agent is thinking ether as it's a blank state.

ssh into the sandbox (port and pwd provided in the logs) or check python opendevin/runtime/docker/ssh_box.py to interact with sandbox.

@rbren rbren added the severity:low Minor issues, code cleanup, etc label May 14, 2024
@stanistolberg
Copy link

Same for me - it simply stocks at certain steps without telling me anything. Its not clear what happens there:
From Logs

STEP 7

16:36:11 - opendevin:INFO: prompt.py:158
INFO
HINT:
You should think about the command you just ran, what output it gave, and how that affects your plan.
16:36:13 - ACTION
**CmdRunAction**
COMMAND:
source evm_copy_trading_app/venv/bin/activate && pip install Flask

@xingyaoww
Copy link
Collaborator

xingyaoww commented May 15, 2024

I think this is an issue caused by pxssh -- I think pxssh works by trying to look for a command line prompt (and it is assumed to not change, e.g., username@hostname $). But when you activate an environment, it will typically change the prompt into something like (env_name) username@hostname $ which will break the existing parsing logic... We will try to fix it very soon :)

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:low Minor issues, code cleanup, etc
Projects
None yet
Development

No branches or pull requests

5 participants