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
I'll start by exploring the repository structure and understanding the relevant files mentioned in the issue.
Assistant
I'll explore the repository structure first.
Assistant
Let me look at the model fetcher and refresh scheduler to understand the flow.
Assistant
Let me look at the settings and understand the config structure.
Assistant
Let me look at the proxy code where client_version might be available, and the model registry.
Assistant
Let me look at how the request is handled in the proxy and how the client_version could be passed. Let me look at the proxy request handling and the load_balancer. Let me focus on the most robust solution.
The issue suggests multiple fixes. The most robust and self-contained fix would be to add a secondary version source (npm registry) as a fallback when GitHub API fails. This directly addresses the root cause: when GitHub is rate-limited, we can fall back to npm registry which is not rate-limited the same way.
Let me implement a secondary npm registry fetch as a fallback in
codex_version.py. This way, if GitHub fails, we try npm registry before falling back to the settings default.Let me also look at the tests for codex_version to understand the testing conventions.
Assistant
Now I understand the codebase. The root cause is that when GitHub's anonymous API is rate-limited (403), the code falls back to the stale settings default
0.101.0, which causes upstream to omit newer models. The most robust fix is to add a secondary version source (npm registry) that isn't rate-limited the same way, as suggested in option 2.Let me implement this:
Assistant
Let me make the edits properly. First, update the module-level constants:
Assistant
The edit command syntax requires me to use it differently. Let me look at the usage. The edit command takes LINE_RANGE as positional and REPLACEMENT_TEXT. Let me try using the heredoc syntax.
Assistant
I need to pass the edit as a command string. Let me try:
Assistant
Now let me run the existing tests to make sure they still pass:
Assistant
All existing tests pass. Now let me write a reproduction/test script to verify the new behavior — that when GitHub is rate-limited (403), the npm registry is used as a fallback:
Assistant
The npm fallback works correctly when GitHub is rate-limited. Let me clean up the temp test and run the broader test suite to ensure nothing is broken:
Assistant
Let me check the release_versions test to make sure my changes don't conflict with any version consistency checks:
Assistant
That test is unrelated. Let me run the model fetcher and registry tests to ensure nothing breaks:
Assistant
All relevant tests pass. Let me view the final version of the file:
Assistant
Let me check if any tests assert on the exact log messages I changed:
Assistant
No references to the old log messages. Let me run a broader test suite to confirm nothing breaks:
Assistant
All 1889 unit tests pass. 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.