Restricted filesystem profiles can block Codex's own runtime binary
What version of Codex CLI is running?
codex-cli 0.141.0
What subscription do you have?
plus
Which model were you using?
Not model-related
What platform is your computer?
Linux 7.0.0-22-generic x86_64 unknown
What terminal emulator and version are you using (if applicable)?
Not terminal-related
Codex doctor report
{
"schemaVersion": 1,
"generatedAt": "1781849955s since unix epoch",
"overallStatus": "ok",
"codexVersion": "0.141.0",
"checks": {
"app_server.status": {
"id": "app_server.status",
"category": "app-server",
"status": "ok",
"summary": "background server is not running",
"details": {
"control socket": "/home/progse/.codex/app-server-control/app-server-control.sock",
"daemon state dir": "/home/progse/.codex/app-server-daemon",
"mode": "ephemeral",
"pid file": "/home/progse/.codex/app-server-daemon/app-server.pid (missing)",
"settings": "/home/progse/.codex/app-server-daemon/settings.json (missing)",
"status": "not running",
"update-loop pid file": "/home/progse/.codex/app-server-daemon/app-server-updater.pid (missing)"
},
"remediation": null,
"durationMs": 0
},
"auth.credentials": {
"id": "auth.credentials",
"category": "auth",
"status": "ok",
"summary": "auth is configured",
"details": {
"auth file": "/home/progse/.codex/auth.json",
"auth storage mode": "File",
"stored API key": "false",
"stored ChatGPT tokens": "true",
"stored agent identity": "false",
"stored auth mode": "chatgpt"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "/home/progse/.codex",
"config.toml": "/home/progse/.codex/config.toml",
"config.toml parse": "ok",
"cwd": "/home/progse/Projects/platform",
"enabled feature flags": "shell_tool, unified_exec, shell_snapshot, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_suggest, plugins, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, workspace_dependencies",
"feature flag overrides": "none",
"feature flags enabled": "29",
"log dir": "/home/progse/.codex/log",
"mcp servers": "0",
"model": "gpt-5.4",
"model provider": "openai",
"sqlite home": "/home/progse/.codex"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.53.0",
"details": {
".git entry": "directory",
"PATH git #1": "/usr/bin/git",
"PATH git #2": "/bin/git",
"PATH git entries": "2",
"git branch": "main",
"git build options": "git version 2.53.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: disabled; gettext: enabled; libcurl: 8.18.0; zlib: 1.3.1; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
"git exec path": "/usr/lib/git-core",
"git version": "git version 2.53.0",
"repo detected": "true",
"repo root": "/home/progse/Projects/platform",
"selected git": "/usr/bin/git"
},
"remediation": null,
"durationMs": 75
},
"installation": {
"id": "installation",
"category": "install",
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "/home/progse/.local/bin/codex",
"PATH codex #2": "/home/progse/.local/bin/codex",
"PATH codex #3": "/home/progse/.local/bin/codex",
"PATH codex entries": "3",
"current executable": "/home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/bin/codex",
"install context": "standalone (unix, package /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl, bin /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/bin, resources /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/codex-resources, path /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/codex-path)",
"managed by bun": "false",
"managed by npm": "false",
"managed package root": "not set"
},
"remediation": null,
"durationMs": 1
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "no MCP servers configured",
"details": {},
"remediation": null,
"durationMs": 0
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"proxy env vars": "none"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "ok",
"summary": "active provider endpoints are reachable over HTTP",
"details": {
"ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
"reachability mode": "ChatGPT auth"
},
"remediation": null,
"durationMs": 203
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket handshake succeeded",
"details": {
"DNS": "2 IPv4, 2 IPv6, first IPv4",
"auth mode": "chatgpt",
"connect timeout": "15000 ms",
"endpoint": "wss://chatgpt.com/backend-api/<redacted>",
"handshake result": "HTTP 101 Switching Protocols",
"model provider": "openai",
"models etag present": "true",
"provider name": "OpenAI",
"proxy env vars": "none",
"reasoning header": "false",
"server model present": "false",
"supports websockets": "true",
"wire API": "responses"
},
"remediation": null,
"durationMs": 1618
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running standalone on linux-x86_64",
"details": {
"commit": "unknown",
"current executable": "/home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/bin/codex",
"install method": "standalone (unix, package /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl, bin /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/bin, resources /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/codex-resources, path /home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/codex-path)",
"platform": "linux-x86_64",
"version": "0.141.0"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (bundled)",
"details": {
"search command": "/home/progse/.codex/packages/standalone/releases/0.141.0-x86_64-unknown-linux-musl/codex-path/rg",
"search command readiness": "file exists",
"search provider": "bundled"
},
"remediation": null,
"durationMs": 0
},
"sandbox.helpers": {
"id": "sandbox.helpers",
"category": "sandbox",
"status": "ok",
"summary": "sandbox configuration is readable",
"details": {
"approval policy": "OnRequest",
"codex-linux-sandbox helper": "/home/progse/.codex/tmp/arg0/codex-arg0QbNeW4/codex-linux-sandbox",
"execve wrapper helper": "/home/progse/.codex/tmp/arg0/codex-arg0QbNeW4/codex-execve-wrapper",
"filesystem sandbox": "restricted",
"network sandbox": "restricted"
},
"remediation": null,
"durationMs": 0
},
"state.paths": {
"id": "state.paths",
"category": "state",
"status": "ok",
"summary": "state paths and databases are inspectable",
"details": {
"CODEX_HOME": "/home/progse/.codex (dir)",
"active rollout files": "19 files, 52922558 total bytes, 2785397 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "/home/progse/.codex/goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "/home/progse/.codex/logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "/home/progse/.codex/log (missing)",
"memories DB": "/home/progse/.codex/memories_1.sqlite (file)",
"memories DB integrity": "ok",
"sqlite home": "/home/progse/.codex (dir)",
"standalone release cache": "4 entries in /home/progse/.codex/packages/standalone/releases",
"state DB": "/home/progse/.codex/state_5.sqlite (file)",
"state DB integrity": "ok"
},
"remediation": null,
"durationMs": 882
},
"state.rollout_db_parity": {
"id": "state.rollout_db_parity",
"category": "threads",
"status": "ok",
"summary": "rollout files and state DB thread inventory agree",
"details": {
"default model provider": "openai",
"rollout DB active files": "19",
"rollout DB active rows": "19",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "0",
"rollout DB missing archived rows": "0",
"rollout DB model providers": "openai=19",
"rollout DB rows": "19",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "cli=19",
"rollout DB stale rows": "0"
},
"remediation": null,
"durationMs": 810
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language en-US",
"details": {
"EDITOR": "not set",
"LANG": "en_US.UTF-8",
"VISUAL": "not set",
"os": "Ubuntu 26.4.0 (resolute) [64-bit]",
"os language": "en-US",
"os type": "Ubuntu",
"os version": "26.4.0"
},
"remediation": null,
"durationMs": 33
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "ok",
"summary": "terminal metadata was detected",
"details": {
"DISPLAY": "present",
"WAYLAND_DISPLAY": "present",
"color output": "enabled",
"effective locale": "en_US.UTF-8",
"stderr is terminal": "true",
"stdin is terminal": "true",
"stdout is terminal": "true",
"terminal": "Apple Terminal",
"terminal size": "219x32"
},
"remediation": null,
"durationMs": 0
},
"terminal.title": {
"id": "terminal.title",
"category": "title",
"status": "ok",
"summary": "terminal title default",
"details": {
"terminal title activity": "true",
"terminal title items": "activity, project-name",
"terminal title project source": "git repo root",
"terminal title project value": "platform",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "ok",
"summary": "update configuration is locally consistent",
"details": {
"cached latest version": "0.141.0",
"check for update on startup": "true",
"last checked at": "2026-06-19T04:37:45.871871341Z",
"latest version": "0.141.0",
"latest version status": "current version is not older",
"update action": "standalone installer",
"version cache": "/home/progse/.codex/version.json"
},
"remediation": null,
"durationMs": 852
}
}
}
What issue are you seeing?
When using a custom filesystem profile with restricted permissions, Codex may fail to read files from explicitly allowed directories because it loses access to its own internal runtime binary inside the sandbox.
I hit an error like this:
bwrap: execvp /home/user/.codex/packages/standalone/releases/<version>/bin/codex: No such file or directory
The binary did exist on disk.
What steps can reproduce the bug?
Example setup
A profile allowed:
- read access to a limited project subdirectory such as agents/
- write access to a subdirectory such as agents/inbox/
Example:
approval_policy = "never"
default_permissions = "restricted_agent"
web_search = "disabled"
allow_login_shell = false
project_root_markers = ["agents/PROJECT_CONTEXT.md"]
model_instructions_file = "/home/user/projects/sample-app/agents/ROLE.md"
[permissions.restricted_agent.filesystem]
":minimal" = "read"
[permissions.restricted_agent.filesystem.":workspace_roots"]
"agents" = "read"
".claude" = "read"
"agents/inbox" = "write"
[permissions.restricted_agent.network]
enabled = false
Then asking Codex to read a file from the allowed directory, such as:
/home/user/projects/sample-app/agents/AGENTS.md
failed with the error above.
What is the expected behavior?
Codex should automatically retain access to its own internal runtime/binary paths when applying a custom filesystem profile.
Users should not need to manually whitelist internal .codex/.../releases/... paths just to make basic file reads work.
Additional information
Workaround
The problem went away only after explicitly granting read access to Codex?s own release path, for example:
[permissions.restricted_agent.filesystem]
":minimal" = "read"
"/home/user/.codex/packages/standalone/releases/<version>" = "read"
## Why this seems like a bug
The target project directory was explicitly allowed, and the target file existed. The failure only happened because Codex apparently could not access its own runtime binary inside the sandbox. That feels like an internal dependency Codex should preserve automatically.
2 Comments
Confirmed this is still reproducible on
codex-cli 0.149.0on Linux with an npm/NVM installation.In a restricted custom permission profile, app-server
command/execfails before the requested command starts:The native binary exists and is executable on the host. This looks closely related to #20906 as well.
One additional detail from investigating a possible workaround:
codex doctor --jsonreportscodex-linux-sandboxunder a path like:That helper path is process-lifetime temporary state. The arg0 temp directory is retained only for the lifetime of that Codex process, so a helper path obtained from a separate
codex doctorinvocation is not stable provenance for a later app-server process.Current upstream
mainappears to handle this at the correct ownership boundary by carrying the livecodex_self_exe/codex_linux_sandbox_exeruntime paths into sandbox setup and exposing them as readable roots internally.So from this reproduction:
0.149.0;Follow-up with a proven root cause and local fix against
rust-v0.149.0.The existing runtime-readable-root augmentation in
exec-server/process_sandbox.rsis correct, but app-servercommand/execbypassesexec-server::prepare_exec_request. Its direct local execution path therefore never received the samecodex_self_exe/codex_linux_sandbox_exereadable-root augmentation.I implemented the minimal fix locally by extracting that augmentation into a shared helper and applying it from both exec-server and direct app-server
command/exec. The direct path takes the live executor-owned runtime paths, adds only those exact files as read-only roots, does not grant their parent directories or runtime write access, and preserves enforcement/network semantics.Validation on Linux:
command/execregression under a restricted profile: PASS (1 passed,1236 skipped).One regression-fixture detail worth noting: a dynamically linked local
codex-app-servertest binary still needs the platform:minimalruntime (ELF loader/shared libraries/sh). Omitting that can also surface asexecvp <app-server>: No such file or directory, even when the executable itself is mounted.Current
mainwas also inspected and still appeared to retain this directcommand/execbypass at the time of testing.I can provide the exact seven-file experimental diff/regression shape if useful; OpenAI's contributing guidance says external PRs are not accepted, so I kept this as local proof rather than opening one.
Patch shape:
Extract the existing runtime-readable-root augmentation into a shared helper
taking the effective PermissionProfile plus:
Replace the local augmentation with the shared helper.
For local command/exec, obtain the live executor-owned runtime paths from the
selected Environment and apply the same helper before build_exec_request.