OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Change Error message`Malformed paths not permitted` to something more descriptive

Open CuckooEXE opened this issue 1 year ago • 11 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
  • [X] I have checked the existing issues.

Describe the bug

After multiple times restarting the docker container, etc. the agent gets stuck on FileReadActions with an observation: Malformed paths not permitted

Current Version

$ docker image ls                                                                                                                                                                                               REPOSITORY                    TAG       IMAGE ID       CREATED        SIZE
ghcr.io/opendevin/opendevin   main      bd424f61e0c3   25 hours ago   2.51GB
ghcr.io/opendevin/sandbox     main      1c70cf6ee5a4   4 days ago     545MB

Installation and Configuration

  1. Installed the Ollama MacOS App from their site
  2. Ran launchctl setenv OLLAMA_HOST "0.0.0.0" and restarted the Ollama app
  3. Ran ollama run llama2 to pull the model
  4. Installed the Docker Desktop MacOS App from their site
  5. Created a run.sh
  6. Ran `./run.sh

run.sh content:

#!/bin/bash

export WORKSPACE_BASE=$(pwd)/workspace

docker run \
    --add-host host.docker.internal=host-gateway \
    -e LLM_API_KEY="ollama" \
    -e LLM_BASE_URL="do" \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 3000:3000 \
    ghcr.io/opendevin/opendevin:main

Model and Agent

  • Model: ollama/llama2
  • Agent: MonologueAgent

Reproduction Steps

  1. Run ./run.sh
  2. Go to localhost:3000/ in Safari
  3. Enter ollama/llama2 as the Model under settings
  4. Give the prompt Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

Logs, Errors, Screenshots, and Additional Context

(I hit CTRL+C between each run)

First run:

/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     192.168.65.1:50687 - "GET /index.html HTTP/1.1" 200 OK
INFO:     192.168.65.1:50687 - "GET /site.webmanifest HTTP/1.1" 200 OK
INFO:     ('192.168.65.1', 50688) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJkMTA0ZTllMC02ZmJkLTQzYjMtYWZhNC0wMGM3NGY5YTNiOTIifQ.th9bVekcgdfakERcyhSX582BAEHBKqkF4mZeTaLGmZI" [accepted]
INFO:     connection open
Starting loop_recv for sid: d104e9e0-6fbd-43b3-afa4-00c74f9a3b92
INFO:     192.168.65.1:50687 - "GET /api/refresh-files HTTP/1.1" 200 OK
INFO:     192.168.65.1:50687 - "GET /api/litellm-models HTTP/1.1" 200 OK
19:55:34 - opendevin:INFO: agent.py:144 - Creating agent MonologueAgent using LLM ollama/llama2
19:55:34 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/llama2
19:55:34 - opendevin:INFO: ssh_box.py:323 - Container stopped
19:55:34 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
19:55:34 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/axel/Desktop/opendevin/workspace
19:55:34 - opendevin:INFO: ssh_box.py:366 - Container started
19:55:35 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
19:55:35 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 54903 [email protected]` with the password 'c1ebcef3-e631-486b-a5fc-5831baee94a1' and report the issue on GitHub.
INFO:     192.168.65.1:50687 - "GET /api/agents HTTP/1.1" 200 OK
INFO:     192.168.65.1:50689 - "GET /api/messages/total HTTP/1.1" 200 OK


==============
STEP 0

19:55:44 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:55:54 - ACTION
AgentThinkAction(thought='Okay, so I need to figure out how to calculate the first 27 iterations of the Fibonacci sequence. I should start by writing a function that takes in the number of iterations as an argument and returns the corresponding values. Then I can use that function to calculate the first few iterations.', action='think')


==============
STEP 1

19:55:54 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:55:59 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:55:59 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words


==============
STEP 2

19:55:59 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:56:05 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:56:05 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words


==============
STEP 3

19:56:05 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:56:11 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:56:11 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words
19:56:11 - opendevin:INFO: agent_controller.py:121 - Loop detected, stopping task
19:56:11 - opendevin:INFO: agent_controller.py:162 - Task state set to TaskState.STOPPED

Second run:

/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     ('192.168.65.1', 50727) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJkMTA0ZTllMC02ZmJkLTQzYjMtYWZhNC0wMGM3NGY5YTNiOTIifQ.th9bVekcgdfakERcyhSX582BAEHBKqkF4mZeTaLGmZI" [accepted]
INFO:     connection open
Starting loop_recv for sid: d104e9e0-6fbd-43b3-afa4-00c74f9a3b92
INFO:     192.168.65.1:50728 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:50729 - "GET /index.html HTTP/1.1" 200 OK
19:57:09 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: d104e9e0-6fbd-43b3-afa4-00c74f9a3b92
INFO:     connection closed
INFO:     192.168.65.1:50729 - "GET /site.webmanifest HTTP/1.1" 200 OK
INFO:     ('192.168.65.1', 50730) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJkMTA0ZTllMC02ZmJkLTQzYjMtYWZhNC0wMGM3NGY5YTNiOTIifQ.th9bVekcgdfakERcyhSX582BAEHBKqkF4mZeTaLGmZI" [accepted]
INFO:     connection open
Starting loop_recv for sid: d104e9e0-6fbd-43b3-afa4-00c74f9a3b92
INFO:     192.168.65.1:50729 - "GET /api/refresh-files HTTP/1.1" 200 OK
INFO:     192.168.65.1:50729 - "GET /api/litellm-models HTTP/1.1" 200 OK
19:57:09 - opendevin:INFO: agent.py:144 - Creating agent MonologueAgent using LLM ollama/llama2
19:57:09 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/llama2
19:57:09 - opendevin:INFO: ssh_box.py:323 - Container stopped
19:57:09 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
19:57:09 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/axel/Desktop/opendevin/workspace
19:57:09 - opendevin:INFO: ssh_box.py:366 - Container started
19:57:10 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
19:57:10 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 50955 [email protected]` with the password 'f656bccb-a562-490f-82c0-bd8c53369ca7' and report the issue on GitHub.
INFO:     192.168.65.1:50731 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:50729 - "GET /api/agents HTTP/1.1" 200 OK


==============
STEP 0

19:57:19 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:57:24 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:57:24 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words


==============
STEP 1

19:57:24 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:57:30 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:57:30 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words


==============
STEP 2

19:57:30 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
19:57:35 - ACTION
FileReadAction(path='/usr/share/dict/words', start=0, end=-1, thoughts='', action='read')
19:57:35 - OBSERVATION
Malformed paths not permitted: /usr/share/dict/words
19:57:36 - opendevin:INFO: agent_controller.py:121 - Loop detected, stopping task
19:57:36 - opendevin:INFO: agent_controller.py:162 - Task state set to TaskState.STOPPED

Third run:

/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     192.168.65.1:50786 - "GET /index.html HTTP/1.1" 200 OK
INFO:     192.168.65.1:50786 - "GET /site.webmanifest HTTP/1.1" 200 OK
INFO:     ('192.168.65.1', 50787) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJkMTA0ZTllMC02ZmJkLTQzYjMtYWZhNC0wMGM3NGY5YTNiOTIifQ.th9bVekcgdfakERcyhSX582BAEHBKqkF4mZeTaLGmZI" [accepted]
INFO:     connection open
Starting loop_recv for sid: d104e9e0-6fbd-43b3-afa4-00c74f9a3b92
INFO:     192.168.65.1:50786 - "GET /api/refresh-files HTTP/1.1" 200 OK
19:58:21 - opendevin:INFO: agent.py:144 - Creating agent MonologueAgent using LLM ollama/llama2
19:58:21 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/llama2
19:58:21 - opendevin:INFO: ssh_box.py:323 - Container stopped
19:58:21 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
19:58:21 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/axel/Desktop/opendevin/workspace
19:58:21 - opendevin:INFO: ssh_box.py:366 - Container started
19:58:22 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
19:58:22 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 44597 [email protected]` with the password '83902fbb-c7f6-41cb-90bf-d9e571a1ea6e' and report the issue on GitHub.
INFO:     192.168.65.1:50786 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     192.168.65.1:50788 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:50786 - "GET /api/agents HTTP/1.1" 200 OK


==============
STEP 0

19:58:27 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:58:34 - ACTION
AgentThinkAction(thought='I should start by running `pwd` and `ls` to orient myself with the current directory and list the files and directories inside.', action='think')


==============
STEP 1

19:58:34 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:58:39 - ACTION
FileReadAction(path='/dev/null', start=0, end=-1, thoughts='', action='read')
19:58:39 - OBSERVATION
Malformed paths not permitted: /dev/null


==============
STEP 2

19:58:39 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:58:46 - ACTION
FileReadAction(path='/dev/null', start=0, end=-1, thoughts='I should start by running `pwd` and `ls` to orient myself with the current directory and list the files and directories inside.', action='read')
19:58:46 - OBSERVATION
Malformed paths not permitted: /dev/null


==============
STEP 3

19:58:46 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:58:51 - ACTION
FileReadAction(path='/dev/null', start=0, end=-1, thoughts='', action='read')
19:58:52 - OBSERVATION
Malformed paths not permitted: /dev/null


==============
STEP 4

19:58:52 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:58:57 - ACTION
FileReadAction(path='/dev/null', start=0, end=-1, thoughts='', action='read')
19:58:57 - OBSERVATION
Malformed paths not permitted: /dev/null


==============
STEP 5

19:58:57 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

19:59:03 - ACTION
FileReadAction(path='/dev/null', start=0, end=-1, thoughts='', action='read')
19:59:03 - OBSERVATION
Malformed paths not permitted: /dev/null
19:59:03 - opendevin:INFO: agent_controller.py:121 - Loop detected, stopping task
19:59:03 - opendevin:INFO: agent_controller.py:162 - Task state set to TaskState.STOPPED

Here is just using Ollama:

$ ollama run llama2
>>> Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
...
 Sure! Here is an example C program that calculates the first 27 iterations of the Fibonacci sequence and outputs the even values on stdout and the odd values on stderr:
``
#include <stdio.h>

int main() {
    int fibonacci[28]; // array to store the Fibonacci sequence
    int i, j;           // loop variables

    // initialize the Fibonacci sequence
    fibonacci[0] = 0;
    fibonacci[1] = 1;
    for (i = 2; i < 28; i++) {
        fibonacci[i] = fibonacci[i-1] + fibonacci[i-2];
    }

    // output the even values on stdout
    for (j = 0; j < 27; j++) {
        if (fibonacci[j] % 2 == 0) {
            printf("%d\n", fibonacci[j]);
        }
    }

    // output the odd values on stderr
    for (j = 0; j < 27; j++) {
        if (fibonacci[j] % 2 != 0) {
            fprintf(stderr, "%d\n", fibonacci[j]);
        }
    }

    return 0;
}
``
Explanation:

* The `int fibonacci[28];` line defines an array to store the Fibonacci sequence. The size of the array is 28, which is the maximum value of the sequence (i.e., the 27th iteration).
* The `int i, j;` lines declare two loop variables, `i` and `j`, which will be used to iterate over the Fibonacci sequence.
* The `// initialize the Fibonacci sequence` line initializes the first two terms of the Fibonacci sequence: `fibonacci[0] = 0;` and `fibonacci[1] = 1`.
* The `for (i = 2; i < 28; i++) { ... }` loop iterates over the remaining terms of the Fibonacci sequence, computing each term as `fibonacci[i] = fibonacci[i-1] + fibonacci[i-2]`.
* The `// output the even values on stdout` line uses a `for` loop to iterate over the even terms of the Fibonacci sequence (i.e., those with an odd number of 0s in their binary representation). Each term is
printed to stdout using `printf()`.
* The `// output the odd values on stderr` line uses a separate `for` loop to iterate over the odd terms of the Fibonacci sequence (i.e., those with an even number of 0s in their binary representation). Each
term is printed to stderr using `fprintf()`.

Note that the `//` lines are comment lines, which are ignored by the compiler and only serve to document the code.

CuckooEXE avatar Apr 30 '24 20:04 CuckooEXE

I can reproduce the behavior with ollama/llama2, first try. When I gave it a different algo, it did something else.

The thing is, the LLM is asking for those paths indeed. We recently implemented some additional security checks to disallow anything outside its workspace, so I can see why they fail... But why does the LLM ask for /usr/share/dict/words or /dev/null for a task like this?

FWIW, GPT-3.5 solved this in 14 steps, GPT-4 in 8 steps, including its verification (GPT-3.5 has some habit of repeating itself). GPT-4 was like:

STEP 0

00:00:10 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:16 - ACTION
CmdRunAction(command='pwd', background=False, action='run')
00:00:16 - OBSERVATION
/workspace

==============
STEP 1

00:00:16 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:19 - ACTION
CmdRunAction(command='ls', background=False, action='run')
00:00:19 - OBSERVATION
FourQueens.java  data.txt              hello_world.py    prime_numbers.py
==============
STEP 2

00:00:19 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:29 - ACTION
FileWriteAction(path='fibonacci.c', content='#include <stdio.h>\n\nint main() {\n    unsigned long long a = 0, b = 1, c;\n    for(int i = 0; i < 27; i++) {\n        c = a + b;\n        a = b;\n        b = c;\n        if(c % 2 == 0) {\n            printf("%llu\\n", c);\n        } else {\n            fprintf(stderr, "%llu\\n", c);\n        }\n    }\n    return 0;\n}\n', start=0, end=-1, thoughts='I will create a C file called fibonacci.c with the code needed to calculate the first 27 iterations of the fibonacci sequence and output even values to stdout and odd values to stderr.', action='write')
00:00:29 - OBSERVATION


==============
STEP 3

00:00:29 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:32 - ACTION
CmdRunAction(command='gcc fibonacci.c -o fibonacci && ./fibonacci', background=False, action='run')
00:00:33 - OBSERVATION
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811

==============
STEP 4

00:00:33 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:40 - ACTION
AgentThinkAction(thought="I have compiled and run the fibonacci.c program, but the output doesn't distinguish between stdout and stderr. To verify that even numbers are indeed being printed to stdout and odd numbers to stderr, I should redirect the output streams to separate files and inspect them.", action='think')


==============
STEP 5

00:00:40 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:43 - ACTION
CmdRunAction(command='gcc fibonacci.c -o fibonacci && ./fibonacci 2>stderr.txt 1>stdout.txt', background=False, action='run')
00:00:44 - OBSERVATION                                                         t


==============
STEP 6

00:00:44 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:47 - ACTION
FileReadAction(path='stderr.txt', start=0, end=-1, thoughts='I want to read stderr.txt to verify that it only contains odd values from the Fibonacci sequence.', action='read')
00:00:47 - OBSERVATION
1
3
5
13
21
55
89
233
377
987
1597
4181
6765
17711
28657
75025
121393
317811

==============
STEP 7

00:00:47 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:51 - ACTION
FileReadAction(path='stdout.txt', start=0, end=-1, thoughts='I want to read stdout.txt to verify that it only contains even values from the Fibonacci sequence.', action='read')
00:00:51 - OBSERVATION
2
8
34
144
610
2584
10946
46368
196418

==============
STEP 8

00:00:51 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:54 - ACTION
AgentThinkAction(thought='I have successfully created and executed a C program to generate the Fibonacci sequence, and confirmed that even values are being output to stdout and odd values to stderr by redirecting to separate files and inspecting them. As these were the requirements, my task is complete. It is now time to use the finish action.', action='think')


==============
STEP 9

00:00:54 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr
00:00:57 - ACTION
AgentFinishAction(outputs={}, action='finish')
00:00:57 - opendevin:INFO: agent_controller.py:232
INFO
AgentFinishAction(outputs={}, action='finish')
00:00:57 - opendevin:INFO: agent_controller.py:113 - Task finished by agent

We recently also tweaked the prompt a bit, but I don't see what would lead llama2 to this behavior. For the record, our prompt is something like this, with the task plugged in at the beginning: https://github.com/OpenDevin/OpenDevin/blob/main/tests/integration/mock/MonologueAgent/test_write_simple_script/prompt_001.log

enyst avatar Apr 30 '24 22:04 enyst

Interesting... I tried to use ollama/llama3 and it kept choking on

22:41:45 - ACTION
FileReadAction(path='/path/to/fibonacci.c', start=0, end=-1, thoughts='', action='read')
22:41:45 - OBSERVATION
Malformed paths not permitted: /path/to/fibonacci.c

I switched to ollama/mistral, and it had an even harder time with this:

Details
==============
STEP 0

22:47:27 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:47:34 - ACTION
NullAction(action='null')
22:47:34 - OBSERVATION
action={'action': 'think', 'thought': 'Let me write a C program to calculate the first 27 iterations of the Fibonacci sequence using recursion, store the even values in an array and output them on stdout, and store the odd values in another array and output them on stderr.'} has the wrong arguments


==============
STEP 1

22:47:34 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:47:41 - ACTION
AgentThinkAction(thought='Let me write the Fibonacci sequence calculator as a recursive function in C, then I will create two separate arrays to store even and odd numbers respectively. Lastly, I will make use of standard output (stdout) for even values and standard error (stderr) for odd values during output.', action='think')


==============
STEP 2

22:47:41 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:47:59 - ACTION
AgentThinkAction(thought='Write a C program to calculate the first 27 iterations of the Fibonacci sequence using recursion, store even values in an array and output them on stdout, and store odd values in another array and output them on stderr.', action='think')


==============
STEP 3

22:47:59 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:05 - ACTION
AgentThinkAction(thought='Write the Fibonacci sequence calculator function in C using recursion, create two arrays to store even and odd numbers respectively, and write separate functions to output even values on stdout and odd values on stderr.', action='think')


==============
STEP 4

22:48:05 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:12 - ACTION
AgentThinkAction(thought='Write the code for calculating Fibonacci sequence recursively in C, create two separate arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr.', action='think')


==============
STEP 5

22:48:12 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:19 - ACTION
AgentThinkAction(thought='Write the Fibonacci sequence calculator function in C using recursion, create two arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr.', action='think')


==============
STEP 6

22:48:19 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:26 - ACTION
AgentThinkAction(thought='Write the code for calculating Fibonacci sequence recursively in C, create two separate arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr.', action='think')


==============
STEP 7

22:48:26 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:33 - ACTION
AgentThinkAction(thought='Write the code for calculating Fibonacci sequence recursively in C, create two arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr. Then I will compile and test the code.', action='think')


==============
STEP 8

22:48:33 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:40 - ACTION
AgentThinkAction(thought='Write the code for the Fibonacci sequence calculator function in C using recursion, create two separate arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr. Then I will compile and test the code.', action='think')


==============
STEP 9

22:48:40 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:48 - ACTION
AgentThinkAction(thought='Write the C code for the Fibonacci sequence calculator function using recursion, create two separate arrays to store even and odd numbers respectively, and write functions to output even values on stdout and odd values on stderr. Then I will compile and test the code.', action='think')


==============
STEP 10

22:48:48 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:48:55 - ACTION
AgentThinkAction(thought="Write the code for the Fibonacci sequence calculator function using recursion in C, create a file named fib.c, and write the content of the file using the 'write' action.", action='think')


==============
STEP 11

22:48:55 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:12 - ACTION
FileWriteAction(path='./fib.c', content='// Fibonacci sequence calculator function using recursion\n#include <stdio.h>\nint fib(int n) {\n  if (n <= 1) {\n      return n;\n  } else {\n      return fib(n-1) + fib(n-2);\n  }\n}\n// Function to output even numbers on stdout and odd numbers on stderr\nvoid print_even_odd(int number, int is_even) {\n  if (is_even) {\n      printf("%d\\n", number);\n  } else {\n      fprintf(stderr, "%d\\n", number);\n  }\n}\n// Function to calculate and print even and odd Fibonacci numbers\nint main() {\n  int n = 10;\n  fib(n); // Calculate the nth Fibonacci number recursively\n  printf("Even numbers: ");\n  int even_number = fib(n-1) + fib(n-2); // Get the previous even and odd numbers\n  print_even_odd(even_number, true); // Output even number on stdout\n  print_even_odd(fib(n-1), false); // Output odd number on stderr\n  return 0;\n}\n', start=0, end=-1, thoughts='', action='write')
22:49:12 - OBSERVATION



==============
STEP 12

22:49:12 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:19 - ACTION
AgentThinkAction(thought='Compile the Fibonacci sequence calculator C code using gcc', action='think')


==============
STEP 13

22:49:19 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:25 - ACTION
CmdRunAction(command='gcc fib.c -o fib', background=False, action='run')
22:49:25 - OBSERVATION
fib.c: In function ‘main’:
fib.c:24:31: error: ‘true’ undeclared (first use in this function)
   24 |   print_even_odd(even_number, true); // Output even number on stdout
      |                               ^~~~
fib.c:3:1: note: ‘true’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
    2 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    3 | int fib(int n) {
fib.c:24:31: note: each undeclared identifier is reported only once for each function it appears in
   24 |   print_even_odd(even_number, true); // Output even number on stdout
      |                               ^~~~
fib.c:25:28: error: ‘false’ undeclared (first use in this function)
   25 |   print_even_odd(fib(n-1), false); // Output odd number on stderr
      |                            ^~~~~
fib.c:25:28: note: ‘false’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?


==============
STEP 14

22:49:25 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:32 - ACTION
NullAction(action='null')
22:49:32 - OBSERVATION
action={'action': 'think', 'thought': "I need to include the stdbool header in my fibonacci program before using the boolean value 'false'. I should also add error handling for when the input is negative."} has the wrong arguments


==============
STEP 15

22:49:32 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:38 - ACTION
NullAction(action='null')
22:49:38 - OBSERVATION
action={'action': 'think', 'thought': "I need to modify the fibonacci program to include `#include <stdbool.h>` at the top of the file before using the boolean value 'false'. I should also add error handling for negative inputs."} has the wrong arguments


==============
STEP 16

22:49:38 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:45 - ACTION
AgentThinkAction(thought='I need to modify the fibonacci program by including `#include <stdbool.h>` at the top of the file and handle negative inputs.', action='think')


==============
STEP 17

22:49:45 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:49:52 - ACTION
AgentThinkAction(thought='I need to modify the fibonacci program by including `#include <stdbool.h>` at the top of the file and handle negative inputs using an if statement before recursively calling `print_even_odd(fib(n), even);`', action='think')


==============
STEP 18

22:49:52 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:50:01 - ACTION
NullAction(action='null')
22:50:01 - OBSERVATION
'action['action']='edit'' is not defined. Available actions: dict_keys(['kill', 'run', 'browse', 'read', 'write', 'recall', 'think', 'finish', 'delegate', 'add_task', 'modify_task', 'push'])


==============
STEP 19

22:50:01 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:50:12 - ACTION
NullAction(action='null')
22:50:12 - OBSERVATION
'action['action']='edit'' is not defined. Available actions: dict_keys(['kill', 'run', 'browse', 'read', 'write', 'recall', 'think', 'finish', 'delegate', 'add_task', 'modify_task', 'push'])


==============
STEP 20

22:50:12 - PLAN
Write a C program that calculates the first 27 iterations of the fibonacci sequence, outputting the even values on stdout and the odd values on stderr

22:51:02 - ACTION
NullAction(action='null')
22:51:02 - OBSERVATION
Invalid JSON, the response must be well-formed JSON as specified in the prompt.
22:51:02 - opendevin:INFO: agent_controller.py:121 - Loop detected, stopping task
22:51:02 - opendevin:INFO: agent_controller.py:162 - Task state set to TaskState.STOPPED

I used gpt-4 and it ran in 9 steps for me. Looks like this is an Ollama issue?

CuckooEXE avatar Apr 30 '24 23:04 CuckooEXE

@CuckooEXE Did you check the llm logs in the logs folder and reproduce it?

SmartManoj avatar May 01 '24 10:05 SmartManoj

I have a similar problem. This is the error message I get:

Malformed paths not permitted: /path/to/output.txt

Here's my setup:

$ docker image ls
REPOSITORY                         TAG                IMAGE ID       CREATED         SIZE
ghcr.io/opendevin/opendevin        main               bd424f61e0c3   2 days ago      2.51GB
ghcr.io/opendevin/sandbox          main               1c70cf6ee5a4   5 days ago      545MB
$ ollama list
NAME        	ID          	SIZE  	MODIFIED
codellama:7b	8fdf8f752f6e	3.8 GB	2 hours ago

Here's the log:

Details

/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:160: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     192.168.65.1:46873 - "GET /index.html HTTP/1.1" 304 Not Modified
INFO:     ('192.168.65.1', 46874) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJjYjVhYzg1My0xZTMxLTQ5N2MtODgxMi03YTlkNjFmM2JlMDEifQ.0PpoRo_K4CxUhZNR4ir8p4rCBo0pD_q4819sSVhD2pQ" [accepted]
INFO:     connection open
17:12:20 - opendevin:INFO: agent.py:144 - Creating agent CoderAgent using LLM ollama/codellama
17:12:20 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/codellama
17:12:20 - opendevin:INFO: ssh_box.py:323 - Container stopped
17:12:20 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
17:12:20 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/emre/dev/ai/open-devin-env/workspace
17:12:20 - opendevin:INFO: ssh_box.py:366 - Container started
17:12:21 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
17:12:22 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 45267 [email protected]` with the password 'a7203a25-d260-4e03-a1fe-365d202ee2cc' and report the issue on GitHub.
Starting loop_recv for sid: cb5ac853-1e31-497c-8812-7a9d61f3be01
INFO:     192.168.65.1:46875 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:46876 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     192.168.65.1:46876 - "GET /api/agents HTTP/1.1" 200 OK
INFO:     192.168.65.1:46873 - "GET /api/refresh-files HTTP/1.1" 200 OK
17:12:28 - opendevin:INFO: agent.py:144 - Creating agent CoderAgent using LLM ollama/codellama:7b
17:12:28 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/codellama:7b
17:12:29 - opendevin:INFO: ssh_box.py:323 - Container stopped
17:12:29 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
17:12:29 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/emre/dev/ai/open-devin-env/workspace
17:12:29 - opendevin:INFO: ssh_box.py:366 - Container started
17:12:30 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
17:12:30 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 32937 [email protected]` with the password '69bb337d-80cb-48f8-b86f-33952f6565b2' and report the issue on GitHub.


==============
STEP 0

17:12:40 - PLAN
build a html snake game.
17:12:58 - ACTION
FileWriteAction(path='/path/to/output.txt', content='Hello World!', start=0, end=-1, thoughts='', action='write')
17:12:58 - OBSERVATION
Malformed paths not permitted: /path/to/output.txt


==============
STEP 1

17:12:58 - PLAN
build a html snake game.
17:13:35 - ACTION
NullAction(action='null')
17:13:35 - OBSERVATION
Invalid JSON in response. Please make sure the response is a valid JSON object
17:13:35 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: cb5ac853-1e31-497c-8812-7a9d61f3be01
INFO:     connection closed


==============
STEP 2

17:13:35 - PLAN
build a html snake game.
17:13:40 - ACTION
FileWriteAction(path='/path/to/output.txt', content='Hello World!', start=0, end=-1, thoughts='', action='write')
17:13:40 - OBSERVATION
Malformed paths not permitted: /path/to/output.txt


==============
STEP 3

17:13:40 - PLAN
build a html snake game.
17:14:17 - ACTION
NullAction(action='null')
INFO:     ('192.168.65.1', 47454) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJjYjVhYzg1My0xZTMxLTQ5N2MtODgxMi03YTlkNjFmM2JlMDEifQ.0PpoRo_K4CxUhZNR4ir8p4rCBo0pD_q4819sSVhD2pQ" [accepted]
INFO:     connection closed
17:14:17 - OBSERVATION
Invalid JSON in response. Please make sure the response is a valid JSON object
17:14:17 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: cb5ac853-1e31-497c-8812-7a9d61f3be01


==============
STEP 4

17:14:17 - PLAN
build a html snake game.
17:14:50 - ACTION
NullAction(action='null')
17:14:50 - OBSERVATION
Invalid JSON in response. Please make sure the response is a valid JSON object


==============
STEP 5

17:14:50 - PLAN
build a html snake game.
17:15:20 - ACTION
NullAction(action='null')
17:15:20 - OBSERVATION
Invalid JSON in response. Please make sure the response is a valid JSON object
17:15:20 - opendevin:INFO: agent_controller.py:121 - Loop detected, stopping task
17:15:20 - opendevin:INFO: agent_controller.py:162 - Task state set to TaskState.STOPPED
Starting loop_recv for sid: cb5ac853-1e31-497c-8812-7a9d61f3be01
INFO:     192.168.65.1:49414 - "DELETE /api/messages HTTP/1.1" 200 OK
INFO:     192.168.65.1:49414 - "GET /index.html HTTP/1.1" 304 Not Modified
INFO:     ('192.168.65.1', 49475) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJjYjVhYzg1My0xZTMxLTQ5N2MtODgxMi03YTlkNjFmM2JlMDEifQ.0PpoRo_K4CxUhZNR4ir8p4rCBo0pD_q4819sSVhD2pQ" [accepted]
INFO:     connection open
Starting loop_recv for sid: cb5ac853-1e31-497c-8812-7a9d61f3be01
INFO:     192.168.65.1:49477 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:49476 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     192.168.65.1:49477 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.65.1:49414 - "GET /api/refresh-files HTTP/1.1" 200 OK
INFO:     192.168.65.1:49477 - "GET /api/agents HTTP/1.1" 200 OK
17:21:02 - opendevin:INFO: agent.py:144 - Creating agent CoderAgent using LLM ollama/codellama:7b
17:21:02 - opendevin:INFO: llm.py:67 - Initializing LLM with model: ollama/codellama:7b
17:21:03 - opendevin:INFO: ssh_box.py:323 - Container stopped
17:21:03 - opendevin:WARNING: ssh_box.py:335 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
17:21:03 - opendevin:INFO: ssh_box.py:343 - Mounting workspace directory: /Users/emre/dev/ai/open-devin-env/workspace
17:21:04 - opendevin:INFO: ssh_box.py:366 - Container started
17:21:05 - opendevin:INFO: ssh_box.py:383 - waiting for container to start: 1, container status: running
17:21:05 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try `ssh -v -p 41941 [email protected]` with the password '38c1603c-74da-4299-8aa5-f6dff3ba898a' and report the issue on GitHub.
17:21:25 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: cb5ac853-1e31-497c-8812-7a9d61f3be01
INFO:     connection closed
INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [1]
17:21:29 - opendevin:INFO: manager.py:37 - Closing 1 agent(s)...
17:21:30 - opendevin:INFO: manager.py:37 - Saving sessions...
17:21:30 - opendevin:INFO: msg_stack.py:42 - Saving messages...

EmreErdogan avatar May 01 '24 18:05 EmreErdogan

@CuckooEXE Did you check the llm logs in the logs folder and reproduce it?

I’m not sur le what you mean, sorry. Reproduce what?

CuckooEXE avatar May 01 '24 20:05 CuckooEXE

I think the best solution here is to give a good error message back to the LLM--something like "You must only edit files inside the workspace"

rbren avatar May 02 '24 02:05 rbren

@CuckooEXE Did you check the llm logs in the logs folder and reproduce it?

I’m not sur le what you mean, sorry. Reproduce what?

Prompts and responses are stored in the logs/llm folder. Pass that to the model directly and ask why it gave that path.

SmartManoj avatar May 02 '24 03:05 SmartManoj

me too bug

spider-node avatar May 04 '24 17:05 spider-node

In Ubuntu's system, using Docker to start OpenDevin will automatically create the user OpenDevin opendevin@localhost After entering the container, it was found that opendevin did not have permission to operate files, resulting in continuous prompts such as paths not allowed during the use of opendvin

spider-node avatar May 04 '24 17:05 spider-node

same error here. Installed in WSL Ubuntu 22.0.4 with mamba.

Malformed paths not permitted: /home/opendevin/Documents/snake_game.py

action={'action': 'message', 'args': {'content': 'I think I should start by installing the necessary packages using sudo apt-get install.', 'thought': True}} has the wrong arguments

aminsaiful avatar May 08 '24 10:05 aminsaiful

In Ubuntu's system, using Docker to start OpenDevin will automatically create the user OpenDevin opendevin@localhost After entering the container, it was found that opendevin did not have permission to operate files, resulting in continuous prompts such as paths not allowed during the use of opendvin

I also encountered the same bug when deploying through docker under ubuntu22.04. Use CoderAgent

edisonzf2020 avatar May 10 '24 06:05 edisonzf2020