Repository navigation
[Bug][Linux] codex-shim install cannot migrate a legacy shim whose codex-shim.json was written group-writable (umask 002) #6668
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingcliCLI, config inject, packaging flagsCLI, config inject, packaging flags
Description
Client or integration
Codex CLI
Area
CLI
Summary
ocx codex-shim install cannot migrate a legacy Unix shim when the legacy state file ~/.opencodex/codex-shim.json is group-writable. It refuses with a message that doesn't name the file or the cause, while ocx codex-shim status keeps telling the user to run that same command.
Cause:
- The legacy branch of
writeState()insrc/codex/shim-state-file.tscallswriteFileSync(path, ..., "utf8")with nomode, so the file's permissions depend on the umask. With umask002(the Ubuntu default for desktop users) it is created as0664. Only thepath-overlaybranch writes withmode: 0o600. installUnixOverlay()insrc/codex/shim-overlay.tsrunssnapshot(statePath())beforemigrateLegacyUnixShim().snapshot()throwsPrivate Codex artifact is not an owned regular filewhenmode & 0o022is set.
So any legacy install written under umask 002 can never be migrated, and the user is stuck: status says "Run ocx codex-shim install", and install refuses.
Expected, any of the following:
- The legacy state file the old shim wrote can be migrated, for example by tightening it to
0600when it is a regular file owned by the current user, or by validating it on the legacy path the wayreadStateResultalready treats mode drift as readable for repair. - At minimum, the refusal names the path and the reason (group/world writable) and suggests
chmod 600 ~/.opencodex/codex-shim.json.
Workaround: running chmod 600 ~/.opencodex/codex-shim.json and then ocx codex-shim install migrated cleanly to the PATH overlay.
Reproduction
- With
umask 002, install the legacy in-place shim with an olderocx codex-shim install, so that~/.local/bin/codexbecomes the wrapper and the backup iscodex.opencodex-real.~/.opencodex/codex-shim.jsonends up-rw-rw-r--. - Upgrade to 2.78.0.
ocx codex-shim statusreports "Legacy Unix shim installed in place; automatic repair does not migrate it. Run ocx codex-shim install, …".ocx codex-shim installexits 1 with "Private Codex artifact is not an owned regular file".
Version
2.78.0 (.deb); same code on dev at 2.79.0
Operating system
Ubuntu 26.04.1 LTS
Provider and model
No response
Logs or error output
$ ocx codex-shim install
⚠️ Private Codex artifact is not an owned regular file
Codex shim installation was refused: Codex autostart shim: wrapper shim present at ~/.local/bin/codex; original backup present at ~/.local/bin/codex.opencodex-real. Legacy Unix shim installed in place; automatic repair does not migrate it. Run ocx codex-shim install, then source the printed codex-shell-env.sh path and add that line after PATH setup in your shell startup file.
$ stat -c '%A %n' ~/.opencodex/codex-shim.json
-rw-rw-r-- ~/.opencodex/codex-shim.json
$ umask
002
$ chmod 600 ~/.opencodex/codex-shim.json && ocx codex-shim install
⚠️ Codex PATH shim installed at ~/.opencodex/bin/codex; native launcher ~/.local/bin/codex. ...Screenshots and supporting files
No response
Redacted configuration
No response
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcliCLI, config inject, packaging flagsCLI, config inject, packaging flags
Activity
lidge-jun commentedon Oct 6, 2026
Partly addressed on dev by #6680 (merge 0033ede): the refusal now names the legacy state file, the group-writable condition and a shell-quoted chmod 600 fix. Install still refuses a group-writable legacy file by design (the private-artifact trust check is unchanged), so this stays open for the migration decision.
lidge-jun commentedon Oct 8, 2026
Closing. The path and chmod guidance landed in #6680 (0033ede): the refusal now names the legacy state file, the group-writable condition and a shell-quoted
chmod 600fix, after whichocx codex-shim installmigrates normally. Automatically normalizing the permissions is not planned: a file that was group-writable cannot be proven untouched, so the private-artifact trust check stays strict and the one-time manual chmod remains the supported path.