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
Let me explore the repository structure to understand the codebase.
Assistant
Now let me look at the model_refresh_scheduler and the load_balancer to understand the full picture.
Assistant
Now let me look at how client_version might be sent by the client and parsed in the proxy. Let me check the proxy API and load balancer.
Assistant
Let me look at the proxy API to understand how client_version query string is handled, and the load_balancer.
Assistant
Let me check the existing tests for codex_version.
Assistant
Let me look at the settings file to understand configuration patterns.
Assistant
Let me check how
get_codex_version_cacheis used and whether tests patch it.Assistant
Let me run the existing codex_version tests first to confirm baseline.
Assistant
Now let me write a reproduction script to confirm the issue.
Assistant
Let me check how tests configure the home directory and settings.
Assistant
Let me check the settings env prefix and validation.
Assistant
I have a clear understanding now. Let me implement the fix: add npm registry as a secondary version source and add disk caching so a successful lookup survives restarts. First, let me add the settings.
Assistant
The replace command needs the file to be opened. Let me use the edit command with line range or open the file first. Let me use the
editcommand.Assistant
Now let me add a validator to allow disabling the disk cache via an empty env value. Let me check existing Path validators.
Assistant
I introduced a duplicate. Let me fix lines 315-316.
Assistant
Now let me rewrite the
codex_version.pywith npm fallback and disk caching.Assistant
Now let me run the existing codex_version tests to ensure compatibility.
Assistant
Now let me update my reproduction script to verify the fix - GitHub 403 should now fall back to npm.
Assistant
My repro's mock session needs async
__aenter__. Let me fix the repro script.Assistant
The npm fallback works. Now let me verify the disk cache survives a restart (both sources fail).
Assistant
Both fixes work. Now let me run the broader unit tests to make sure nothing broke.
Assistant
Let me verify the empty env value disables the disk cache, and run a broader test sweep.
Assistant
All unit tests pass. Let me run a quick check on integration tests related to settings to ensure the new field doesn't break anything.
Assistant
Let me run a few relevant integration tests to confirm no breakage from the settings change.
Assistant
Now let me clean up the temp scripts and review the final diff.
Assistant
Let me check for any other references to the module-level singleton or
CodexVersionCacheconstruction that might rely on eager initialization.Assistant
No other place relies on eager init. Good.
Now let me consider the bootstrap/startup path. Let me check
app/core/bootstrap.pyandapp/main.pyto see ifget_codex_version_cache()is called at startup to warm it up, and whether the lazy init would work. It's lazy and only created on firstget_version()call from the model fetcher. That's fine - it'll be created when the scheduler runs.Actually, let me check if there's a startup warming of the cache. Let me search.
Assistant
Let me confirm the settings file fully validates and the model parses cleanly.
Assistant
That kwarg was ignored (env prefix). Let me test via env var, which is the real path.
Assistant
Empty env disables the disk cache as intended. Let me view the final settings diff to confirm it's clean.
Assistant
Let me add a blank line before the new validator for style consistency.
Assistant
Now let me re-run the codex_version and settings-related unit tests once more to confirm everything is green after the formatting change.
Assistant
Let me check whether there's a settings test that enumerates fields, which could be affected.
Assistant
Let me check if there's a config/env documentation file that lists settings env vars that should be updated.
Assistant
Let me double-check no test calls the real global cache's
get_versionwithout patching (which could hit the network or disk).Assistant
All
get_versioncalls are on local cache instances (no disk path) or patched. Let me run the full unit suite one final time to confirm everything is green.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.