Repository navigation
Description
What version of Codex CLI is running?
codex-cli 0.151.0
The rust-v0.152.0 source has an identical installation_id.rs and still calls its resolver during in-process app-server startup. 0.152.0 was inspected, not installed or run.
What subscription do you have?
Pro
Which model were you using?
No model turn was reached; the CLI failed during startup.
What platform is your computer?
macOS 27.0, Apple Silicon (arm64).
What terminal emulator and version are you using (if applicable)?
The CLI was launched as a subprocess from a Codex Desktop task.
Codex doctor report
Not collected. Startup logs and a focused filesystem probe are described below.
What issue are you seeing?
A nested codex exec fails before emitting any JSON events when the enclosing task sandbox allows reading ~/.codex/installation_id but denies writing it:
Error: failed to initialize in-process app-server client: Operation not permitted (os error 1)
Two launches exited with code 1 and empty stdout, requesting inner read-only and workspace-write sandboxes respectively. Both inherited the same outer restrictions. Redirecting logs and SQLite to writable fixture directories, disabling analytics, and using --ephemeral did not avoid the failure.
This blocks starting a read-only worker with existing Codex state. The diagnostic does not identify which file requires write access.
What steps can reproduce the bug?
-
On macOS, launch a child CLI from an enclosing Codex task that denies writes to
~/.codex/installation_idwhile allowing reads. The observed file already existed, was user-owned, and had mode0644. -
Provide a synthetic Git repository and writable directories for logs, SQLite, temporary files, and caches. Retain the existing Codex home.
-
Launch
codex execwith these relevant arguments:codex -a never exec --sandbox read-only --ephemeral --json \ -C /path/to/synthetic-repo \ -c 'log_dir="/path/to/writable-logs"' \ -c 'sqlite_home="/path/to/writable-sqlite"' \ -c 'analytics.enabled=false' \ -c 'history.persistence="none"' \ "Read sample.py."
This is a shortened representation of the recorded invocation, not an independently tested minimal reproducer. The actual launches also configured a fixture MCP server, disabled unrelated plugins/hooks, and used longer validation prompts. The fixture MCP connection was never reached.
-
Observe the startup error above. Setting the inner CLI's
--sandbox read-onlyalone does not create the required outer restriction; that flag controls the worker's tool execution.
A separate probe in the same enclosing sandbox confirmed:
| Operation on the existing installation-ID file | Result |
|---|---|
os.open(path, os.O_RDONLY) |
Succeeds |
os.open(path, os.O_RDWR) |
Fails with EPERM / errno 1 |
| File contents before and after the probe | Unchanged |
What is the expected behavior?
Reusing a valid existing installation ID should not require opening the file for writing. If startup requires a write, its error should name the path and operation that failed.
Additional information
In 0.151.0's resolver, the file is opened with:
options.read(true).write(true).create(true);This happens before reading and validating the existing UUID. 0.152.0 retains that implementation, and app-server startup propagates its error.
The denied writable open and this call path identify a startup blocker. A patched binary has not been tested, so this report does not establish that removing this blocker is sufficient for the entire nested session to run.
Consider reading and reusing a valid ID without a writable open, retaining the locked write path for creation or repair. Regression coverage should include an existing valid ID with writes denied, missing/invalid IDs in a writable home, and concurrent initialization.
Related upstream work:
- #16912 introduced the persistent installation ID and writable-open behavior.
- #21182 moved resolution to host startup and let internal child sessions reuse the parent's ID. A separately launched CLI still resolves the file itself.
- #26277 discusses Android file-lock failures in the same startup path; the observed failure here occurs when opening the file for writing on macOS.
Activity
fscfede-beep commentedon Sep 3, 2026
I checked this against current
main(1d741742c5fd5d3cf5d93ea71d48a3c9af9bda41), andresolve_installation_id()still opens the file withread(true).write(true).create(true)before it knows whether the existing contents are already a valid UUID.A narrow way to preserve the existing creation/repair/concurrency path is a read-only fast path rather than weakening the locked writer path:
installation_id;That directly addresses the reported read-only-existing-ID case while keeping missing/invalid IDs and concurrent initialization on the existing serialized writer path. A focused regression should make an existing valid ID non-writable and assert reuse succeeds, alongside the existing generate/rewrite tests.
One caveat worth testing: the read-only fast path is intentionally only an optimization for already-valid state; it should not become a second repair path or claim stronger concurrency semantics than the locked writer path.
Validation boundary: this is current-source inspection only. I do not have a Rust toolchain in this environment, so I am not claiming
cargo checkor test pass, and I have not opened a PR/fork.argszero commentedon Sep 3, 2026
TyceHerrman's report and fscfede-beep's read-only fast-path suggestion are both correct — I implemented and validated that approach on current main (
498d40b29f, which has the sameread+write+createopen incodex-rs/core/src/installation_id.rs).The fix adds a read-only fast path before the writable open: if the existing
installation_idfile parses as a valid UUID, return it without ever requesting write access. Missing / unreadable / invalid ids fall through to the existing locked create/repair path unchanged, preserving the original creation and concurrency semantics.Broad note: this repo currently blocks cloning/PR creation via the GraphQL
CreatePullRequestAPI for contributors (I hit the same door earlier this week), so I can't open an upstream PR directly. The validated change is on my fork atargszero/codexbranchfix/installation-id-readonly-reuse(PR #1) — happy to hand it off to anyone with write access, or to open one if the gate is lifted.Validated against current main:
cargo clippy -p codex-core --lib: cleancodex-coreinstallation_idunit tests: 5/5 pass (3 pre-existing + newresolve_installation_id_reuses_existing_uuid_when_writes_denied, which chmods an existing valid id to0o444— a read-write open then fails with EACCES — and asserts reuse still succeeds)argszero commentedon Sep 3, 2026
ok
kyle886 commentedon Oct 4, 2026
Additional reproduction in managed Codex Cloud with
codex-cli 0.159.0-alpha.3: a standaloneapp-serverexits before any RPC output.The launch used
/opt/codex/bin/codex app-server --listen stdio://withsqlite_homeandlog_direxplicitly directed to writable workspace directories. The existing Codex home, authentication, and sandbox restrictions were preserved.A single bounded filesystem-metadata trace recorded this failed open:
The native process exited 1. The diagnostic took approximately 0.419 seconds; retained trace and stderr totalled 1,395 bytes. No RPC or model task turn followed.
The matching upstream tag,
rust-v0.159.0-alpha.3, resolves to3b01b36fa5eb96ba82a776bd3c2fc57f8969181f:This trace establishes the denied writable open. It does not establish whether the Cloud installation-ID file already contains a valid UUID, or whether later startup steps would succeed after addressing this failure.
Our use case requires reading a ready session's configured model and reasoning effort before its first work turn. Is standalone app-server a supported route within Codex Cloud? If so, please provide a supported installation-ID storage or read-only startup mechanism that preserves the existing Codex home. If nested app-server is unsupported, which host API supports creating an idle session and reading its applied settings before starting a turn?
tarskisworld commentedon Oct 26, 2026
Additional reproduction on WSL2 with DrvFS Linux metadata enabled, using the standard desktop-managed backend
0.164.0-alpha.11.1(Windows app26.1021.3705.0).Two Linux users access the same Windows-backed
CODEX_HOME. The existinginstallation_idis owned by the first user and has mode0644. As the second user, normalapp-serverinitialization fails:The backend exits1 without an initialize result. The matching resolver source requests read/write access before inspecting the existing ID.
Control: the same backend/profile completes initialize as the second user in Ubuntu WSL, whose Windows-drive mount does not enable
metadataand presents the file as owned by its current user. Both tests used user-local SQLite directories and only an initialize request—no model task.The failing distro was NixOS
26.05.12658.1f607aa79b63, Nix2.34.9, on Windows 11 25H2 build26200.9711. Its mount options includedmetadata,uid=1000,gid=100; the failing process was UID1001 and the file owner UID1000.A separate warning also occurs when chmodding the shared
tmp/arg0-linuxdirectory to0700. It should not be confused with the fatal identity-file open; a per-user helper root may need separate coverage.This adds a multi-user/DrvFS case supporting the valid-ID read-only path discussed above. Limit: a direct
--print-startup-configcheck passes in both distros; an earlier GUI configuration-read error remains untraced. No credential or identifier contents are included.ChanwookJeong commentedon Nov 17, 2026
Additional macOS file-access reproduction and isolated validation for #42398.
Environment
Observed file-access behavior
installation_idread-onlyinstallation_idread-writeThe existing file's hash and metadata remained unchanged. No file writes, creation, locking, or permission modification were performed during these probes.
Source inspection
The source corresponding to the installed Codex version requests
read(true).write(true).create(true)before validating the existing installation ID.This matches the file-access restriction described in #42398.
Isolated validation
A separate Python implementation of read-only reuse passed 16 tests covering valid-ID reuse, missing/invalid IDs, symlink and file-replacement rejection, concurrency, locking, and partial-write failures.
These results validate an isolated implementation strategy, not an official Rust patch or successful Codex app-server initialization.
The historical app-server initialization failure remains unresolved. The denied read-write access is a strong candidate for an initialization blocker, but has not been directly established as the failed operation in that historical execution.
The isolated tests also do not establish safety against all non-cooperating same-UID file modifications or guarantee atomic recovery under every concurrent failure scenario.
Request
Could maintainers confirm:
No production binary, actual installation ID, authentication data, or security configuration was modified.
No model requests were made during these file-access probes.