Skip to content
TheChatArchiveThe Chat Archive
QwenQwen/Qwen3.6-27B· alibabaHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Stale 'clientversion' fallback causes 503 'noplansupportformodel' for…

  1. 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.py cannot fetch the latest codex release from api.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.0
    

    and falls back to Settings.model_registry_client_version (default 0.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_plans never gets a gpt-5.5 entry, _filter_accounts_for_model in modules/proxy/load_balancer.py:1168 returns an empty set, and every Codex request for gpt-5.5 is 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.0 and the account's ChatGPT subscription does support the model (calling /backend-api/codex/models?client_version=0.130.0 through the LB returns 200 with the model present).

    Reproduction

    1. Run ghcr.io/soju06/codex-lb:1.17.0 on a host where anonymous GitHub API requests are 403'ed.
    2. Connect a current Codex CLI (e.g. @openai/codex@0.130.0) configured with model = \"gpt-5.5\".
    3. Observe startup log line:
      • GitHub fetch failed and no cached version; falling back to settings default 0.101.0
    4. Every POST /backend-api/codex/responses returns 503 with code no_plan_support_for_model.

    Setting CODEX_LB_MODEL_REGISTRY_CLIENT_VERSION=0.130.0 and recreating the container fully resolves the symptom.

    Suggested fixes

    A few low-effort options, any one would help:

    1. Bump the baked-in default model_registry_client_version on each release so it tracks the recent @openai/codex version (or read it from a generated file at build time).
    2. Add a secondary version source. npm view @openai/codex version against https://registry.npmjs.org is not rate-limited the way the GitHub anonymous API is, and a static fetch of https://registry.npmjs.org/@openai/codex/latest returns JSON containing \"version\".
    3. Cache the fetched version on disk (e.g. inside the data volume) so a single successful lookup survives container restarts and survives transient 403s for the cache TTL.
    4. Honor the client's own client_version query string as a hint for which model list to refresh (only when greater than the configured default), so a newer client effectively bootstraps the registry.

    Workaround

    For anyone hitting this, pass -e CODEX_LB_MODEL_REGISTRY_CLIENT_VERSION=<your-codex-cli-version> to docker run:

    docker run -d \\
      -e CODEX_LB_DASHBOARD_BOOTSTRAP_TOKEN=... \\
      -e CODEX_LB_MODEL_REGISTRY_CLIENT_VERSION=0.130.0 \\
      -p 2455:2455 -p 1455:1455 \\
      -v codex-lb-data:/var/lib/codex-lb \\
      ghcr.io/soju06/codex-lb:1.17.0
    

    Environment

    • codex-lb image: ghcr.io/soju06/codex-lb:1.17.0
    • Codex CLI: @openai/codex@0.130.0
    • Host: macOS, Docker Desktop / Colima
    • Account plan: pro (3 accounts, all plan_type=pro in store.db)

    Related: #480 ("Model metadata for gpt-5.5 not found. Defaulting to fallback metadata") looks like the same underlying cause.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /codex-lb, current file: none) bash-$

  2. Qwen Assistant

    I'll start by exploring the repository structure to understand the codebase and then locate the relevant files mentioned in the issue.

  3. Qwen Assistant

    Let me explore the key files mentioned in the issue description.

  4. Qwen Assistant

    Now let me read the key files mentioned in the issue:

  5. Qwen Assistant

    Now let me look at the model_fetcher.py and model_refresh_scheduler.py:

  6. Qwen Assistant

    Now let me look at the tests directory to understand the testing structure:

  7. Qwen Assistant

    Now let me check the pyproject.toml and version files to understand the project's versioning:

  8. Qwen Assistant

    Now let me understand the issue better. The problem is:

    1. When codex_version.py can't fetch from GitHub (e.g., 403 rate-limited), it falls back to Settings.model_registry_client_version which defaults to 0.101.0
    2. This stale version causes upstream to not return newer models like gpt-5.5
    3. The suggested fixes include: adding a secondary version source (npm registry), caching on disk, or bumping the default

    Let me look at what version information is available:

  9. Qwen Assistant

    Let me check the Dockerfile and understand the data volume structure:

  10. Qwen Assistant

    Now let me check what the data directory is expected to be used for:

  11. Qwen Assistant

    Now let me understand the full picture. Based on the issue, I need to implement a fix. The suggested options are:

    1. Bump the baked-in default
    2. Add a secondary version source (npm registry)
    3. Cache the fetched version on disk
    4. Honor client's client_version as a hint

    I'll implement a combination of options 2 and 3:

    • Add a secondary version source (npm registry) when GitHub fails
    • Cache the fetched version on disk so it survives container restarts

    Let me also check if there's any existing disk caching infrastructure:

  12. Qwen Assistant

    Now let me create my implementation plan. I'll modify codex_version.py to:

    1. Add a secondary version source from npm registry (https://registry.npmjs.org/@openai/codex/latest)
    2. Add persistent disk cache for the fetched version so it survives restarts

    Let me first create a test script to reproduce the issue:

  13. Qwen Assistant

    Good, I've confirmed the issue. Now let me implement the fix. I'll implement:

    1. Persistent disk cache - Store the fetched version on disk so it survives restarts
    2. Secondary npm registry source - When GitHub fails, try npm registry

    Let me now modify codex_version.py:

  14. Qwen Assistant

    Wait, I realize there's an issue with my disk cache path resolution - I'm calling get_settings() at module import time which could cause circular import issues. Let me fix this:

  15. Qwen Assistant

    Okay, I need to run the existing tests to make sure my changes don't break anything. Let me run the tests for the codex_version module first.

  16. Qwen Assistant

    I see the issue - my disk cache is persisting between tests because the tests share the same data directory. The disk cache needs to be properly handled in tests. The tests are using shared state from previous test runs. I need to:

    1. Clear the disk cache module state before each test (the tests should be isolated)
    2. OR mock the disk cache functions in the tests

    Looking at the test output, the disk cache is persisting across test runs. I need to ensure tests are isolated. The proper approach is to also clear the disk cache module-level state when tests need isolation. Let me check if the disk cache file is being created:

  17. Qwen Assistant

    The disk cache is persisting between test runs. The tests need to be isolated. I should add a mechanism to clear the disk cache for testing. Let me modify my implementation to include a way to clear the cache path (for testing purposes) and also clean up the global state:

  18. Qwen Assistant

    I need to properly format my tool call. Let me use the bash_terminal function correctly.

  19. Qwen Assistant

    Looking at the test failures, the issue is that the disk cache file persists between tests within the same pytest session. The tests that expect fallback to settings default are reading the disk cache written by earlier tests.

    Let me check if there's already a conftest.py in the tests directory:

  20. Qwen Assistant

    I see! There's already a _reset_codex_version_cache fixture. I need to extend it to also reset the disk cache module state. Let me update the conftest.py:

  21. Qwen Assistant

    All existing tests pass. Now let me run the other related tests to make sure I didn't break anything:

  22. Qwen Assistant

    Now let me create a comprehensive test to verify my new functionality works correctly:

  23. Qwen Assistant

    Good point - let me run a broader test suite and then submit.

  24. Qwen Assistant

    Let me run a broader test to make sure I haven't broken anything else in the codebase, then I'll submit.

  25. Qwen Assistant

    All 1889 unit tests pass. Let me verify my final changes before submitting.

  26. Qwen Assistant

    Let me review the final implementation:

  27. Qwen Assistant

    Let me review the conftest.py changes and then submit.

  28. Qwen Assistant

    Let me go through the checklist one more time:

    Checklist Review:

    1. If an error was reported in the issue description, I have successfully reproduced it.

      • ✅ I created a reproduction script that confirmed the bug: when GitHub API returns 403, the system falls back to stale default 0.101.0, which doesn't include newer models like gpt-5.5.
    2. If an error was reported in the issue description, I have confirmed that my fix resolves the error.

      • ✅ I created comprehensive tests confirming:
        • npm registry is successfully tried when GitHub returns 403
        • Disk cache is used when both GitHub and npm fail
        • npm fallback correctly parses versions
        • Invalid npm versions fall back to settings default
        • Expired disk cache is ignored
    3. I have thought about edge cases and made sure my fix handles them as well.

      • ✅ Edge cases handled:
        • GitHub API rate-limited (403) → falls back to npm registry
        • Both GitHub and npm fail → uses persistent disk cache
        • Disk cache expired (24h TTL) → falls back to in-memory cache or settings default
        • Invalid version formats from npm → rejected and falls back
        • Pre-release versions (e.g., 0.130.0-beta.1) → rejected
        • Disk I/O errors → silently ignored with debug logging
        • Test isolation → disk cache disabled during tests
    4. I have run existing tests in the repository that might have been affected by the change and made sure they pass.

      • ✅ All 1889 unit tests pass, including all 11 test_codex_version.py tests and all related model registry tests.

    Now let me submit.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.