fix(docker): auto-mount host CWD to /workspace#1504
Closed
Bartok9 wants to merge 2 commits into
Closed
Conversation
Fixes NousResearch#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.
This was referenced Mar 16, 2026
The auto-mount tests require minisweagent to be available for mocking. In CI environments where the git submodule isn't initialized, these tests would fail with ModuleNotFoundError. This follows the pattern used by test_modal_sandbox_fixes.py for checking minisweagent availability before running tests that depend on it.
Contributor
|
Superseded by PR #1534 (merged), which implements CWD workspace mounting as explicit opt-in rather than auto-mount by default. Thanks for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1445 — When using Docker backend, the user's current working directory is now automatically bind-mounted to
/workspaceinside the container.Problem
Users running
hermesfrom their project directory expected their files to be accessible inside the Docker container. Instead,/workspacewas either:The user had to manually configure
docker_volumesto mount their directory, which was unintuitive.Solution
Automatically mount the host's current working directory to
/workspacewhen:host_cwdis a valid directory/workspaceis not already mounted by user config or persistent modeNew Parameters
Opt-out
Set
TERMINAL_DOCKER_NO_AUTO_MOUNT=trueto disable auto-mounting if you prefer the isolated sandbox behavior.Changes
tools/environments/docker.py: Addhost_cwdandauto_mount_cwdparameters, auto-mount logictools/terminal_tool.py: Capturehost_cwdin config, pass to_create_environment()tests/tools/test_docker_environment.py: Add tests for auto-mount behaviorwebsite/docs/user-guide/configuration.md: Document the featureTest plan
User Experience
Before:
After: