Skip to content

fix(codex): run agents with danger-full-access (no bubblewrap) - #230

Merged
aterrylu merged 1 commit into
mainfrom
terry/codex-sandbox-fix
Jun 20, 2026
Merged

fix(codex): run agents with danger-full-access (no bubblewrap)#230
aterrylu merged 1 commit into
mainfrom
terry/codex-sandbox-fix

Conversation

@aterrylu

Copy link
Copy Markdown
Owner

Problem

A1 (#228) split Codex spawns into an app-server daemon + a codex --remote TUI, and set the sandbox to danger-full-access only on the daemon. But the TUI creates the thread and forces its own default (workspace-write), which on Linux emits:

warning: Codex could not find bubblewrap on PATH...

So autonomous Codex agents on Linux still ran sandboxed (and wanted bwrap), contrary to intent — autonomOS is the trust boundary and shouldn't use Codex's OS sandbox at all.

Root cause (verified on forge / Linux, no bwrap installed)

Codex's sandbox is negotiated at two layers and they must agree. Matrix:

daemon TUI bubblewrap
-c sandbox_mode=dfa (= A1) plain WARN
plain -s dfa ⚠ WARN
-c sandbox_mode=dfa -s danger-full-access ✅ none
-c sandbox_mode=dfa --dangerously-bypass-approvals-and-sandbox ✅ none

Fix

  • Daemon (buildSidecar): always -c sandbox_mode="danger-full-access" (was autonomous-only). -c approval_policy="never" stays autonomous-only.
  • TUI (buildArgs): autonomous → --dangerously-bypass-approvals-and-sandbox (the CC --dangerously-skip-permissions equivalent — no approvals + no sandbox); supervised → -s danger-full-access (no sandbox, keep approval prompts).

Net: no bubblewrap ever; approvals bypassed for autonomous, kept for supervised.

Testing

  • Unit tests updated (both layers, both modes); full server suite green, biome + tsc clean.
  • Verified end-to-end on forge: the autonomous combo (daemon -c dfa + TUI --dangerously-bypass-approvals-and-sandbox) and the supervised combo (-s danger-full-access) both run a real echo with no bubblewrap warning.

🤖 Generated with Claude Code

A1 set the Codex sandbox to danger-full-access only on the app-server daemon,
but the `--remote` TUI creates the thread and forces its own default
(workspace-write) — so on Linux the agent still emitted "could not find
bubblewrap on PATH". Verified on forge (Linux, no bwrap installed): the OS
sandbox must be disabled on BOTH layers or one loses to the other's default.

- Daemon (buildSidecar): ALWAYS `-c sandbox_mode="danger-full-access"` (was
  autonomous-only); `-c approval_policy="never"` stays autonomous-only.
- TUI (buildArgs): autonomous -> `--dangerously-bypass-approvals-and-sandbox`
  (the CC --dangerously-skip-permissions equivalent: no approvals + no sandbox);
  supervised -> `-s danger-full-access` (no sandbox, keep approval prompts).

autonomOS is the trust boundary; we never want Codex's OS sandbox. Tests
updated; full suite green, biome + tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qfhGLXBWPQM8a2ixVrnZY
@aterrylu
aterrylu enabled auto-merge (squash) June 20, 2026 11:17

@nox-0x nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — clean two-layer fix to a real bug from #228 (daemon-only sandbox flag loses to the TUI's workspace-write default; both layers must agree). Matrix in the PR body matches the implementation, end-to-end verification on Linux is convincing, and tests now lock down both modes on both layers (daemon always-DFA + autonomous-only approval, autonomous TUI bypass vs. supervised -s danger-full-access). Comments in codex.ts:51-65 and 138-148 explain the why so a future reader won't accidentally re-collapse one of the layers.

One non-blocking observation: the legacy in-process fallback path (buildArgs without sidecarEndpoint) still relies on daemonConfigArgs()'s -c sandbox_mode alone in supervised mode (no -s flag on the TUI). For the pure-TUI case there's no second layer to disagree, so it should be fine — but worth keeping in mind if the legacy path ever gets exercised again.

@aterrylu
aterrylu merged commit 5b1855c into main Jun 20, 2026
9 checks passed
@aterrylu
aterrylu deleted the terry/codex-sandbox-fix branch June 20, 2026 11:19
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.

2 participants