Skip to content

fix(gateway): bridge terminal.docker_extra_args to env for gateway sessions (#30415) - #30887

Closed
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/30415-docker-extra-args-gateway-v2
Closed

Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/30415-docker-extra-args-gateway-v2

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #30415 — adds the missing docker_extra_args entry to gateway/run.py's _terminal_env_map, bridging the terminal.docker_extra_args config key to the TERMINAL_DOCKER_EXTRA_ARGS env var.

Why is this needed?

config.yaml's terminal.docker_extra_args is silently dropped when the gateway spawns per-session sandbox containers. Every other terminal.docker_* key in that block IS bridged, so users reasonably expect this one to be too. Net effect: sandbox containers spawn without documented extra args (bind mounts, devices, capabilities).

Root cause

The _terminal_env_map in gateway/run.py omits docker_extra_args. The existing list/dict serialization logic (lines 482-485) already handles the encoding — only the map entry was missing.

How to test

  1. Set terminal.docker_extra_args in config.yaml
  2. Run via gateway with docker backend
  3. Verify the argument reaches the spawned container

Existing env-bridge test passes.

Checklist

  • Bug fix (non-breaking change)
  • One logical change per PR
  • Follows codebase style
  • No new dependencies
  • CONTRIBUTING.md guidelines followed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery backend/docker Docker container execution labels May 23, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Duplicate of #30629 (closed, same fix). Superseded by #28891 which is the superset fix bridging both docker_extra_args AND docker_forward_env to all three config-env maps. This PR only covers one map entry.

@Tranquil-Flow
Tranquil-Flow force-pushed the fix/30415-docker-extra-args-gateway-v2 branch 2 times, most recently from af9e18c to 95fee8b Compare May 25, 2026 09:12
…ssions (NousResearch#30415)

The _terminal_env_map in gateway/run.py bridges terminal.* config keys
into TERMINAL_* env vars at gateway startup so the agent process can
read them. docker_extra_args was the only docker_* key missing from
this map, causing it to be silently dropped in gateway mode.

The existing serialization logic at run.py:482-485 already handles
list/dict values by JSON-encoding them before export, so no additional
encoding logic is needed.
@Tranquil-Flow
Tranquil-Flow force-pushed the fix/30415-docker-extra-args-gateway-v2 branch from 95fee8b to cadb7fa Compare May 25, 2026 11:02
@benbarclay

Copy link
Copy Markdown
Contributor

Closing as obsolete — the terminal.docker_* config→env bridge this adds is already complete and test-pinned on main. Both bridge maps carry the docker keys (cli.py env_mappings and gateway/run.py _terminal_env_map), and tests/tools/test_terminal_config_env_sync.py pins them via test_docker_extra_args_is_bridged_everywhere / test_docker_env_is_bridged_everywhere / test_docker_forward_env_is_bridged_everywhere / test_docker_volumes_is_bridged_everywhere (all passing). So terminal.docker_extra_args / docker_env / docker_forward_env set in config.yaml already reach TERMINAL_DOCKER_* for both CLI/TUI and gateway sessions. Thanks for the contribution — the gap it targeted has since been closed in-tree.

(Note for maintainers: the consumer-side gap where code_execution/file_tools sandboxes drop docker_env/docker_extra_args is a separate issue, tracked via #35937 — not closed here.)

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

Labels

backend/docker Docker container execution comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: terminal.docker_extra_args silently ignored in gateway mode (missing env-var bridge)

3 participants