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 and the relevant files mentioned in the issue.
- Assistant
I'll inspect settings, related tests, and how the version cache is used.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Let me read the tests and related code more carefully.
- Assistant
Let me check the settings defaults, data paths, and any existing docs or related issues.
- Assistant
Let me look for existing specs related to model registry and codex version. Also look at how data_dir is configured.
- Assistant
I'll review how caching and home_dir work, and check recent related changes.
- Assistant
I'll check release process and how version defaults are managed.
- Assistant
I'll check how client versions appear in request paths and what conventions to follow for the change.
- Assistant
Checking
.env.exampleand verifying the npm API response shape, then implementing. - Assistant
Implementing secondary npm source, on-disk cache, and a bumped fallback default in
codex_version.py. - Assistant
I'll rewrite the entire file with a solid implementation.
- Assistant
Disk cache will only be enabled on the global singleton so unit tests stay isolated.
- Assistant
Now update the global cache and the disk read/write to handle None path.
- Assistant
Need to navigate to the line first or use --file
- Assistant
I'll replace the disk cache methods and global.
- Assistant
I'll bump the default settings version next.
- Assistant
Running the existing unit tests and a temporary verification script.
- Assistant
Existing failures are only the bumped default. I'll verify npm fallback and disk cache with a temporary script.
- Assistant
Adding optional GitHub token auth to reduce anonymous rate-limit issues.
- Assistant
Actually, adding GITHUB_TOKEN might be scope creep and changing headers might break the test that checks trust_env. Let me leave it - npm is the right secondary source.
- Assistant
I'll review the final file and run the linter.
- Assistant
Checking
.env.examplefor the default version and verifying gitdiff. - Assistant
Checking how Codex clients report their version on proxy requests.
- Assistant
I'll set per-request timeouts so a slow GitHub call doesn't block the npm fallback.
- Assistant
Need to goto the line first.
- Assistant
There's an issue: test checks trust_env is True on ClientSession call. If I remove timeout from ClientSession and only pass trust_env=True, the test still works:
- Assistant
I'll re-run the verification script and the unit tests that should still pass.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.