feat: add docker_volumes config for custom volume mounts#158
Conversation
|
Thanks! |
|
Prefill wiring proof refreshed at 22:15 SAST. Configured at |
feat: add docker_volumes config for custom volume mounts
file_tools.py creates its own Docker sandbox when read_file/search_files runs before any terminal command. The container_config was missing docker_volumes, so the sandbox had no user volume mounts — breaking access to heartbeat state, cron output, and all other mounted data. Matches the existing pattern in terminal_tool.py:872. Missed in original PR NousResearch#158 (feat: add docker_volumes config). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
file_tools.py creates its own Docker sandbox when read_file/search_files runs before any terminal command. The container_config was missing docker_volumes, so the sandbox had no user volume mounts — breaking access to heartbeat state, cron output, and all other mounted data. Matches the existing pattern in terminal_tool.py:872. Missed in original PR NousResearch#158 (feat: add docker_volumes config). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: add docker_volumes config for custom volume mounts
file_tools.py creates its own Docker sandbox when read_file/search_files runs before any terminal command. The container_config was missing docker_volumes, so the sandbox had no user volume mounts — breaking access to heartbeat state, cron output, and all other mounted data. Matches the existing pattern in terminal_tool.py:872. Missed in original PR NousResearch#158 (feat: add docker_volumes config).
feat: add docker_volumes config for custom volume mounts
williamleonard123
left a comment
There was a problem hiding this comment.
Hermes Agent Review
Thanks for the focused PR. I found two blocking issues before this is safe to merge:
docker_volumesis not propagated when file tools are the first tool to create the container backend, so the new setting behaves inconsistently across tool entry points.- Malformed/non-list
TERMINAL_DOCKER_VOLUMESvalues crash_get_env_config()before the DockerEnvironment validation/warnings can run, contrary to the PR's stated edge-case handling.
Checks observed: gh pr checks reports no checks on the branch. I also verified the malformed env path locally with an import-level probe (TERMINAL_DOCKER_VOLUMES=not-json raises JSONDecodeError) and statically verified tools/file_tools.py omits docker_volumes from the container config it passes to _create_environment.
Please add coverage for terminal/file-tool environment creation with configured volumes and invalid config/env values.
| "container_memory": config.get("container_memory", 5120), | ||
| "container_disk": config.get("container_disk", 51200), | ||
| "container_persistent": config.get("container_persistent", True), | ||
| } |
There was a problem hiding this comment.
Blocking: this container_config omits docker_volumes, so if a file tool is the first tool to create the Docker environment for a task, _create_environment() receives volumes=[] and the configured mounts are never applied. Terminal-created Docker envs get the new config, but file-tool-created envs do not, making the feature order-dependent. Please pass docker_volumes: config.get("docker_volumes", []) here as well and add a regression test for file tools creating the Docker backend.
| "container_memory": int(os.getenv("TERMINAL_CONTAINER_MEMORY", "5120")), # MB (default 5GB) | ||
| "container_disk": int(os.getenv("TERMINAL_CONTAINER_DISK", "51200")), # MB (default 50GB) | ||
| "container_persistent": os.getenv("TERMINAL_CONTAINER_PERSISTENT", "true").lower() in ("true", "1", "yes"), | ||
| "docker_volumes": json.loads(os.getenv("TERMINAL_DOCKER_VOLUMES", "[]")), |
There was a problem hiding this comment.
Blocking: json.loads() is unguarded here, so a malformed/non-JSON env value (or a config value serialized with plain str() by an older caller) raises JSONDecodeError before the later DockerEnvironment validation can warn and fall back to []. The PR body says non-list values are warned and treated as empty, but _get_env_config() currently crashes all terminal/file tool initialization first. Please parse defensively, ensure the result is a list, and cover malformed JSON/non-list cases in tests.
Hermes Agent Review SummaryI posted a formal Changes Requested review with two inline discussion comments. Reposting the summary here for visibility:
Inline discussions:
Checks observed: GitHub reports no checks on the branch. I verified locally that Please add coverage for terminal/file-tool environment creation with configured volumes and invalid config/env values. |
Hermes Agent Re-reviewRe-reviewed PR #158 after the follow-up request. Current state:
Historical PR patch still shows the two issues I flagged earlier, but current
Conclusion: there is no further merge action to take on PR #158 because it is already merged and stale. My earlier |
feat: add docker_volumes config for custom volume mounts
file_tools.py creates its own Docker sandbox when read_file/search_files runs before any terminal command. The container_config was missing docker_volumes, so the sandbox had no user volume mounts — breaking access to heartbeat state, cron output, and all other mounted data. Matches the existing pattern in terminal_tool.py:872. Missed in original PR NousResearch#158 (feat: add docker_volumes config). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Adds support for mounting host directories into the Docker sandbox via a
docker_volumesconfig option. This enables use cases like giving the agent read access to its own session logs, codebase, or training data from inside the container.Changes
docker_volumestoenv_mappings. JSON-serialize list values before setting env vars (existingstr()conversion loses list structure).docker_volumesfrom env var withjson.loads(), pass throughcontainer_configtoDockerEnvironment.volumesparameter, validate entries, append as-vflags to docker run args. Fixeffective_imageNameError.container_configto_create_environment(was missing, so file tools in Docker mode didn't get resource config).Config example
Edge cases handled
docker_volumes: null→ empty listTested
:roand:rwpermissionsdocker_volumesis not set