Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· unknownHugging 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.

    Interface

    No new interfaces are introduced.

    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. MiniMax Assistant

    Let me start by exploring the repository structure to understand the codebase.

  3. MiniMax Assistant

    Let me explore the repo structure.

  4. MiniMax Assistant

    Now let me look at the settings file and model_fetcher.

  5. MiniMax Assistant

    Let me look at the settings file to understand the context:

  6. MiniMax Assistant

    Now let me look at the tests for codex_version and look at the broader testing infrastructure.

  7. MiniMax Assistant

    Now let me check tests directory structure more thoroughly and see if there's already a test that we need to be aware of:

  8. MiniMax Assistant

    Let me look at how fetch_models_for_plan is being called and understand the model registry refresh flow:

  9. MiniMax Assistant

    Let me explore how requests come in to see if we can detect the client's client_version:

  10. MiniMax Assistant

    The client sends an x-openai-client-version header to upstream but this is currently just forwarded, not consumed. Let me look at what's in service.py and see how client_version is received:

  11. MiniMax Assistant

    Let me look at the load balancer to understand how the model is matched for routing:

  12. MiniMax Assistant

    Let me look at existing tests for the load balancer and look at existing test fixtures to understand the conventions:

  13. MiniMax Assistant

    Let me also check the proxy module to understand how the request flow works:

  14. MiniMax Assistant

    Let me check what happens when the registry is empty or doesn't have the model:

  15. MiniMax Assistant

    Let me check what data directory is used and look at related code:

  16. MiniMax Assistant

    Now let me look at how the tests use _filter_accounts_for_model and the overall request flow:

  17. MiniMax Assistant

    Let me look at how upstream requests are made in the proxy:

  18. MiniMax Assistant

    Now I have a clear plan. Let me create a reproduction script first to confirm my understanding:

  19. MiniMax Assistant

    The bug is confirmed. Now let me implement the fix. I'll:

    1. Add npm registry as a secondary version source (not rate-limited like GitHub's anonymous API)
    2. Add disk-based persistence so cached version survives container restarts
    3. Update default model_registry_client_version to a more recent version

    Let me first look more carefully at how the disk-based persistence should work:

  20. MiniMax Assistant

    Let me look at how the data directory gets created:

  21. MiniMax Assistant

    Now let me look at what versions are referenced elsewhere (related to npm registry or fixtures):

  22. MiniMax Assistant

    Now let me design my implementation. First, let me look at relevant parts of the code:

  23. MiniMax Assistant

    Now let me implement the fix. I'll modify codex_version.py to:

    1. Add npm registry fallback as a secondary version source
    2. Add disk-based persistence of fetched version
  24. MiniMax Assistant

    Let me now write the comprehensive fix. I'll make these changes:

    1. codex_version.py - Add disk-based caching and npm registry fallback
    2. settings.py - Update default version to be more current
  25. MiniMax Assistant

    Now let me update the settings.py to bump the default. Let me also update the conftest fixture to reset the new disk cache path:

  26. MiniMax Assistant

    Let me re-examine my approach and refine the disk cache behavior:

  27. MiniMax Assistant

    Let me clean up the type hints using the Ellipsis type directly rather than the convoluted type(...) pattern:

  28. MiniMax Assistant

    Now let me run the existing tests to see if my changes broke anything:

  29. MiniMax Assistant

    Let me check the conftest setup more carefully:

  30. MiniMax Assistant

    I need to rethink the disk cache default. Let me check whether existing tests would break due to disk cache pollution between tests:

  31. MiniMax Assistant

    I need to make disk cache opt-in by default, to avoid breaking existing tests. Let me update:

  32. MiniMax Assistant

    Now let's run the tests:

  33. MiniMax Assistant

    All tests pass. Now let me write a more thorough reproduction script to verify my fix works:

  34. MiniMax Assistant

    Excellent! All four scenarios pass. Let me run the full test suite to ensure nothing else is broken:

  35. MiniMax Assistant

    All 1889 unit tests pass. Let me also check the integration tests:

  36. MiniMax Assistant

    Let me verify everything still works with a more thorough test of all related test files:

  37. MiniMax Assistant

    Let me check if there's any other reference to codex_version that might be affected:

  38. MiniMax Assistant

    Let me also run a more rigorous subset of tests around the model registry and proxy to make sure my changes don't break anything:

  39. MiniMax Assistant

    Let me also verify with the test_proxy_api_responses_contract.py which seems most relevant:

  40. MiniMax Assistant

    Let me check the container detection logic to verify the disk cache path resolution:

  41. MiniMax Assistant

    Let me write a more thorough end-to-end test to simulate the actual reported scenario:

  42. MiniMax Assistant

    Let me check if there are any additional project guidelines I should follow:

  43. MiniMax Assistant

    Let me verify the model_fetcher.py is unchanged in its core behavior:

  44. MiniMax Assistant

    Let me run my comprehensive verification one more time after all changes:

  45. MiniMax Assistant

    Let me run all unit tests and the integration tests one more time to make sure everything is intact:

  46. MiniMax Assistant

    Let me also run the complete unit test suite one more time:

  47. MiniMax Assistant

    Let me check that linting is clean:

  48. MiniMax Assistant

    Let me verify everything still passes after formatting:

  49. MiniMax Assistant

    Let me also re-verify the fix scenarios pass after reformat:

  50. MiniMax Assistant

    Let me check the final code:

  51. MiniMax Assistant

    Let me check my git diff to see all the changes I've made:

  52. MiniMax Assistant

    Let me clean up my temporary test files and finalize:

  53. MiniMax Assistant

    Let me run the tests one final time:

  54. MiniMax Assistant

    Let me also run all the model-related integration tests:

  55. MiniMax Assistant

    Let me also re-verify the existing test for stale cache fallbacks still passes:

  56. MiniMax Assistant

    Let me confirm my final state and that all changes are clean:

  57. MiniMax Assistant

    All changes look clean. Let me provide a final review of my approach:

    Checklist review:

    1. Reproduced the error: ✅ I wrote and ran a reproduction script that confirmed the bug: with GitHub 403 (rate limited), the system falls back to the stale 0.101.0 default.

    2. Confirmed my fix resolves the error: ✅ I verified all scenarios:

      • GitHub 403 + npm registry works → returns current npm version (e.g., 0.130.5), not the stale default.
      • Container restart + total network failure → returns the disk-cached version (e.g., 0.130.0), not the stale default.
      • Total network failure + no cache → returns the settings default (preserved as last-resort fallback).
      • Successful GitHub fetch → persists to disk for future restarts.
    3. Thought about edge cases: ✅ I considered and handled:

      • Invalid JSON in disk cache (silently ignored).
      • Read-only disk (OSError caught).
      • Both GitHub and npm return invalid version.
      • Concurrent calls during network failure (lock prevents thundering herd).
      • Stale in-memory cache (reset cached_at on use so next call retries after TTL).
      • Test isolation (disk caching is opt-in via constructor parameter).
    4. Ran existing tests: ✅ All 1889 unit tests and 649 integration tests pass. Specifically:

      • All 11 tests in tests/unit/test_codex_version.py pass without modification.
      • Related tests in test_model_fetcher.py, test_model_refresh_scheduler.py, test_model_registry.py, test_model_registry_lock.py, test_load_balancer.py all pass.

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