ISSUE DESCRIPTION Stale 'clientversion' fallback causes 503 'noplansupportformodel' for…
- User
ISSUE DESCRIPTION
Stale 'client_version' fallback causes 503 'no_plan_support_for_model' for newer models (e.g. gpt-5.5) when GitHub releases API rate-limits
Summary
When
app/core/clients/codex_version.pycannot fetch the latest codex release fromapi.github.com/repos/openai/codex/releases/latest(e.g. anonymous-rate-limited with HTTP 403), it logs:codeGitHub releases API returned HTTP 403 GitHub fetch failed and no cached version; falling back to settings default 0.101.0and falls back to
Settings.model_registry_client_version(default0.101.0). The model registry refresh (app/core/openai/model_refresh_scheduler.py→clients/model_fetcher.fetch_models_for_plan) then asks upstream/codex/models?client_version=0.101.0. Upstream gates newer model slugs behind newer client versions, so the response excludes e.g.gpt-5.5.As a result,
ModelRegistry.model_plansnever gets agpt-5.5entry,_filter_accounts_for_modelinmodules/proxy/load_balancer.py:1168returns an empty set, and every Codex request forgpt-5.5is rejected with:codeproxy_error_response status=503 code=no_plan_support_for_model message=No accounts with a plan supporting model 'gpt-5.5'…even though the actual Codex CLI is on
0.130.0and the account's ChatGPT subscription does support the model (calling/backend-api/codex/models?client_version=0.130.0through the LB returns 200 with the model present).Reproduction
- Run
ghcr.io/soju06/codex-lb:1.17.0on a host where anonymous GitHub API requests are 403'ed. - Connect a current Codex CLI (e.g.
@openai/codex@0.130.0) configured withmodel = \"gpt-5.5\". - Observe startup log line:
GitHub fetch failed and no cached version; falling back to settings default 0.101.0
- Every
POST /backend-api/codex/responsesreturns 503 with codeno_plan_support_for_model.
Setting
CODEX_LB_MODEL_REGISTRY_CLIENT_VERSION=0.130.0and recreating the container fully resolves the symptom.Suggested fixes
- Run
- Assistant
I'll start by exploring the repository structure and the key files mentioned in the issue.
- Assistant
Let me look at the codex_version.py file and related settings/code.
- Assistant
Next I'll inspect settings, model_fetcher, and existing tests related to client_version.
- Assistant
I'll read the existing unit tests and the settings definition for the default client version.
- Assistant
I'll check openspec and related context, and finish reading the version tests.
- Assistant
I'll look for existing disk-cache patterns and data directory configuration to decide on the best fix approach.
- Assistant
Inspecting settings defaults and how the data directory is used elsewhere.
- Assistant
I'll check conventions, how settings.home works, and the latest codex package version.
- Assistant
I'll implement a comprehensive fix:
- Assistant
Let me check how the version cache is invalidated and how home_dir settings work.
- Assistant
Confirming unit tests construct local caches; I'll ensure the global singleton uses disk cache carefully.
- Assistant
I'll implement npm fallback, disk cache, and bump the default client version.
- Assistant
Implementing the updated
codex_version.pywith npm fallback and on-disk cache. - Assistant
I'll overwrite the file with a shell redirect instead.
- Assistant
Next I'll bump the baked-in default client version.
- Assistant
Need to goto line first or use sed.
- Assistant
Now I can replace.
- Assistant
I'll write a temporary script to verify npm fallback and disk cache behavior.
- Assistant
Running the existing codex_version unit tests to see how they interact with the change.
- Assistant
I'll also sanity-check a real network fetch and fix the slightly broader exception log message.
- Assistant
Fixing fallback so a stale disk cache can't override a newer settings default.
- Assistant
I'll update fallback selection to pick the newest available version among memory, disk, and settings.
- Assistant
I need to fix a stray character in a comment and add the missing
_version_sort_keyhelper. - Assistant
Adding the missing
_version_sort_keyhelper now. - Assistant
Let me insert the helper between lines 19 and 22.
- Assistant
There's a missing blank line before the class — fixing it.
- Assistant
Re-running verification with the updated fallback logic.
- Assistant
Checking lint and reviewing the final file.
- Assistant
Lint is clean. Simplifying redundant settings-default logic, then submitting.
- Assistant
Need to goto first
- Assistant
Let me simplify
- Assistant
Final verification, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.