Root cause: generate_config_toml() used os.path.expanduser("~") which
always returns root's home under sudo. Every user's config.toml had
model_catalog_json = "/var/root/.codex/model_catalog.json" → Permission denied.
Fix: pass home_dir to generate_config_toml() so each user gets their own path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
macOS Directory Services makes pwd.getpwall() unreliable — regular users
may not be returned. Now scans /Users/* directly on macOS, /home/* on Linux.
Also fixes chown to use actual directory ownership.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Minimal TOML parser (Python < 3.11 fallback) now strips quotes from section
keys like [projects."/home"] — prevents double-quoting on re-parse
- Add /Users and /var/root to trust_paths on macOS
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Install script now runs patcher with --all to patch every user's ~/.codex/config.toml
- Fix list_users() UID threshold: macOS starts at 500, Linux at 1000
- Fix file ownership: chown config files to the actual user after patching
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- tomllib fallback: try tomllib (3.11+) -> tomli -> minimal parser
- Works with Python 3.8+ (Ubuntu 20.04, Debian 11, etc.)
- Auto-install python3 if not found (like Gemini/Qwen scripts)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previous attempt used OpenAI API format (bare array of {id, object}).
Codex expects ModelsResponse format: {"models": [{slug, display_name,
visibility, shell_type, supported_reasoning_levels, ...}]}.
Format reverse-engineered from codex-rs/core/models.json in official repo.
All 4 models (gpt-5.4, gpt-5.3-codex-spark, gpt-5.3-codex, gpt-5.2-codex)
now appear in interactive model picker.
Cleanup logic detects old bare-array format and replaces automatically.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All scripts now detect and fix leftover damage from previous installs:
- Remove model_catalog_json from config.toml (crashes Codex on startup)
- Delete stale model_catalog.json file
- Detect broken TOML with dotted key bug
Both PS1 scripts and Python patcher handle cleanup before patching.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
model_catalog_json expects internal Codex ModelsResponse format with
complex ModelInfo structs (slug, display_name, visibility, shell_type,
supported_reasoning_levels, etc.), not simple OpenAI API format.
Removed from all configs to restore working state.
env_key = "OPENAI_API_KEY" fix is preserved (fixes 401 Unauthorized).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add env_key = "OPENAI_API_KEY" to [model_providers.custom] in PS1 fallback
templates (fixes 401 Unauthorized on machines without Python 3.11+)
- Add model_catalog_json config + model_catalog.json file generation
(fixes empty model picker — all 4 models now visible in interactive mode)
- Both fixes applied in: codex_patcher.py, ucodex_install.ps1, ucodex_update.ps1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>