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:GitHub 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:proxy_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
A few low-effort options, any one would help:
- Bump the baked-in default
model_registry_client_versionon each release so it tracks the recent@openai/codexversion (or read it from a generated file at build time).
- Run
- Assistant
I'll start by exploring the repository to understand its structure and locate the relevant files mentioned in the issue description. Let's first check the current directory.
- Assistant
Let me explore the repository structure more thoroughly.
- Assistant
Let me explore the key files mentioned in the issue description.
- Assistant
Let me examine the key files mentioned in the issue description.
- Assistant
Let me now look at the model_fetcher.py and settings.py to understand how the version is used.
- Assistant
Let me look at the settings file to understand the default value and how it's configured.
- Assistant
Let me look at the proxy/load_balancer.py file to understand how the model registry is used.
- Assistant
Let me look at the model_registry.py to understand how models are stored and how model_plans is populated.
- Assistant
Let me look at the model_refresh_scheduler.py to see how models are fetched.
- Assistant
Let me look at the existing tests for codex_version.py to understand what's already tested.
- Assistant
Let me check the version used in the project and understand the issue better. Let me also look at the load_balancer.py to see the
_filter_accounts_for_modelfunction: - Assistant
Now let me check the current version of the codex CLI that's being used:
- Assistant
Let me check the project version and look for any recent version references:
- Assistant
Let me check how
_filter_accounts_for_modelis called: - Assistant
Let me see the context around line 421 to understand how the filtering is used:
- Assistant
The dash is being interpreted. Let me use the open command instead.
- Assistant
Now let me also check the test for model_fetcher and model_refresh_scheduler to understand how they're tested:
- Assistant
Now I have a good understanding of the issue. Let me create a plan:
- Add npm registry as a secondary version source - When GitHub fails, try
https://registry.npmjs.org/@openai/codex/latest - Cache the fetched version on disk - Persist the version in the data volume so it survives container restarts
- Bump the default
model_registry_client_versionfrom0.101.0to0.130.0
Let me implement these fixes. First, let me check what the settings path is for data storage:
- Add npm registry as a secondary version source - When GitHub fails, try
- Assistant
Let me check how settings are used:
- Assistant
Now let me run the existing tests to make sure they pass before making changes:
- Assistant
Let me try with the venv.
- Assistant
Let me also run the model_fetcher test:
- Assistant
Let me also run the model_registry and load_balancer tests:
- Assistant
Now let me implement the fix. I'll modify
app/core/clients/codex_version.pyto add npm registry as a secondary fallback and disk caching: - Assistant
Let me try using a different approach - write the file directly:
- Assistant
Now let me update the default
model_registry_client_versionin settings.py from0.101.0to0.130.0: - Assistant
Let me use sed for this.
- Assistant
Let me verify the changes:
- Assistant
Now let me verify the codex_version.py changes:
- Assistant
Now I need to update the test assertions that reference the old default version "0.101.0" to "0.130.0". Let me do this:
- Assistant
Now let me run the tests to see if they pass with the updated code:
- Assistant
The tests are failing because disk cache is persisting across tests. I need to make disk caching opt-in rather than automatic in
__init__. Let me refactor the approach: - Assistant
Now let me clean up any disk cache files that were created and run the tests again:
- Assistant
All 11 tests pass. Now let me run the model_fetcher test to make sure that still works too:
- Assistant
Let me also run the model_registry and load_balancer tests:
- Assistant
Let me also run the model_refresh_scheduler tests:
- Assistant
Let me run the full unit test suite to make sure nothing is broken:
- Assistant
All 1889 unit tests pass. Let me verify the final state of all changed files:
- Assistant
Let me see the full diff:
- Assistant
The changes look good. Let me run one more comprehensive test to make sure everything passes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.