Skip to content

fix(file_tools): pass docker_volumes to sandbox container config#687

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
manuelschipper:fix/file-tools-docker-volumes
Mar 10, 2026
Merged

fix(file_tools): pass docker_volumes to sandbox container config#687
teknium1 merged 1 commit intoNousResearch:mainfrom
manuelschipper:fix/file-tools-docker-volumes

Conversation

@manuelschipper
Copy link
Copy Markdown

Summary

file_tools.py creates its own Docker sandbox environment when read_file/search_files/write_file/patch runs before any terminal command. The container_config dict was missing docker_volumes, so the sandbox was created without any user volume mounts.

This means if a bot's first tool call in a session is a file operation (common — bots often read config files before running commands), the sandbox has no access to mounted data like heartbeat state, cron output, credentials, etc. All subsequent tools in that session reuse the same broken sandbox.

Root cause

PR #158 (feat: add docker_volumes config for custom volume mounts) added container_config passing to file_tools.py but forgot to include the docker_volumes key. terminal_tool.py has it correctly at line 872.

Changes

  • Add "docker_volumes": config.get("docker_volumes", []) to container_config in file_tools.py:_get_file_ops(), matching terminal_tool.py

How to reproduce

  1. Configure docker_volumes in config.yaml
  2. Start a session where the agent's first tool call is read_file (not terminal)
  3. The sandbox container has no user volume mounts → file not found
  4. If terminal runs first instead, sandbox is created correctly (with volumes) and file tools reuse it — masking the bug

Test plan

  • Before fix: read_file /home/pn/heartbeat-state/state.json → error (file not found)
  • After fix: read_file successfully reads the file through mounted volume

🤖 Generated with Claude Code

@manuelschipper manuelschipper force-pushed the fix/file-tools-docker-volumes branch from 4c3bdd5 to 8ab2167 Compare March 8, 2026 21:41
@manuelschipper
Copy link
Copy Markdown
Author

Depends on #431 (gateway docker_volumes bridge) — the env var this fix consumes is set by that PR.

@manuelschipper manuelschipper force-pushed the fix/file-tools-docker-volumes branch 2 times, most recently from 2ebb495 to 2e7608e Compare March 10, 2026 09:18
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 #158 (feat: add docker_volumes config).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@manuelschipper manuelschipper force-pushed the fix/file-tools-docker-volumes branch from 2e7608e to c3dec1d Compare March 10, 2026 09:18
@teknium1
Copy link
Copy Markdown
Contributor

Good catch @manuelschipper — verified against terminal_tool.py:886 which has the exact same line. Merged to main. Thanks! 🎉

@teknium1 teknium1 merged commit a2ea859 into NousResearch:main Mar 10, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants