Onboarding wizard (theme selection, welcome screen) was triggering on
fresh installs and after version updates because hasCompletedOnboarding
or theme was missing from user config. Patched to always skip.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Statsig gate check function $v1() has a dollar sign in its name,
which \w+ doesn't match. Changed to [a-zA-Z0-9_$]+ in both patcher
and validator. Re-patched v2.1.75 cli.js — now 26/26 GREEN.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
- Delete config.toml with double-quoted keys bug before regenerating
- Replace pwd.getpwall() with /Users/* scan on macOS (Directory Services unreliable)
- Proper chown via stat of home directory
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>
- chown -R ~/.codex/ to actual user after patching (sudo creates as root)
- Detect SUDO_USER for the invoking user
- Iterate /Users/*/.codex (macOS) and /home/*/.codex (Linux) to fix all
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>
- Replace grep -oP (Perl regex) with portable sed — fixes "grep: invalid option -- P" on macOS
- Add sedi() wrapper for cross-platform sed -i (BSD vs GNU)
- Detect macOS via uname and use apple-darwin binary suffix instead of linux-musl
- Add is_native_binary() helper: checks both ELF (Linux) and Mach-O (macOS)
- macOS env vars: use launchctl setenv + /etc/codex-env.sh + ~/.zshrc source line
- Linux env vars: keep /etc/environment + /etc/profile.d/ as before
- Wrapper script uses dynamic ENV_FILE path instead of hardcoded /etc/profile.d/
- Fix SUDO_USER handling for correct ~/.zshrc path when run via sudo
- Uninstaller: also remove .codex-bin, /etc/codex-env.sh, launchctl vars, rc file entries
- Uninstaller: scan /Users/* on macOS instead of /home/*
- Fix CRLF line endings in ucodex_uninstall.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gemini -p / qwen -p crashes with "setRawMode EIO" when stdin is not
a TTY (running from sudo bash script.sh). Verification now uses
--version instead — fast, reliable, no TTY needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Patcher uses `which codex` to find binary. After migrating
codex -> .codex-bin, wrapper must exist before Step 2 (patcher)
or patcher fails with "Codex CLI not found".
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>
Problem: `sudo bash install.sh` runs in child process, `export` inside it
never reaches the user's current shell. /etc/environment and /etc/profile.d/
only work for NEW sessions. So `codex`/`gemini`/`qwen` fail with
"Missing environment variable" right after install.
Solution: wrapper scripts that auto-source env file before exec'ing binary.
- codex: /usr/local/bin/codex (wrapper) -> /usr/local/bin/.codex-bin (real)
- gemini: /usr/local/bin/gemini (wrapper) -> node .../dist/index.js
- qwen: /usr/local/bin/qwen (wrapper) -> node .../dist/index.js
Works immediately in ANY shell, no manual `source` needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Script no longer depends on local update-codex.sh or SCRIPT_DIR files
- Downloads Codex binary directly from GitHub releases
- Downloads patcher + config from gitea repo
- Sets env vars system-wide (/etc/environment + /etc/profile.d/)
- Proper error handling with set -euo pipefail
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same pattern as codex and gemini:
- Write QWEN_API_KEY + QWEN_BASE_URL to /etc/environment (all users)
- Create /etc/profile.d/qwen-code.sh for login shell export
- Update script now also sets env vars (was missing)
- Fix CRLF line endings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Install and update scripts now:
- Write GEMINI_API_KEY + GOOGLE_GEMINI_BASE_URL to /etc/environment (all users)
- Create /etc/profile.d/gemini-cli.sh for login shell export (all users)
- Export for current session
- Update script now also sets env vars (was missing entirely)
- Removed per-user ~/.bashrc approach — system-wide is more reliable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Write OPENAI_API_KEY and OPENAI_BASE_URL to /etc/environment (all users)
- Create /etc/profile.d/codex-env.sh for login shell export (all users)
- Export for current session too
- Removes per-user ~/.bashrc approach — system-wide is more reliable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Install/update scripts now:
- Export env vars for current session (fixes "Missing OPENAI_API_KEY")
- Write to ~/.bashrc or ~/.zshrc for persistence
- Handle sudo (detect real user via SUDO_USER)
- Remove stale entries before writing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Target 10: override DEFAULT_GEMINI_MODEL/FLASH/LITE/AUTO in models.js
- Target 11: fix hardcoded model names in ModelDialog.js
- Target 12: fix compression config aliases in chatCompressionService.js
- Target 13: fix example model name in AgentConfigDialog.js
Covers all 16+ locations where gemini-2.5 was used as fallback.
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>
- gemini/ugemini_install.sh: CURL_AUTH was defined but never used, fixed
- gemini/ugemini_update.sh: added GITEA_TOKEN + auth header
- qwen/uqwen_install.sh: use GITEA_TOKEN (was already defined but unused)
- qwen/uqwen_update.sh: added GITEA_TOKEN + auth header
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codex CLI reads config from %USERPROFILE%\.codex\config.toml
but PowerShell fallback was writing to %APPDATA%\codex\config.toml.
Old broken config remained in ~/.codex/ causing TOML parse errors.
- Fix config path: $env:APPDATA\codex → $env:USERPROFILE\.codex
- Add cleanup step to remove broken config before patching
- Remove old config before writing new one
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On Windows Server without winget/Python, the patcher now generates
config.toml directly in PowerShell instead of requiring Python 3.11+.
Python patcher is still used when available.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
powershell -File runs script in child process — PATH changes don't
persist. Changed to Set-ExecutionPolicy + dot-sourcing (. script.ps1)
which runs in current session. Also added PATH restart hint to Codex
install/update scripts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GitHub releases use codex-x86_64-pc-windows-msvc.exe (not .zip).
Fixed both install and update PS1 scripts.
Also added patched settingsSchema.js to gemini releases.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>