From 92a297a6c851a7eeba7cc3e77ad27f19079a36b4 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Tue, 8 Sep 2026 23:51:16 +0800 Subject: [PATCH] fix(codex): refresh model catalog for Astra The Codex catalog gates model visibility by client version. Requests advertising 0.144.0 succeed but omit Astra for an otherwise eligible account. Use the validated 0.153.4 catalog version so account discovery can expose it without changing model defaults or fallback entries. Pin the expected wire version independently in the regression test and cover both Astra and future account models while preserving hidden-model filtering. --- nanobot/providers/openai_codex_provider.py | 3 ++- tests/providers/test_oauth_model_catalog.py | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/nanobot/providers/openai_codex_provider.py b/nanobot/providers/openai_codex_provider.py index edbd90b17..fa90c4a60 100644 --- a/nanobot/providers/openai_codex_provider.py +++ b/nanobot/providers/openai_codex_provider.py @@ -47,7 +47,8 @@ from nanobot.providers.registry import ProviderModelSpec, find_by_name DEFAULT_CODEX_URL = "https://chatgpt.com/backend-api/codex/responses" DEFAULT_OPENAI_CODEX_MODELS_URL = "https://chatgpt.com/backend-api/codex/models" -OPENAI_CODEX_CATALOG_CLIENT_VERSION = "0.144.0" +# The server gates model visibility by client version; older catalogs omit Astra. +OPENAI_CODEX_CATALOG_CLIENT_VERSION = "0.153.4" DEFAULT_ORIGINATOR = "nanobot" _COMPACTION_RETAINED_CHAR_BUDGET = 256_000 diff --git a/tests/providers/test_oauth_model_catalog.py b/tests/providers/test_oauth_model_catalog.py index bfb7060fd..ccac4ca18 100644 --- a/tests/providers/test_oauth_model_catalog.py +++ b/tests/providers/test_oauth_model_catalog.py @@ -16,10 +16,7 @@ from nanobot.providers.oauth_model_catalog import ( get_oauth_model_catalog, invalidate_oauth_model_catalog, ) -from nanobot.providers.openai_codex_provider import ( - DEFAULT_OPENAI_CODEX_MODELS_URL, - OPENAI_CODEX_CATALOG_CLIENT_VERSION, -) +from nanobot.providers.openai_codex_provider import DEFAULT_OPENAI_CODEX_MODELS_URL from nanobot.providers.registry import ProviderModelSpec from nanobot.providers.xai_grok_provider import DEFAULT_XAI_GROK_MODELS_URL from nanobot.providers.xai_oauth import XAIToken @@ -142,9 +139,15 @@ def test_xai_catalog_fetches_remote_models_and_reuses_capability_metadata( assert get_oauth_model_catalog("xai_grok").source == "cache" +@pytest.mark.parametrize( + ("model_id", "label"), + [("gpt-new", "GPT New"), ("gpt-6-astra", "GPT-6-Astra")], +) def test_openai_codex_catalog_uses_account_catalog_and_filters_hidden_models( monkeypatch: pytest.MonkeyPatch, tmp_path: Path, + model_id: str, + label: str, ) -> None: original_client = httpx.Client captured: dict[str, object] = {} @@ -156,8 +159,8 @@ def test_openai_codex_catalog_uses_account_catalog_and_filters_hidden_models( json={ "models": [ { - "slug": "gpt-new", - "display_name": "GPT New", + "slug": model_id, + "display_name": label, "description": "New model", "context_window": 300_000, "priority": 2, @@ -213,14 +216,16 @@ def test_openai_codex_catalog_uses_account_catalog_and_filters_hidden_models( assert catalog.source == "remote" assert [model.id for model in catalog.models] == [ "openai-codex/gpt-first", - "openai-codex/gpt-new", + f"openai-codex/{model_id}", ] + assert catalog.models[1].label == label assert catalog.models[1].context_window == 300_000 assert catalog.models[1].reasoning_efforts == ("low", "high") request = captured["request"] assert isinstance(request, httpx.Request) assert request.url.copy_with(query=None) == httpx.URL(DEFAULT_OPENAI_CODEX_MODELS_URL) - assert request.url.params["client_version"] == OPENAI_CODEX_CATALOG_CLIENT_VERSION + # Assert the validated wire version, not the same constant used by the request. + assert request.url.params["client_version"] == "0.153.4" assert request.headers["Authorization"] == "Bearer secret" assert request.headers["chatgpt-account-id"] == "account-42"