Skip to content

Commit 961c96a

Browse files
SmartManojisavita
andauthored
Added ssh_password to config setup (OpenHands#2139)
Co-authored-by: Aleksandar <[email protected]>
1 parent f4bc524 commit 961c96a

7 files changed

Lines changed: 18 additions & 2 deletions

File tree

Development.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ To configure the LM of your choice, follow these steps:
4545
make setup-config
4646
```
4747
This command will prompt you to enter the LLM API key, model name, and other variables ensuring that OpenDevin is tailored to your specific needs. Note that the model name will apply only when you run headless. If you use the UI, please set the model in the UI.
48+
Set `persist_sandbox` to false if you want to use clean sandbox for each task. If `persist_sandbox` is set to true, you will need to set the `ssh_password` as well.
4849

4950
**Note on Alternative Models:**
5051
Some alternative models may prove more challenging to tame than others. Fear not, brave adventurer! We shall soon unveil LLM-specific documentation to guide you on your quest. And if you've already mastered the art of wielding a model other than OpenAI's GPT, we encourage you to [share your setup instructions with us](https://github.com/OpenDevin/OpenDevin/issues/417).

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ setup-config-prompts:
226226
workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \
227227
echo "workspace_base=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp
228228

229+
@read -p "Do you want to persist the sandbox container? [true/false] [default: true]: " persist_sandbox; \
230+
persist_sandbox=$${persist_sandbox:-true}; \
231+
if [ "$$persist_sandbox" = "true" ]; then \
232+
read -p "Enter a password for the sandbox container: " ssh_password; \
233+
echo "ssh_password=\"$$ssh_password\"" >> $(CONFIG_FILE).tmp; \
234+
else \
235+
echo "persist_sandbox=\"$$persist_sandbox\"" >> $(CONFIG_FILE).tmp
236+
fi
237+
229238
@echo "" >> $(CONFIG_FILE).tmp
230239

231240
@echo "[llm]" >> $(CONFIG_FILE).tmp

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export WORKSPACE_BASE=$(pwd)/workspace;
6464
docker run -it \
6565
--pull=always \
6666
-e SANDBOX_USER_ID=$(id -u) \
67+
-e PERSIST_SANDBOX="true" \
6768
-e SSH_PASSWORD="make something up here" \
6869
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
6970
-v $WORKSPACE_BASE:/opt/workspace_base \

docs/modules/usage/intro.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ OpenDevin runs bash commands within a Docker sandbox, so it should not affect yo
7676
docker run -it \
7777
--pull=always \
7878
-e SANDBOX_USER_ID=$(id -u) \
79+
-e PERSIST_SANDBOX="true" \
7980
-e SSH_PASSWORD="make something up here" \
8081
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
8182
-v $WORKSPACE_BASE:/opt/workspace_base \

opendevin/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class AppConfig(metaclass=Singleton):
179179
disable_color: bool = False
180180
sandbox_user_id: int = os.getuid() if hasattr(os, 'getuid') else 1000
181181
sandbox_timeout: int = 120
182-
persist_sandbox: bool = True
182+
persist_sandbox: bool = False
183183
ssh_port: int = 63710
184184
ssh_password: str | None = None
185185
github_token: str | None = None

opendevin/runtime/docker/ssh_box.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def __init__(
228228
# set up random user password
229229
if config.persist_sandbox:
230230
if not config.ssh_password:
231-
raise Exception('Password must be set for persistent sandbox')
231+
raise Exception(
232+
'Please add ssh_password to your config.toml or add -e SSH_PASSWORD to your docker run command'
233+
)
232234
self._ssh_password = config.ssh_password
233235
self._ssh_port = config.ssh_port
234236
else:

tests/integration/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ where `conftest.py` defines the infrastructure needed to load real-world LLM pro
4242
and responses for mocking purpose. Prompts and responses generated during real runs
4343
of agents with real LLMs are stored under `mock/AgentName/TestName` folders.
4444

45+
**Note:** Set PERSIST_SANDBOX=false to use a clean sandbox for each test.
46+
4547
## Run Integration Tests
4648

4749
Take a look at `run-integration-tests.yml` to learn how integration tests are

0 commit comments

Comments
 (0)