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
Let me start by understanding the repository structure and the issue. The issue is about a stale
client_versionfallback inapp/core/clients/codex_version.py. When GitHub releases API is rate-limited (returns 403), the code falls back to a default version0.101.0, which is too old for newer models likegpt-5.5.Let me explore the repository structure and understand the codebase.
Assistant
Let me look at the key file mentioned in the issue:
app/core/clients/codex_version.pyAssistant
Let me look at the main file:
app/core/clients/codex_version.pyAssistant
Now let me look at the settings to see the default value:
Assistant
Let me look at the settings file for broader context:
Assistant
Let me look at the model fetcher to understand how the client version is used:
Assistant
Let me look at the existing test for codex_version:
Assistant
Let me also look at the model refresh scheduler:
Assistant
Now let me look at the proxy utils test to see how
client_versionis used:Assistant
Let me look at the load balancer to understand the error flow:
Assistant
Let me look at the relevant part:
Assistant
Let me look at the model_registry:
Assistant
Now I have a clear understanding of the issue. Let me implement a fix. The best approach from the suggested options is adding a secondary version source from npm registry (
https://registry.npmjs.org/@openai/codex/latest), which is not rate-limited like GitHub's API. This gives us a robust fallback.Let me also check if there's a disk cache mechanism already:
Assistant
Let me look at the settings to see how
data_diris used:Assistant
Now let me implement the fix. I'll modify
app/core/clients/codex_version.pyto add:- A secondary version source from npm registry (
https://registry.npmjs.org/@openai/codex/latest) as a fallback when GitHub fails - A disk cache so a single successful lookup survives container restarts
- A secondary version source from npm registry (
Assistant
That's a special command, let me use it properly:
Assistant
Let me try:
Assistant
Now let me implement the fix. I'll modify the file to add npm registry fallback and disk caching:
Assistant
Let me use the correct
editsyntax:Assistant
Let me verify the full file:
Assistant
Now I need to verify that
DEFAULT_HOME_DIRis exported fromapp.core.config.settings:Assistant
Good. Now let me run the existing tests for
codex_versionto see if my changes pass:Assistant
Let me check the Python environment:
Assistant
Let me activate the venv and install the deps:
Assistant
Now let me try running the tests again:
Assistant
The disk cache is causing test failures because it persists between test runs. Since I can't modify the existing tests, I'll remove the disk cache feature and keep only the npm fallback, which is the most impactful fix:
Assistant
Let me clean up the disk cache from previous runs and run the tests again:
Assistant
All tests pass. Let me also run the related unit tests to make sure nothing else is broken:
Assistant
All tests pass. Let me also run the full unit test suite to make sure nothing is broken:
Assistant
All 1889 tests passed. Let me verify the final state of my changes:
Assistant
Let me also verify that the npm registry URL actually returns a valid version:
Assistant
The npm registry returns
0.144.5, confirming it's a working source for the latest version. My changes are minimal and focused:- Added npm registry as a secondary version source (
https://registry.npmjs.org/@openai/codex/latest) - this is not rate-limited like the GitHub API - Refactored
_fetch_latest_versioninto two separate methods (_fetch_version_from_githuband_fetch_version_from_npm) and tries npm after GitHub fails - Updated log messages to be more generic ("Version fetch failed" instead of "GitHub fetch failed")
Let me verify one more time with the full diff:
- Added npm registry as a secondary version source (
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.