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 analyze this issue:
-
The problem is that when
app/core/clients/codex_version.pycan't fetch the latest codex release from GitHub (due to rate limiting with HTTP 403), it falls back to a default version (0.101.0). -
This stale version causes the model registry to query with an outdated
client_version, which excludes newer models likegpt-5.5from the response. -
The result is that all requests for
gpt-5.5are rejected with a 503 error.
The suggested fixes include:
- Bump the baked-in default version on each release
- Add a secondary version source (npm registry)
- Cache the fetched version on disk
- Honor the client's own
client_versionquery string
Let me start by exploring the repository structure and understanding the codebase.
-
Assistant
Let me explore the app directory structure and find the files mentioned in the issue.
Assistant
The user wants to solve an issue where stale 'client_version' fallback causes 503 errors for newer models like gpt-5.5 when GitHub releases API rate-limits. Let me first explore the repository structure to understand the codebase and find the relevant files.
Assistant
Let me examine the
codex_version.pyfile first to understand the current implementation:Assistant
Let me now check the settings file to see where the default client version is configured:
<tool_call> <function=bash_terminal> <parameter=command> grep -r "model_registry_client_version" /codex-lb/app/ --include="*.py" </tool_call>
Assistant
Let me search for the model_registry_client_version in the codebase.
Assistant
Let me look at the settings file to understand how this default is configured:
<tool_call> <function=bash_terminal> <parameter=command> cat /codex-lb/app/core/config/settings.py </tool_call>
Assistant
The user wants to solve an issue where stale 'client_version' fallback causes 503 errors. Let me look at the settings file first to understand the current configuration.
Assistant
Now I can see the issue clearly:
- In
settings.py, the defaultmodel_registry_client_versionis set to"0.101.0" - In
codex_version.py, when GitHub API fails (e.g., due to 403 rate limiting), it falls back to this stale version - This causes newer models like
gpt-5.5to not be available
Let me also look at the
codex_version.pyfile to see the current implementation:<tool_call> <function=bash_terminal> <parameter=command> cat /codex-lb/app/core/clients/codex_version.py </tool_call>
- In
Assistant
The user wants me to solve an issue where stale 'client_version' fallback causes 503 errors. Let me examine the relevant files and understand the problem.
Looking at the error message, I see the issue: when GitHub releases API rate-limits (HTTP 403), the code falls back to an old version (0.101.0), which doesn't support newer models like gpt-5.5.
The suggested fixes include:
- Bump the baked-in default version
- Add a secondary version source (npm registry)
- Cache the fetched version on disk
- Honor the client's own client_version query string
Let me first look at the existing codex_version.py file to understand the current implementation.
Assistant
Now I understand the issue. The code:
- Tries to fetch the latest codex version from GitHub releases API
- When it fails (HTTP 403 due to rate limiting), it falls back to the default
model_registry_client_versionwhich is0.101.0 - This old version doesn't support newer models like
gpt-5.5
Let me check the Dockerfile to understand how the data directory is set up and if there's already any caching mechanism:
Assistant
Let me look at the model_fetcher.py to understand how the client_version is used:
Assistant
Now I understand the issue better. Let me look at the test file for codex_version to understand how it's tested:
<tool_call> <function=bash_terminal> <parameter=command> find /codex-lb/tests -name "codex_version" -type f </tool_call>
Assistant
Let me look at the test files to understand the testing approach and the directory structure better:
Assistant
Let me search for tests related to codex_version:
<tool_call> <function=bash_terminal> <parameter=command> find /codex-lb/tests -name "version" -type f </tool_call>
Assistant
Let me search for tests related to codex_version or model_fetcher:
Assistant
Now let me look at the unit test for codex_version to understand how it's tested:
<tool_call> <function=bash_terminal> <parameter=command> cat /codex-lb/tests/unit/test_codex_version.py </tool_call>
Assistant
The user wants to solve an issue where stale 'client_version' fallback causes 503 errors. Let me look at the test file to understand how the codex_version is tested and also understand the overall issue better.
Assistant
Now I understand the issue. The problem is:
- When GitHub releases API returns 403 (rate limit), the code falls back to the hardcoded default version
0.101.0 - This old version doesn't support newer models like
gpt-5.5
Let me check what the current default version is in settings.py and then implement a fix:
- When GitHub releases API returns 403 (rate limit), the code falls back to the hardcoded default version
Assistant
Now I need to implement a fix. The suggested fixes include:
- Bump the baked-in default version
- Add a secondary version source (npm registry)
- Cache the fetched version on disk
- Honor the client's own client_version query string
Looking at the issue, the best approach would be to:
- Update the default version to a more recent one (e.g., 0.130.0)
- Add a secondary fallback source (npm registry)
Let me first update the default version in settings.py, and then update codex_version.py to try npm registry as a secondary source.
First, let me check if there are any other places where the version is referenced or used:
<tool_call> <function=bash_terminal> <parameter=command> grep -r "0.101.0" /codex-lb/app/ --include="*.py" </tool_call>
Assistant
Let me run the grep command properly.
Assistant
Now I understand the issue. The problem is:
- When GitHub releases API returns 403 (rate limit), the code falls back to the hardcoded default version
0.101.0 - This old version doesn't support newer models like
gpt-5.5
Let me implement a fix that:
- Updates the default version to a more recent one (
0.130.0) - Adds npm registry as a secondary fallback source when GitHub API fails
First, let me update the default version in settings.py:
- When GitHub releases API returns 403 (rate limit), the code falls back to the hardcoded default version
Assistant
Let me verify the change was made correctly.
<tool_call> <function=bash_terminal> <parameter=command> grep -n "model_registry_client_version" /codex-lb/app/core/config/settings.py </tool_call>
Assistant
Let me verify the change was made correctly by viewing the relevant line in the settings.py file.
Assistant
Now let me also add the npm registry fallback to the
codex_version.pyfile. First, let me view the current implementation:Assistant
Now I'll update the
codex_version.pyfile to add npm registry as a secondary fallback source when GitHub API fails. This will provide a more recent version even when GitHub rate limits requests.Assistant
The user wants to solve an issue where stale 'client_version' fallback causes 503 errors for newer models like gpt-5.5 when GitHub releases API rate-limits.
Let me now verify the changes I made:
<tool_call> <function=bash_terminal> <parameter=command> cat /codex-lb/app/core/clients/codex_version.py </tool_call>
Assistant
The user is providing me with a terminal environment where I need to solve an issue. Let me check the current state of the file after my changes.
Assistant
Good, the changes look good. Now let me verify the settings.py change:
Assistant
Both changes are in place:
- Updated the default version in
settings.pyfrom0.101.0to0.130.0 - Added npm registry fallback in
codex_version.pyto try npm registry when GitHub API fails
Now let me run the existing unit tests for codex_version to make sure the changes don't break anything:
- Updated the default version in
Assistant
Let me try installing the test dependencies first:
Assistant
Let me try using uv to install the dependencies first:
Assistant
Now let me try running the tests again:
<tool_call> <function=bash_terminal> <parameter=command> cd /codex-lb && uv run pytest tests/unit/test_codex_version.py -v 2>&1 </tool_call>
Assistant
Let me try running the tests using uv run pytest.
Assistant
Assistant
The user wants to test the fix. Let me create a simple script to test the behavior.
Assistant
The fix is working correctly. When GitHub API returns 403 (rate limit), it now falls back to the NPM registry to get the latest version.
Let me also verify the settings change is correct:
Assistant
The fix is working correctly. Let me verify that there are no other places in the codebase that reference the old version number:
Assistant
The only references to the old version are in the test file, which is expected. According to the user's instructions, I should ignore test failures that are expected due to my changes.
Let me verify the changes I made by looking at the git diff:
Assistant
Assistant
The user wants me to run a test to verify the fix handles various edge cases. Let me run the test script.
Assistant
The test failed because of cache - the previous test cached a value. Let me fix the test to use a fresh cache for each test:
Assistant
The tests pass! The fix is working correctly. The warnings in test 5 are just because of the mock setup (a bit of a workaround in the test), but the behavior is correct.
Let me now summarize the changes I made to fix the issue:
-
Updated the default version in
settings.pyfrom0.101.0to0.130.0- This ensures that even when both GitHub and NPM fallback fail, the default version is more recent and supports newer models likegpt-5.5. -
Added npm registry fallback in
codex_version.py- When GitHub API fails (e.g., due to 403 rate limiting), the code now tries npm registry as a secondary source. This provides a more recent version without requiring a settings change.
The changes address the issue by:
- Providing a fallback source (npm registry) when GitHub API is unavailable
- Bumping the default version to a more recent one that supports newer models
Now I need to submit the solution. Let me first verify the changes are correct.
<tool_call> <function=bash_terminal> <parameter=command> cd /codex-lb && git diff --stat </tool_call>
-
Assistant
Let me verify the changes with the git diff command.
Assistant
The changes are complete. Let me now submit the solution.
Assistant
The submit command requires proper formatting. Let me try again.
Assistant
I have made the following changes to fix the issue:
-
Updated the default version in
settings.pyfrom0.101.0to0.130.0- This ensures that even when both GitHub and NPM fallback fail, the default version is more recent and supports newer models likegpt-5.5. -
Added npm registry fallback in
codex_version.py- When GitHub API fails (e.g., due to 403 rate limiting), the code now tries npm registry as a secondary source. This provides a more recent version without requiring a settings change.
These changes address the issue by:
- Providing a fallback source (npm registry) when GitHub API is unavailable
- Bumping the default version to a more recent one that supports newer models
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.