Skip to content

fix(core): reuse existing installation id without requiring write access - #1

Open
argszero wants to merge 1 commit into
mainfrom
fix/installation-id-readonly-reuse
Open

argszero wants to merge 1 commit into
mainfrom
fix/installation-id-readonly-reuse

Conversation

@argszero

@argszero argszero commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

codex opens its installation_id file with read(true).write(true).create(true) at startup. When the CLI runs inside an enclosing sandbox that allows reading ~/.codex/installation_id but denies opening it for writing, this writable open fails with EPERM even though the file already holds a valid UUID — blocking codex exec from starting in-process app-server.

This adds a read-only fast path that reuses an existing, valid installation id without requesting write access. Missing, unreadable, or invalid ids fall through to the existing locked create/repair path unchanged, preserving the original creation/repair/concurrency semantics.

Related Issue

Closes openai#42398

Tests

  • Existing tests pass (codex-core installation_id unit tests)
  • New regression test: an existing valid id file made read-only is still reused

The new test resolve_installation_id_reuses_existing_uuid_when_writes_denied sets the id file's permissions to 0o444 (which makes a read-write open fail with EACCES, as verified) and asserts that resolution still returns the existing UUID via the read-only fast path.

Opening the installation_id file read-write at startup fails with EPERM
inside an enclosing sandbox that allows reading the id but denies writing
it, even though the file already holds a valid UUID.

Add a read-only fast path that reuses an existing, valid installation id
without requesting write access; missing, unreadable, or invalid ids fall
through to the existing locked create/repair path unchanged.

Fixes a startup blocker for nested `codex exec` under a read-only codex
home. Adds a regression test that makes an existing valid id read-only and
asserts reuse still succeeds.
@argszero
argszero changed the base branch from main to tmp-base-refresh-for-pr1 September 26, 2026 05:08
@argszero
argszero changed the base branch from tmp-base-refresh-for-pr1 to main September 26, 2026 05:08
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.

codex exec fails in an outer read-only sandbox because installation_id requires write access

1 participant