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
Good, those tests mock
get_codex_version_cacheentirely, so the real singleton (with disk cache path) is never invoked in those tests. Let's check further to be safe.Assistant
Now let's add new settings fields for the npm fallback toggle and disk cache file path/TTL.
Assistant
Now let's rewrite codex_version.py with npm fallback and disk cache support.
Assistant
Now let's run the existing unit tests for codex_version.
Assistant
All existing tests pass. Now let's run the broader test suite for model fetcher/refresh/registry and settings to check nothing else broke.
Assistant
Now let's check settings-related tests to ensure new fields don't break anything (e.g., settings dump/schema tests, env var listing tests).
Assistant
Let's check the dashboard settings API to see if there's a schema listing all settings fields that might need updating (e.g., env docs generator or dashboard settings exposure allowlist).
Assistant
This confirms the disk-cache persistence path resolves the reported issue (stale fallback → 503 on newer models) by retaining the last successfully observed Codex CLI version across restarts and rate-limited GitHub API failures, with npm registry as a secondary live source. Let's clean up temp script and run the full unit test suite to be safe.
Assistant
All 1889 unit tests pass (pre-existing warnings unrelated to this change). Now let's check the CHANGELOG to see if we should add an entry (repo convention).
Assistant
No matches — nothing else to update there. Let's double check
git diffsummary and run relevant broader test groups (proxy load balancer, model registry) once more, plus type-check if available.Assistant
Type checking and linting both pass. Let's run
ty checkon the whole app quickly to ensure nothing else broke due to settings changes (e.g., anywhere iterating over all fields).Assistant
Excellent, full type-check passes. Now let's format-check with ruff format.
Assistant
Now let's re-run tests once more after formatting to make sure nothing changed unexpectedly.
Assistant
Good. Now let's run the full unit test suite one final time to confirm overall health.
Assistant
All 1889 tests pass, same as before the change (pre-existing skips/warnings unrelated). Let's view final diff for review.
Assistant
Not relevant — no docs need updating. The implementation is complete. Let's do one final full test run to be thorough, including integration tests if feasible.
Assistant
No references in integration/e2e tests, so the unit test suite (all passing) is sufficient coverage. The change is complete, isolated, linted, type-checked, and verified against a reproduction script matching the issue's exact failure scenario.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.