codex exec with danger-full-access still hits EPERM/loopback restrictions while interactive Codex in same shell succeeds

Open 💬 3 comments Opened Mar 24, 2026 by timoch
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

codex exec on Linux/WSL2 appears to run commands under materially different runtime restrictions than an interactive codex session, even when both are launched from the same ordinary shell and the exec run is configured with -a never -s danger-full-access.

In the same shell on the same machine:

  • direct interactive Codex session: pnpm test:integration passes
  • nested non-interactive codex exec --json --output-schema --output-last-message -: the same integration suite fails with EPERM / loopback / interface enumeration / Chromium sandbox errors

This surfaced for me through Taskward, which launches Codex exactly this way for agent execution, but I reproduced it directly without Taskward by invoking codex exec myself.

Environment

  • Codex CLI: 0.116.0
  • OS: Linux lemnos 6.6.87.2-microsoft-standard-WSL2 x86_64
  • Shell: bash
  • Launched from a normal shell prompt, not CI

Repro

From a repository that contains an integration suite with local process spawning, localhost binding, and Playwright browser coverage:

codex -a never -s danger-full-access exec \
  --json \
  --output-schema /tmp/final-result.schema.json \
  --output-last-message /tmp/final-result.json \
  -

Prompt:

Run `pnpm test:integration` from the repository root and report whether it passed. Do not modify repository files.

I reproduced this from /home/timoch/taskward.

Expected

If danger-full-access is set, I expect the nested codex exec run to have command/runtime behavior consistent with the interactive Codex session launched from the same shell, or at least for the docs to explain any remaining restrictions.

Actual

The outer codex exec process itself completes and writes JSONL progress plus the sidecar result, but the command it runs fails with permission/runtime errors that do not occur when running the same command directly in the interactive Codex session.

Observed failures inside the nested codex exec run included:

spawnSync /home/timoch/.nvm/versions/node/v22.17.1/bin/node EPERM
uv_interface_addresses returned Unknown system error 1
listen EPERM: operation not permitted 127.0.0.1
sandbox_host_linux.cc:41 ... Operation not permitted (1)

The suite summary from the nested run was:

  • 19 failed test files
  • 17 passed test files
  • 73 failed tests
  • 108 passed tests
  • 4 skipped tests

Important control case

In this same environment, outside codex exec, I ran the same integration suite directly and it passed:

pnpm test:integration

Result:

  • 36 passed test files
  • 185 passed tests
  • exit code 0

So this does not look like a repository bug. It looks like a behavioral difference in the nested codex exec runtime.

Notes

There is a possibly related issue, but it is narrower in scope:

  • #8343 (tsx IPC pipe fails in Codex sandbox with EPERM)

My repro is broader:

  • it happens under danger-full-access
  • it affects node child process spawning, interface enumeration, localhost listen/bind behavior, and Playwright/Chromium
  • it is specifically the difference between interactive Codex and nested codex exec

Question

Is codex exec --sandbox danger-full-access still expected to run commands under a different Linux isolation path than interactive codex? If so, can that behavior be documented? If not, this seems like a bug/regression in the non-interactive execution path.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14068
  • #15310
  • #15305
  • #15524
  • #15309

Powered by Codex Action

timoch · 5 months ago

I reviewed the automatic duplicate suggestions.

Closest related issues:

  • #15524: closest in shape because it is also about nested codex exec behaving differently under Linux. But that report is the opposite failure mode: -s read-only is unexpectedly too permissive, while this issue is danger-full-access still being unexpectedly restrictive.
  • #14068: same broad family of sandbox-propagation problems, but that one is specifically codex app-server, not codex exec.

The other suggestions (#15310, #15305, #15309) look related at the “sandbox/runtime policy propagation” level, but they are different product surfaces and different mechanisms.

So I think this issue is best treated as related to those reports rather than a duplicate of them.

timoch · 5 months ago

Additional finding from a direct repro on the same machine:

  • codex -a never -s danger-full-access exec --json --output-schema ... --output-last-message ... -
  • nested run fails
  • pnpm test:integration exits 1
  • failures include spawnSync ... node EPERM, uv_interface_addresses returned Unknown system error 1, listen EPERM, and Chromium sandbox errors
  • codex --dangerously-bypass-approvals-and-sandbox exec --json --output-schema ... --output-last-message ... -
  • nested run passes
  • pnpm test:integration exits 0
  • 36 test files passed, 185 tests passed

So this looks narrower than “non-interactive exec is broken”:
exec itself works here, and the fully bypassed exec path works here. The problem appears to be specifically the exec behavior under -s danger-full-access.

That makes the comparison set:

  • interactive codex -a never -s danger-full-access: passes
  • non-interactive codex exec -a never -s danger-full-access: fails
  • non-interactive codex exec --dangerously-bypass-approvals-and-sandbox: passes