Skip to content

[Bug]: Codex turns reset sandbox network access to false in Auto and Auto-accept-edits modes #13987

Description

@famesjranko

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On a Linux T3 server, open Settings > Providers for that environment and set Codex "Launch arguments" to -c sandbox_workspace_write.network_access=true.
  2. Start a new Codex thread in Auto mode.
  3. Ask the agent to run gh api user --jq .login.

Expected behavior

The command runs inside the workspace-write sandbox with network access, because Codex is configured with sandbox_workspace_write.network_access = true.

Actual behavior

The sandbox has no network access. The command fails:

Get "https://api.github.com/user": proxyconnect tcp: dial tcp 127.0.0.1:43117: socket: operation not permitted

The Codex rollout for the turn records "sandbox_policy":{"type":"workspace-write","network_access":false,...}. The codex app-server process does have -c sandbox_workspace_write.network_access=true on its command line.

The thread starts with the correct policy. I sent the same thread/start request that T3 sends (sandbox: "workspace-write", approvalPolicy: "on-request") to a separate codex app-server started with the same -c argument. The response contained "networkAccess": true.

The value changes at the turn. buildTurnStartParams sends sandboxPolicy: runtimeModeToTurnSandboxPolicy(input.runtimeMode) on every turn. For Auto and Auto-accept-edits, that function returns { type: "workspaceWrite" } with no networkAccess field. Codex treats the missing field as false, and the turn policy replaces the thread policy that came from the configuration.

function runtimeModeToTurnSandboxPolicy(
input: RuntimeMode,
): EffectCodexSchema.V2TurnStartParams__SandboxPolicy {
switch (input) {
case "approval-required":
return {
type: "readOnly",
};
case "auto-accept-edits":
case "auto":
return {
type: "workspaceWrite",
};
case "full-access":
default:
return {
type: "dangerFullAccess",
};
}
}
function buildCodexTurnInstructions(input: {
readonly interactionMode?: ProviderInteractionMode;

sandboxPolicy: runtimeModeToTurnSandboxPolicy(input.runtimeMode),

As a result, the documented Codex setting and T3's own Launch arguments field have no effect in sandboxed modes. The only mode with network access is Full access, which removes the sandbox and all approvals. gh auth status also reports this failure as "The token in ... is invalid", which is misleading.

A possible fix is to build the turn policy from the thread's effective sandbox value, which thread/start returns, and change only its type. Another option is to send sandboxPolicy only when the runtime mode changes. Either option keeps the user's Codex settings for network access and writable roots.

Impact

Major degradation or frequent failure

Version or commit

T3 server 0.0.42; same code on main at 6391be2

Environment

T3 server on Debian 13 as a systemd user service; T3 desktop 0.0.42 on Windows as a remote client; Codex CLI 0.157.0; Auto mode

Logs or stack traces

Codex rollout turn_context for the failing turn:

"approval_policy": "on-request",
"approvals_reviewer": "auto_review",
"sandbox_policy": {"type": "workspace-write", "network_access": false, "exclude_tmpdir_env_var": false, "exclude_slash_tmp": false}

Screenshots, recordings, or supporting files

No response

Workaround

None in a sandboxed mode. Escalated commands can reach the network after approval.

Related: #6415, which asked for Codex sessions to inherit configured permission profiles and was moved to Discussions.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions