OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Fix constant error observations appearing in the logs

Open tofarr opened this issue 1 year ago • 1 comments

Now checking that .gitignore exists. before trying to filter based on its contents.

  • [X] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

I see the following constantly in the logs:

|21:13:47 - openhands:DEBUG: action_execution_server.py:166 - Running action:
    |FileReadAction(path='.gitignore', start=0, end=-1, thought='', action='read', security_risk=None)
    ...
    |21:13:47 - openhands:DEBUG: action_execution_server.py:168 - Action output:
    |**ErrorObservation**
    |File not found: /workspace/.gitignore. Your current working directory is /workspace.
    ...

The reason is that every time we call /list-files we try to filter based on the contents of .gitignore - so we get an error message every time we try to list files if there is no .gitignore.

This change checks that the .gitignore exists before trying to read it.


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:6e252fe-nikolaik   --name openhands-app-6e252fe   docker.all-hands.dev/all-hands-ai/openhands:6e252fe

tofarr avatar Dec 01 '24 21:12 tofarr

For some reason, one of the image builds got stuck for over 4h. I restarted them.

enyst avatar Dec 02 '24 00:12 enyst

I'm gonna punt on this one now as there does seem to be concerns about the additional overhead of a file existence check. Perhaps a more thorough refactor will allow a better solution

tofarr avatar Dec 05 '24 19:12 tofarr