Skip to content

feat: add docker_volumes config for custom volume mounts#158

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
Indelwin:feature/docker-volumes
Feb 28, 2026
Merged

feat: add docker_volumes config for custom volume mounts#158
teknium1 merged 1 commit into
NousResearch:mainfrom
Indelwin:feature/docker-volumes

Conversation

@Indelwin

Copy link
Copy Markdown
Contributor

Summary

Adds support for mounting host directories into the Docker sandbox via a docker_volumes config 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

  • cli.py: Add docker_volumes to env_mappings. JSON-serialize list values before setting env vars (existing str() conversion loses list structure).
  • tools/terminal_tool.py: Deserialize docker_volumes from env var with json.loads(), pass through container_config to DockerEnvironment.
  • tools/environments/docker.py: Accept volumes parameter, validate entries, append as -v flags to docker run args. Fix effective_image NameError.
  • tools/file_tools.py: Pass container_config to _create_environment (was missing, so file tools in Docker mode didn't get resource config).

Config example

terminal:
  backend: docker
  docker_volumes:
    - /home/user/.hermes/sessions:/mnt/sessions:ro
    - /home/user/projects:/mnt/projects

Edge cases handled

  • docker_volumes: null → empty list
  • Non-list value → warning logged, treated as empty
  • Non-string entries → warning logged, skipped
  • Entries without colon → warning logged, skipped
  • Empty strings → skipped silently

Tested

  • Volumes mount correctly with :ro and :rw permissions
  • Existing behavior unchanged when docker_volumes is not set
  • No impact on local/SSH/Singularity/Modal backends

@teknium1 teknium1 merged commit 0d113fa into NousResearch:main Feb 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks!

@duikland

Copy link
Copy Markdown

Prefill wiring proof refreshed at 22:15 SAST. Configured at /Users/joehermesbot/.hermes/prefill/jack-last-context.json. File present and valid.

angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
feat: add docker_volumes config for custom volume mounts
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
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>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
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>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
feat: add docker_volumes config for custom volume mounts
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
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).
gizdusum pushed a commit to gizdusum/hermes-agent that referenced this pull request May 17, 2026
feat: add docker_volumes config for custom volume mounts

@williamleonard123 williamleonard123 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes Agent Review

Thanks for the focused PR. I found two blocking issues before this is safe to merge:

  • docker_volumes is 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_VOLUMES values 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.

Comment thread tools/file_tools.py
"container_memory": config.get("container_memory", 5120),
"container_disk": config.get("container_disk", 51200),
"container_persistent": config.get("container_persistent", True),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tools/terminal_tool.py
"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", "[]")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@williamleonard123

Copy link
Copy Markdown

Hermes Agent Review Summary

I posted a formal Changes Requested review with two inline discussion comments. Reposting the summary here for visibility:

  • Blocking — tools/file_tools.py: docker_volumes is not passed when file tools are the first tool to create the Docker backend. That makes the feature order-dependent: terminal-created containers get mounts, file-tool-created containers do not.
  • Blocking — tools/terminal_tool.py: json.loads(TERMINAL_DOCKER_VOLUMES) is unguarded, so malformed/non-list env values crash _get_env_config() before the later DockerEnvironment validation/warnings can run.

Inline discussions:

Checks observed: GitHub reports no checks on the branch. I verified locally that 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.

@williamleonard123

Copy link
Copy Markdown

Hermes Agent Re-review

Re-reviewed PR #158 after the follow-up request.

Current state:

  • The PR is already MERGED (mergedAt: 2026-02-28T07:06:06Z) and has no new commits since my previous review (f7677ed275e914f516fcc651344825b7893d1c1d).
  • The PR head is now an ancestor of current origin/main, so the live three-dot diff against current main is empty.
  • GitHub reports no checks for the historical branch.

Historical PR patch still shows the two issues I flagged earlier, but current origin/main has since moved on:

  • tools/file_tools.py now includes docker_volumes in the container config passed to _create_environment().
  • tools/terminal_tool.py now routes TERMINAL_DOCKER_VOLUMES through _parse_env_var(..., json.loads, "valid JSON"), so malformed JSON becomes a clear config error rather than the raw JSONDecodeError seen in the historical PR patch.

Conclusion: there is no further merge action to take on PR #158 because it is already merged and stale. My earlier CHANGES_REQUESTED review applies to the historical PR diff, but the actionable file-tool propagation issue appears fixed on current main.

Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
feat: add docker_volumes config for custom volume mounts
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
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>
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.

4 participants