0.118.0 regression: sandboxed commands fail with `bwrap: Can't create file at <repo>/.codex: Permission denied`
Summary
After upgrading from Codex CLI 0.117.0 to 0.118.0 on the same Linux machine and in the same repository, sandboxed commands in /root/kiara start failing before the actual command executes.
The failing stderr is:
bwrap: Can't create file at /root/kiara/.codex: Permission denied
This causes even harmless read-only commands such as pwd, rg, wc, id, and env to fail inside the sandbox and then get re-run via approval escalation because the session uses approval_policy:"on-request".
Downgrading back to 0.117.0 restores normal behavior in a second session on the same machine.
Impact
- Read-only commands fail before execution inside the sandbox.
- The TUI keeps asking for approval to rerun commands outside the sandbox.
- This breaks the expected no-prompt workflow in ordinary workspace-read and workspace-write scenarios.
- The behavior is severe because it affects basic repo inspection, not just writes.
Environment
- Host OS: Linux
- Working directory:
/root/kiara - Session sandbox policy:
workspace-write - Approval mode in both working and failing sessions:
on-request - Network access in session metadata:
false - Subscription plan in session metadata:
pro
A/B result
Same machine, same repository, same day, same approval mode:
0.118.0: fails withbwrap: Can't create file at /root/kiara/.codex: Permission denied0.117.0: does not show this failure and proceeds normally
This strongly suggests a regression introduced in 0.118.0.
Reproduction
- Start a Codex session in
/root/kiarausing CLI0.118.0. - Run any simple sandboxed command such as:
pwdrg --files docs/TODOS/P17wc -l docs/TODOS/P17/TODO_P17_S7_TO_S9_IMPLEMENTATION_PLAN_V7.md
- Observe that the command does not actually run.
- Instead, the sandbox bootstrap fails with:
bwrap: Can't create file at /root/kiara/.codex: Permission denied
- Because the session is
approval_policy:"on-request", Codex then asks to rerun the command with escalation, which surfaces as repeated approval prompts.
Expected behavior
- In a normal
workspace-writesandbox, basic read-only commands should run without approval prompts. - If project-local
.codexstate is needed, Codex should create or handle it safely without breaking all sandboxed commands. - Upgrading from
0.117.0to0.118.0should not turn ordinary read-only commands into approval requests.
Actual behavior
- The sandbox bootstrap itself fails before command execution.
- The failing path is
/root/kiara/.codex. - The path does not exist, yet
bwrapreportsPermission deniedwhile trying to create it. - The failure affects even commands that do not need writes.
Key observations
/root/kiaraitself is writable enough to exist normally:
directory 755 kiara kiara /root/kiara
/root/kiara/.codexdoes not exist at the time of inspection:
stat: cannot statx '/root/kiara/.codex': No such file or directory
- The regression is not explained by approval mode:
- failing
0.118.0session:approval_policy:"on-request" - working
0.117.0session:approval_policy:"on-request"
- The regression is not explained by plan tier:
- working post-downgrade
0.117.0session still reportsplan_type:"pro" - failing
0.118.0session also reportsplan_type:"pro"
- The post-downgrade
0.117.0session files examined do not contain the samebwraperror.
Likely regression window
The most suspicious 0.118.0 change is the hardening around first-time project-local .codex handling:
0.118.0release note:- Project-local
.codexfiles are now protected even on first creation, closing a gap where the initial write could bypass normal approval checks.
This bug may be in or near that path, because the failing path is exactly the project-local .codex path under the workspace root.
There is also a 0.118.0 bwrap lookup fix, but that appears less likely to be the direct cause here because bwrap is already being launched and then fails later while trying to create /root/kiara/.codex.
Evidence
Failing 0.118.0 session metadata:
/root/.codex/sessions/2026/04/04/rollout-2026-04-04T14-48-55-019d588a-0c13-7b20-b3e1-a074405033d6.jsonl
Examples of failing tool calls in 0.118.0:
pwdrg --files docs/TODOS/P17wc -l docs/TODOS/P17/TODO_P17_S7_TO_S9_IMPLEMENTATION_PLAN_V7.mdidenv
Failing log excerpts:
/root/.codex/log/codex-tui.log/root/.codex/sessions/2026/04/04/rollout-2026-04-04T04-51-35-019d5667-2b83-7310-9230-7574bd92e2f7.jsonl/root/.codex/sessions/2026/04/04/rollout-2026-04-04T14-51-00-019d588b-f6cc-73f2-bcb3-ecedcb1a4043.jsonl
Working post-downgrade 0.117.0 session metadata:
/root/.codex/sessions/2026/04/04/rollout-2026-04-04T15-08-41-019d589c-24cb-7241-893a-efa23849c4da.jsonl/root/.codex/sessions/2026/04/04/rollout-2026-04-04T15-14-23-019d58a1-5e3e-7c91-97e1-a66a64312314.jsonl
Suggested debugging directions
- Inspect what changed in
0.118.0around first-time project-local.codexcreation and approval enforcement. - Verify whether Linux sandbox bootstrap now attempts to create a project-local
.codexfile or directory before command execution. - Verify whether the create path is being executed by a process or user that lacks permission due to namespace or mount setup, even though the target workspace itself is valid.
- Confirm whether the
.codexcreation path is incorrectly treated as disallowed inworkspace-writemode. - Confirm why a nonexistent
/root/kiara/.codexyieldsPermission deniedinstead of a normal create or a clearer sandbox-policy error.
Links
0.118.0release notes: https://github.com/openai/codex/releases/tag/rust-v0.118.00.117.0release notes: https://github.com/openai/codex/releases/tag/rust-v0.117.00.118.0bwrap lookup PR: https://github.com/openai/codex/pull/159730.118.0trusted PATH PR: https://github.com/openai/codex/pull/15791
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗