Get RUN_AS_DEVIN working with app sandbox
The reason why RUN_AS_DEVIN was not working properly is that SANDBOX_USER_ID is not properly setted up. os.getpid() from the app container will return UID=0, which creates the issue of https://github.com/OpenDevin/OpenDevin/issues/936.
This PR fix:
- Allowing
RUN_AS_DEVINwith app container. The caveat is that the user need to pass-in their UID when starting theappcontainer. I have updated the readme accordingly
docker run \
-e LLM_API_KEY \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
-e SANDBOX_USER_ID=$(id -u) \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 4000:3000 \
--add-host host.docker.internal=host-gateway \
ghcr.io/opendevin/opendevin:latest
- Make
SANDBOX_USER_IDconsistent: theappwill run with a user with UID ofSANDBOX_USER_ID,which won't cause a permission issue in writing toworkspace; thesandboxwill run with a UID ofSANDBOX_USER_IDas well.
Seems integration tests have captured a bug?https://github.com/OpenDevin/OpenDevin/actions/runs/8866160837/job/24343257827?pr=1426#step:6:66:
chmod: changing permissions of 'hello.sh': Operation not permitted
Good catch! Seems like a mounting issue, already pushed a fix see if we can pass that https://github.com/moby/moby/issues/2259#issuecomment-51535443
Codecov Report
Attention: Patch coverage is 66.66667% with 2 lines in your changes are missing coverage. Please review.
:exclamation: No coverage uploaded for pull request base (
main@31c1a2d). Click here to learn what that means.
:exclamation: Current head b4d74c6 differs from pull request most recent head ec8e5ca. Consider uploading reports for the commit ec8e5ca to get more accurate results
| Files | Patch % | Lines |
|---|---|---|
| opendevin/sandbox/docker/ssh_box.py | 66.66% | 2 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## main #1426 +/- ##
=======================================
Coverage ? 58.46%
=======================================
Files ? 82
Lines ? 3431
Branches ? 0
=======================================
Hits ? 2006
Misses ? 1425
Partials ? 0
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for doing this!