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 structure to understand the codebase and then locate the relevant files mentioned in the issue.
Assistant
Let me explore the repository structure more carefully, focusing on the main source files.
Assistant
Now let me look at the specific files mentioned in the issue:
Assistant
Now let me look at the settings to understand the default value:
Assistant
Now I can see the problem. Let me also check the model_refresh_scheduler and model_fetcher to understand the full flow:
Assistant
Now I have a clear understanding of the problem. Let me also check if there are any existing tests related to the codex version:
Assistant
Now let me check the pyproject.toml for the project version:
Assistant
Now I understand the full picture. Let me also look at what version info the project already has:
Assistant
Now let me understand the issue better. The problem is:
codex_version.pytries to fetch the latest Codex CLI version from GitHub API- When GitHub API returns 403 (rate-limited), it falls back to
Settings.model_registry_client_versionwhich is hardcoded to0.101.0 - This stale version doesn't support newer models like
gpt-5.5 - The suggested fixes include: bumping the default, adding a secondary version source (npm registry), caching the version on disk, or honoring the client's version
Let me check the Dockerfile to see how the build works:
Assistant
Now let me understand the full picture. Let me check the tests and conftest:
Assistant
Now let me check how the tests work with the codex version:
Assistant
Now I have a clear understanding. Let me plan the fix based on the issue's suggestions:
Issue Analysis:
- When GitHub API is rate-limited (403), the fallback version
0.101.0is too old - This causes newer models like
gpt-5.5to not be included in the model registry - The result is 503 errors for valid models
My Plan (combining suggestions 1 and 3):
- Add a secondary NPM registry source as a fallback when GitHub API fails - this is suggestion #2, which is the most robust solution
- Cache the fetched version on disk so it persists across container restarts - this is suggestion #3
- Bump the default fallback version to a more recent version as an additional safety net - this is suggestion #1
Let me implement the fix:
- When GitHub API is rate-limited (403), the fallback version
Assistant
Now let me implement the fix. I'll modify
codex_version.pyto:- Add NPM registry as a secondary version source
- Cache the version on disk (persisted in the data directory)
- Bump the settings default to a more recent version
Assistant
Now let me also bump the default
model_registry_client_versionin settings to a more recent version. Let me check what would be a reasonable version to use:Assistant
Based on the issue, the problem is that
0.101.0is stale and0.130.0works. Let me bump it to a more recent version. Looking at the issue description, it mentions the Codex CLI is on0.130.0, so let me bump the default to0.130.0:Assistant
Now let me verify the changes:
Assistant
empty message denied
Assistant
empty message denied
Assistant
Now let me check the existing tests to see if they need to be updated for the new default version:
Assistant
The tests reference the old default "0.101.0". Since I changed the default to "0.130.0", I need to update the tests to reflect this change. Let me update them.
Assistant
Wait, I was told not to modify tests. Let me revert the test changes since the instructions say if tests need updating due to my changes, the evaluation system will ignore it.
Assistant
Good, I've reverted the test changes. Now let me run the existing tests to see how they behave with my changes:
Assistant
The user seems to have encountered an issue. Let me continue by running the tests to verify my changes work correctly.
Assistant
The tests can't run because pytest_asyncio is not installed. Let me try installing the dev dependencies properly. )
Assistant
I need to install the dev dependencies to run the tests. Let me try using uv to install the dev group.
Assistant
Now I need to install the dev dependencies. Let me try with the dev group.
Assistant
The user wants me to continue working on the issue. Let me try running the tests now with the installed dependencies.
Assistant
The module is not installed in the right place. Let me try using the venv Python directly.
Assistant
The user hasn't said anything new - this appears to be a system message indicating I should continue. Let me try a different approach to install the test dependencies and run the tests.
Assistant
The tests are failing because my disk persistence is causing state to leak between tests. The first test saves "1.2.3" to disk, and subsequent tests' new
CodexVersionCacheinstances load it from disk during__init__.I need to change my approach: instead of loading from disk in
__init__, I should load from disk lazily inget_version()as a fallback before trying network fetches. This way, disk persistence still works for container restarts, but doesn't interfere with test isolation.Assistant
The user hasn't said anything new - this is just a system reminder. I need to continue working on the issue.
Let me run the tests again to see if my changes fixed the test failures.
Assistant
Looking at the test failures, I can see that the disk persistence is interfering with test isolation. Since I can't modify the tests, let me simplify my approach - I'll keep the essential fixes (NPM fallback + bumped default version) but remove the disk persistence feature since it's causing test issues and is optional according to the issue's suggestions.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.