Skip to content

fix(docker): pass RPC dir through exec env#13342

Open
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/fix-13142-docker-rpc-dir
Open

fix(docker): pass RPC dir through exec env#13342
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/fix-13142-docker-rpc-dir

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #13142.

Root cause:
execute_code set HERMES_RPC_DIR only through the remote shell prefix. On Docker, the file-based hermes_tools RPC bridge also needs the RPC directory in the container execution environment; without it, tool calls from inside execute_code could silently resolve to the wrong default and report tool_calls_made: 0.

Fix summary:

  • Thread optional per-call extra_env through the execution environment interface.
  • Pass HERMES_RPC_DIR as extra_env when running the remote execute_code script, while keeping the existing shell prefix for compatibility.
  • Apply extra_env to Docker via docker exec -e KEY=value and to the local backend via the subprocess environment.
  • Update other environment backends to accept the optional argument without changing their existing shell-prefix behavior.
  • Add regressions proving execute_code passes the RPC dir through extra_env and Docker turns it into docker exec -e HERMES_RPC_DIR=....

Tests:

  • uv run --frozen --python 3.11 --extra dev pytest -o addopts= tests/tools/test_code_execution.py tests/tools/test_docker_environment.py -q -> 83 passed, 1 warning
  • git diff --check -- tools/code_execution_tool.py tools/environments/base.py tools/environments/docker.py tools/environments/local.py tools/environments/ssh.py tools/environments/modal.py tools/environments/daytona.py tools/environments/singularity.py tests/tools/test_code_execution.py tests/tools/test_docker_environment.py

Note:

  • The warning is the existing fake-Popen drain-thread warning in tests/tools/test_docker_environment.py; the targeted suite passed.

@sgaofen sgaofen force-pushed the codex/fix-13142-docker-rpc-dir branch from 4be8831 to 796e2f2 Compare April 21, 2026 05:31
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists backend/docker Docker container execution tool/code-exec execute_code sandbox labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13537 which addresses the same root cause (HERMES_RPC_DIR not in container env). Review both PRs for potential overlap.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #13537 which addresses the same root cause (HERMES_RPC_DIR not in container env). Review both PRs for potential overlap.

@sgaofen

sgaofen commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for flagging the overlap. I compared this with #13537: this PR keeps the fix in the per-call execute path by forwarding HERMES_RPC_DIR through the environment backend's extra_env plumbing, with coverage in both code execution and Docker exec tests. #13537 takes a task-specific Docker RPC-dir approach and also updates Docker environment creation. I’m happy to defer or adapt if maintainers prefer that direction; otherwise this PR is the narrower patch for the container-env propagation path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/docker Docker container execution P2 Medium — degraded but workaround exists tool/code-exec execute_code sandbox type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: execute_code silently returns tool_calls_made: 0 on Docker backend — HERMES_RPC_DIR not set in docker run

2 participants