Skip to content

fix: honor sandbox_workspace_write.network_access from user config - #613

Open
joscarras wants to merge 1 commit into
openai:mainfrom
innviweb:fix/honor-sandbox-network-access
Open

fix: honor sandbox_workspace_write.network_access from user config#613
joscarras wants to merge 1 commit into
openai:mainfrom
innviweb:fix/honor-sandbox-network-access

Conversation

@joscarras

Copy link
Copy Markdown

Problem

Codex jobs dispatched from Claude Code have no network access, even when the user's ~/.codex/config.toml sets:

[sandbox_workspace_write]
network_access = true

Running codex exec --sandbox workspace-write directly on the same machine with the same config does get network — so the setting works, it is just not honored on the plugin's app-server path.

Root cause: the plugin sets the sandbox per thread in thread/start / thread/resume params, which overrides the config file, and never passes the user's network setting through. The protocol already supports it: ThreadStartParams and ThreadResumeParams both accept a free-form config object.

Fix

  • On first use of an app-server client, read the effective user config via config/read (same call shape the plugin already uses for auth status).
  • If sandbox_workspace_write.network_access is exactly true, pass { sandbox_workspace_write: { network_access: true } } as the thread config override on both start and resume.
  • Anything else — false, key absent, section null, or the read failing — leaves the params byte-for-byte as before, so stock behavior is unchanged for everyone who hasn't opted in.
  • The result is cached per client (one config/read per broker process).

No new dependencies, no TOML parsing — the app-server resolves the config, including project layers via cwd.

Tests

npm test: 93 pass / 0 fail. New coverage: start + resume with access enabled assert the override reaches the (fake) app-server; disabled / absent / null-section / read-failure each assert no config key is sent.

The app-server path sets the sandbox per thread, which overrides
~/.codex/config.toml — so a user's network_access = true is silently
ignored and dispatched jobs get no network, even though codex exec
honors the same config on the same machine.

Read the effective config through the app-server's config/read and,
when the user has explicitly enabled workspace-write network access,
pass it through the thread config override on both thread/start and
thread/resume.

- config is read once per app-server client (cached promise, WeakMap)
- the override is sent only when network_access is exactly true;
  disabled, absent, null, or unreadable config leaves params unchanged
- tests cover start+resume with access enabled and every fall-through
  case (disabled / absent / null sandbox section / config read failure)
@joscarras
joscarras requested a review from a team August 7, 2026 20:41
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.

1 participant