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
Let me explore the repository structure to understand the codebase and find the relevant files.
Assistant
I'll explore the repository structure first.
Assistant
Let me look at the relevant files in the app directory.
Assistant
Now let me look at the related files - settings, model refresh scheduler, and model fetcher.
Assistant
I need to make only one tool call at a time.
Assistant
Now let me look at the model fetcher and how it uses the client version.
Assistant
Let me look at the settings file and the load balancer code mentioned in the issue.
Assistant
Let me look at the load balancer code and how client_version is used in requests.
Assistant
Let me look at how the proxy handles incoming requests and the client_version query parameter.
Assistant
Let me look at the load balancer code around line 1168 mentioned in the issue.
Assistant
Let me look at existing tests for codex_version.
Assistant
Now I have a clear understanding of the issue. Let me reproduce the problem by examining the flow. The core issue is that when GitHub API is rate-limited (403), the version cache falls back to the stale default
0.101.0, which is too old and causes newer models to be excluded from the registry.Let me implement fix option #2 (add a secondary version source via npm registry) which is the most robust approach. Let me first write a reproduction script.
Assistant
I've reproduced the issue. Now let me implement the fix by adding a secondary npm registry version source. Let me open and edit the file.
Assistant
Now let me implement the fix by adding a secondary npm registry version source. I'll modify the file to try npm registry when GitHub fails.
Assistant
Now let me update the
get_versionmethod to try npm registry as a fallback when GitHub fails.Assistant
Now let me add the
_fetch_latest_version_npmmethod after the_fetch_latest_versionmethod.Assistant
I see a duplicate line was created. Let me fix it.
Assistant
The file looks good. Now let me write a test to verify the fix works - when GitHub returns 403, the npm registry fallback should be tried.
Assistant
The fix works. Now let me run the existing tests to make sure they still pass.
Assistant
All existing tests pass. Let me also run the related model_fetcher and model_refresh_scheduler tests.
Assistant
All tests pass. Let me clean up the temporary test files and do a final review of the changes.
Assistant
The changes look clean. Let me check if any other tests reference the old log message strings that I changed.
Assistant
No tests reference those strings. Let me run a broader test suite to make sure nothing is broken.
Assistant
All 1889 tests pass with 39 skipped. Let me do a final review of the complete file.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.