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 view the settings around DEFAULT_HOME_DIR area and add new fields.
Assistant
Now add a validator to expand
codex_version_cache_filepath, mirroringencryption_key_file:Assistant
Now let's rewrite
codex_version.pyto add npm fallback and optional disk persistence:Assistant
Now let's check if
anyio.to_threadis a proper submodule import path, and run the existing tests.Assistant
Good. Now let's run the existing test suite for codex_version, model_fetcher, model_refresh_scheduler, and settings.
Assistant
Only the 5 expected test failures (due to intentional default-version bump) occur; everything else in the full unit test suite passes. Let's also run settings-related tests specifically to be sure the new field doesn't break anything else.
Assistant
All pass. Now let's check the model_fetcher and model_refresh_scheduler tests directly to double-confirm they're unaffected (they mock
get_codex_version_cacheentirely so should be fine, already passed in full run above). Let's verify the model_fetcher.py still uses the same import correctly and check env config docs (.env.example) for new setting documentation.Assistant
No references found elsewhere. Now let's write a quick manual reproduction script simulating the GitHub 403 + npm success scenario, and GitHub+npm both failing with a persisted disk cache, to validate end-to-end behavior.
Assistant
Both scenarios work as intended: npm fallback resolves the GitHub 403 rate-limiting case, and disk-cache persistence survives a simulated restart. Let's clean up the temp script and re-run the full test suite once more to be safe, plus check other related test directories (integration, e2e).
Assistant
Only the expected 5 test failures, all directly caused by the intentional default-version bump (the exact literal
"0.101.0"expectations). Let's run the entire test suite (unit + integration + e2e, where feasible) to be thorough.Assistant
Confirmed — only the 5 expected failures due to the intentional default-value bump. Now let's view the final diff for review.
Assistant
Good, formatting is fine (two blank lines before top-level statement, as per PEP8). Let's check for lint/format tooling in repo (ruff/black) and run it.
Assistant
Ruff passes cleanly. Let's also verify
ruff format --check(if configured) or run whole app import sanity via app startup test (mypy if present).Assistant
Formatting is clean too. Let's double check the whole diff once more and confirm the
app/core/clients/codex_version.pyfile is syntactically valid, then do a final full test run.Assistant
These all already passed in the full run. Let's also check if there's a dashboard/config API that lists all settings and could be affected (e.g. a settings export test verifying the exact set of known keys).
Assistant
Let's make the write atomic (write to a temp file then rename) to be safe for multi-replica deployments sharing a volume.
Assistant
Now add the
osimport:Assistant
Now re-run the reproduction script and the test suite once more to confirm everything still functions correctly with the atomic write.
Assistant
No leftover temp file, atomic rename works. Now let's run the full test suite one final time.
Assistant
Consistent, only the expected 5 failures related to the intentional default bump. Let's view the final full diff for review.
Assistant
Let's view the full final file for a last sanity check.
Assistant
This all looks good. Let's view the settings.py diff once more in full context.
Assistant
This looks complete and correct. Now let's go through the checklist.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.