From fa07058917b24d8c2ab34b209a90776934b55a7b Mon Sep 17 00:00:00 2001 From: delta-cloud-208e Date: Sun, 8 Mar 2026 08:48:31 +0000 Subject: [PATCH] =?UTF-8?q?fix(codex):=20remove=20model=5Fcatalog=5Fjson?= =?UTF-8?q?=20=E2=80=94=20wrong=20format=20crashed=20Codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- codex/codex_patcher.py | 31 ------------------------------- codex/ucodex_install.ps1 | 15 --------------- codex/ucodex_update.ps1 | 14 -------------- 3 files changed, 60 deletions(-) diff --git a/codex/codex_patcher.py b/codex/codex_patcher.py index 8843efb..57a65bb 100755 --- a/codex/codex_patcher.py +++ b/codex/codex_patcher.py @@ -44,7 +44,6 @@ RESET = "\033[0m" # Managed config keys (we update these, preserve everything else) MANAGED_TOP_KEYS = { "model", "model_reasoning_effort", "model_provider", - "model_catalog_json", "approval_policy", "sandbox_mode", "check_for_update_on_startup", "forced_login_method", } @@ -164,14 +163,6 @@ def generate_config_toml(existing, config): lines.append(f'model = "{config["model"]}"') lines.append(f'model_reasoning_effort = "{config.get("model_reasoning_effort", "high")}"') lines.append('model_provider = "custom"') - - # Model catalog path (for model picker) - codex_dir = os.path.join(os.path.expanduser("~"), ".codex") - catalog_path = os.path.join(codex_dir, "model_catalog.json") - # Use forward slashes for cross-platform TOML compatibility - catalog_path_toml = catalog_path.replace("\\", "/") - lines.append(f'model_catalog_json = "{catalog_path_toml}"') - lines.append(f'approval_policy = "{config.get("approval_policy", "never")}"') lines.append(f'sandbox_mode = "{config.get("sandbox_mode", "danger-full-access")}"') lines.append(f'check_for_update_on_startup = {toml_value(config.get("check_for_update", False))}') @@ -473,21 +464,6 @@ def apply_all_patches(config, home_dir=None): # Backup before any changes backup_file(config_path) - # Generate model catalog JSON for model picker - catalog_path = os.path.join(codex_dir, "model_catalog.json") - models = config.get("models", [config["model"]]) - catalog_entries = [] - for m in models: - catalog_entries.append({ - "id": m, - "object": "model", - "created": 1700000000, - "owned_by": "system" - }) - with open(catalog_path, "w", encoding="utf-8") as f: - json.dump(catalog_entries, f, indent=2) - print(f" {'[OK]':>8} Catalog: {catalog_path} ({len(models)} models)") - # Generate new config.toml (merge) new_content = generate_config_toml(existing, config) @@ -598,13 +574,6 @@ def patch_user(user_home, config): existing = read_toml(config_path) backup_file(config_path) - # Generate model catalog - catalog_path = os.path.join(codex_dir, "model_catalog.json") - models = config.get("models", [config["model"]]) - catalog_entries = [{"id": m, "object": "model", "created": 1700000000, "owned_by": "system"} for m in models] - with open(catalog_path, "w", encoding="utf-8") as f: - json.dump(catalog_entries, f, indent=2) - new_content = generate_config_toml(existing, config) with open(config_path, "w", encoding="utf-8") as f: f.write(new_content) diff --git a/codex/ucodex_install.ps1 b/codex/ucodex_install.ps1 index 60343c7..066e0ad 100644 --- a/codex/ucodex_install.ps1 +++ b/codex/ucodex_install.ps1 @@ -215,12 +215,10 @@ if (-not $pyCmd) { Remove-Item $configToml -Force -ErrorAction SilentlyContinue } - $catalogPath = "$configDir\model_catalog.json" -replace '\\', '/' $tomlContent = @" model = "gpt-5.4" model_reasoning_effort = "high" model_provider = "custom" -model_catalog_json = "$catalogPath" approval_policy = "never" sandbox_mode = "danger-full-access" check_for_update_on_startup = false @@ -246,19 +244,6 @@ wire_api = "responses" [System.IO.File]::WriteAllText($configToml, $tomlContent) Write-Host " config.toml created: $configToml" -ForegroundColor Green - # Create model catalog for model picker - $catalogFile = Join-Path $configDir "model_catalog.json" - $catalogJson = @" -[ - {"id": "gpt-5.4", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.3-codex-spark", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.3-codex", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.2-codex", "object": "model", "created": 1700000000, "owned_by": "system"} -] -"@ - [System.IO.File]::WriteAllText($catalogFile, $catalogJson) - Write-Host " model_catalog.json created: $catalogFile" -ForegroundColor Green - # Set env vars via setx & setx OPENAI_API_KEY "ClauderAPI" 2>$null | Out-Null & setx OPENAI_BASE_URL "https://ai.37-187-136-86.sslip.io/v1" 2>$null | Out-Null diff --git a/codex/ucodex_update.ps1 b/codex/ucodex_update.ps1 index e18a560..cde2e07 100644 --- a/codex/ucodex_update.ps1 +++ b/codex/ucodex_update.ps1 @@ -138,12 +138,10 @@ if (-not $pyCmd) { $configToml = Join-Path $configDir "config.toml" # Remove old broken config if (Test-Path $configToml) { Remove-Item $configToml -Force -ErrorAction SilentlyContinue } - $catalogPath = "$configDir\model_catalog.json" -replace '\\', '/' $tomlContent = @" model = "gpt-5.4" model_reasoning_effort = "high" model_provider = "custom" -model_catalog_json = "$catalogPath" approval_policy = "never" sandbox_mode = "danger-full-access" check_for_update_on_startup = false @@ -167,18 +165,6 @@ wire_api = "responses" "@ [System.IO.File]::WriteAllText($configToml, $tomlContent) - # Create model catalog for model picker - $catalogFile = Join-Path $configDir "model_catalog.json" - $catalogJson = @" -[ - {"id": "gpt-5.4", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.3-codex-spark", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.3-codex", "object": "model", "created": 1700000000, "owned_by": "system"}, - {"id": "gpt-5.2-codex", "object": "model", "created": 1700000000, "owned_by": "system"} -] -"@ - [System.IO.File]::WriteAllText($catalogFile, $catalogJson) - & setx OPENAI_API_KEY "ClauderAPI" 2>$null | Out-Null & setx OPENAI_BASE_URL "https://ai.37-187-136-86.sslip.io/v1" 2>$null | Out-Null $env:OPENAI_API_KEY = "ClauderAPI"