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
Now let's add a new setting field for the disk-cache path:
Assistant
Now let's add the new setting field:
Assistant
Now let's rewrite
codex_version.pywith npm secondary source and disk-persisted cache (opt-in, defaulting to disabled unless a resolver is supplied):Assistant
Now let's run the existing unit tests for codex_version, model_fetcher, and model_refresh_scheduler:
Assistant
All pass. Now let's run the broader related tests:
Assistant
Now let's write a quick manual reproduction script to validate the npm-fallback and disk-cache behavior end-to-end:
Assistant
This confirms exactly the scenario from the issue: GitHub 403 → npm fallback succeeds with
gpt-5.5-supporting version, and disk persistence survives restarts across transient outages. Now let's run the full test suite to make sure nothing else broke:Assistant
All 2570 tests pass (unrelated pre-existing warnings/skips only). Let's check settings test file for validation of new field and env var handling, plus check documentation references we should update:
Assistant
Good — so this new setting is configurable via
CODEX_LB_MODEL_REGISTRY_CLIENT_VERSION_CACHE_FILE. Let's verify settings module loads fine and do a quick sanity check on the new field:Assistant
Good, no cache file was written during the test suite run (confirming the singleton disk cache isn't touched by tests, preserving isolation). Now let's check the
git diffto review all changes:Assistant
These already passed in the full test suite run. Now let's also check any docker/deployment env var documentation files that list all
CODEX_LB_*variables (e.g., helm charts, docker-compose, env.example):Assistant
Good, matches usage. Now let's re-verify full diff is complete and run linter/type checks if configured (e.g. ruff, mypy):
Assistant
No mypy configured. Let's double check the final file content for correctness once more, and then finalize with full test suite already passed. Let's view the full file to confirm no stray leftover blank line issues:
Assistant
Looks good. Let's view the tail portion to check for blank line formatting near the singleton definition:
Assistant
This all looks correct and clean. Now let's re-run the full test suite once more (final confirmation) and also re-run our manual reproduction script to double check everything is consistent after final edits:
Assistant
All good. Let's clean up any leftover manual test file (none created outside temp) and check git status:
Assistant
Only the intended two files are modified. Now let's go through the checklist explicitly.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.