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 trace the version resolution and model refresh flow, inspect existing tests/conventions, then implement a resilient fallback that avoids relying solely on the rate-limited GitHub API. I’ll verify with targeted tests (without modifying repository tests), run relevant existing tests, review the diff, and submit only after validation.
- Assistant
The failure is isolated to
CodexVersionCache: it has only an in-memory cache and GitHub as its source, so a cold-start GitHub failure immediately returns the old settings value. I’ll add the npm registry as a secondary source within the same fetch attempt, validate itsversionfield with the existing strict semantic-version rule, and preserve stale/settings fallbacks when both sources fail. This avoids changing the configured fallback to an arbitrary hard-coded release and keeps the existing cache behavior. - Assistant
The targeted version and model-fetcher tests pass. The implementation now tries npm only after GitHub returns a non-success response or an invalid payload, and it still returns GitHub immediately when healthy. I’ll now exercise the explicit 403→npm path with a temporary script, run lint and the broader test suite, then inspect the final diff for compatibility issues.
- Assistant
The full suite passes (2,570 passed, 43 skipped), and the explicit 403→npm reproduction returns
0.130.0. One edge case is worth tightening before submission: a GitHub connection or JSON-decoding exception currently exits before npm is attempted. I’ll isolate GitHub request errors so the secondary source also covers transient network/protocol failures, while retaining settings fallback if npm fails too. - Assistant
The edge-case improvement is applied and validated: lint passes, all 11 codex-version unit tests pass, and the working tree contains only the intended source change. The fix now handles GitHub HTTP errors, malformed responses, and request exceptions by trying npm; if both fail, existing stale-cache and settings-default behavior remains unchanged. I’m submitting the completed change now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.