Skip to content

fix(docker): make cwd workspace mount explicit opt-in#1534

Merged
teknium1 merged 3 commits into
mainfrom
fix/1445-docker-cwd-optin
Mar 16, 2026
Merged

fix(docker): make cwd workspace mount explicit opt-in#1534
teknium1 merged 3 commits into
mainfrom
fix/1445-docker-cwd-optin

Conversation

@teknium1

@teknium1 teknium1 commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • salvage Bartok9's substantive Docker cwd-mount fix from PR fix(docker): auto-mount host CWD to /workspace #1504
  • change the behavior so Docker sandbox cwd mounting is explicit opt-in via terminal.docker_mount_cwd_to_workspace: true
  • keep the secure default off so Docker sandboxes do not receive the host working directory unless the operator deliberately enables it
  • document exactly how to enable it in config.yaml, cli-config.yaml.example, and the config/env docs
  • make file-tool-created Docker environments honor the same opt-in behavior

Contributor credit

Test plan

  • source .venv/bin/activate && python -m pytest tests/tools/test_docker_environment.py tests/tools/test_modal_sandbox_fixes.py tests/hermes_cli/test_set_config_value.py -n0 -q
  • source .venv/bin/activate && python -m pytest tests/tools/ -n0 -q
  • cd website && npx docusaurus build
  • source .venv/bin/activate && python -m pytest tests/ -n0 -q # one unrelated existing failure remains: tests/test_api_key_providers.py::TestResolveProvider::test_auto_detects_minimax_cn_key

bartokmagic and others added 3 commits March 16, 2026 05:20
Fixes #1445 — When using Docker backend, the user's current working
directory is now automatically bind-mounted to /workspace inside the
container. This allows users to run `cd my-project && hermes` and have
their project files accessible to the agent without manual volume config.

Changes:
- Add host_cwd and auto_mount_cwd parameters to DockerEnvironment
- Capture original host CWD in _get_env_config() before container fallback
- Pass host_cwd through _create_environment() to Docker backend
- Add TERMINAL_DOCKER_NO_AUTO_MOUNT env var to disable if needed
- Skip auto-mount when /workspace is already explicitly mounted
- Add tests for auto-mount behavior
- Add documentation for the new feature

The auto-mount is skipped when:
1. TERMINAL_DOCKER_NO_AUTO_MOUNT=true is set
2. User configured docker_volumes with :/workspace
3. persistent_filesystem=true (persistent sandbox mode)

This makes the Docker backend behave more intuitively — the agent
operates on the user's actual project directory by default.
Keep Docker sandboxes isolated by default. Add an explicit terminal.docker_mount_cwd_to_workspace opt-in, thread it through terminal/file environment creation, and document the security tradeoff and config.yaml workflow clearly.
Make the new Docker cwd-mount tests pass in CI environments that do not have the minisweagent package installed by injecting a fake module instead of monkeypatching an import path that may not exist.
@teknium1 teknium1 merged commit 7d2c786 into main Mar 16, 2026
2 checks passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…r-cwd-optin

fix(docker): make cwd workspace mount explicit opt-in
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…r-cwd-optin

fix(docker): make cwd workspace mount explicit opt-in
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…r-cwd-optin

fix(docker): make cwd workspace mount explicit opt-in
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…r-cwd-optin

fix(docker): make cwd workspace mount explicit opt-in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants