fix(codex): auto-cleanup broken model_catalog_json on install/update
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>
This commit is contained in:
@@ -458,9 +458,20 @@ def apply_all_patches(config, home_dir=None):
|
||||
print(f" Proxy: {config['base_url']}")
|
||||
print()
|
||||
|
||||
# Clean up stale model_catalog.json from previous broken installs
|
||||
stale_catalog = os.path.join(codex_dir, "model_catalog.json")
|
||||
if os.path.isfile(stale_catalog):
|
||||
os.remove(stale_catalog)
|
||||
print(f" {YELLOW}Removed stale model_catalog.json{RESET}")
|
||||
|
||||
# Read existing config
|
||||
existing = read_toml(config_path)
|
||||
|
||||
# Remove model_catalog_json if present (wrong format crashes Codex)
|
||||
if "model_catalog_json" in existing:
|
||||
del existing["model_catalog_json"]
|
||||
print(f" {YELLOW}Removed model_catalog_json from config (unsupported format){RESET}")
|
||||
|
||||
# Backup before any changes
|
||||
backup_file(config_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user