Skip to content

The agent that grows with you

test(models): pin gpt-6.1-sol-900k's catalog cap through the public resolver

kshitijk4poorbb734b45ac99
diff --git a/agent/model_metadata.py b/agent/model_metadata.py
index 13a581611a9..43d311e2134 100644
--- a/agent/model_metadata.py
+++ b/agent/model_metadata.py
@@ -1708,8 +1708,9 @@ _CODEX_OAUTH_VERIFIED_ABOVE_ADVERTISED_PREFIXES: Dict[str, int] = {
_CODEX_OAUTH_VERIFIED_ABOVE_ADVERTISED_EXACT: Dict[str, int] = {
"gpt-5.4": 900_000, "gpt-daybreak-blue-latest": 900_000,
"gpt-6-astra": 900_000, # advertised 272K; 920,043 input OK, 1,000,043 rejected (live 2026-09-04)
- # advertised 272K; 918,137 input OK, ~931K rejected (live 2026-09-29), in line with the model page's
- # 922,000 max input. EXACT, not a prefix: the dotted slug is its own line and ``-pro`` is not routable.
+ # advertised 272K; 918,137 input OK, ~931K rejected (live 2026-09-29), consistent with the 922K left by
+ # the model page's 1.05M context minus 128K max output (derived, not a published input cap).
+ # EXACT, not a prefix: the dotted slug is its own line and ``-pro`` is not routable.
"gpt-6.1-sol": 900_000,
}
_CODEX_OAUTH_STALE_ADVERTISED_CTX = 272_000 # the only advertised value the bump may override
diff --git a/tests/agent/test_model_metadata.py b/tests/agent/test_model_metadata.py
index a91dfc1d588..664ff8fd278 100644
--- a/tests/agent/test_model_metadata.py
+++ b/tests/agent/test_model_metadata.py
@@ -634,14 +634,15 @@ class TestCodexOAuthContextLength:
)
assert ctx == advertised, f"advertised {advertised} must be trusted"
+ @pytest.mark.parametrize("base", ["gpt-5.6-luna", "gpt-6.1-sol"])
@pytest.mark.parametrize("catalog_max,expected", [(872_000, 872_000), (None, 900_000), (1_050_000, 900_000)])
- def test_opted_in_variant_capped_at_live_catalog_max(self, catalog_max, expected):
+ def test_opted_in_variant_capped_at_live_catalog_max(self, base, catalog_max, expected):
"""An explicit ``-900k`` opt-in resolves to min(900K, catalog ``max_context_window``):
gpt-5.6 advertises 272K with an 872K max (#105443); a catalog without the field or one
- above the live-verified cap keeps 900K."""
+ above the live-verified cap keeps 900K. The 900K table entry is only the fallback."""
from agent.model_metadata import get_model_context_length
- item = {"slug": "gpt-5.6-luna", "context_window": 272_000}
+ item = {"slug": base, "context_window": 272_000}
if catalog_max is not None:
item["max_context_window"] = catalog_max
fake_response = MagicMock()
@@ -651,7 +652,7 @@ class TestCodexOAuthContextLength:
patch("agent.model_metadata.get_cached_context_length", return_value=None), \
patch("agent.model_metadata.save_context_length"):
ctx = get_model_context_length(
- model="gpt-5.6-luna-900k",
+ model=f"{base}-900k",
base_url="https://chatgpt.com/backend-api/codex",
api_key=_codex_jwt("fake-token"),
provider="openai-codex",
diff --git a/tests/hermes_cli/test_gpt6_tiers_registration.py b/tests/hermes_cli/test_gpt6_tiers_registration.py
index f82bb838b98..dac334320bd 100644
--- a/tests/hermes_cli/test_gpt6_tiers_registration.py
+++ b/tests/hermes_cli/test_gpt6_tiers_registration.py
@@ -85,11 +85,12 @@ def test_gpt61_sol_900k_is_opt_in_exact_and_billed_as_the_base():
ids = _finalize_codex_models(["gpt-6.1-sol"]) # what live discovery hands the picker
assert ids.index("gpt-6.1-sol-900k") == ids.index("gpt-6.1-sol") + 1
+ assert not {"gpt-6.1-sol", "gpt-6.1-sol-900k"} & set(_finalize_codex_models(["gpt-5.5"])) # no entitlement, no entry
assert not is_codex_900k_base("gpt-6.1-sol-pro") # exact slug: -pro is not routable on Codex
assert is_codex_context_variant("openai/gpt-6.1-sol-900k")
assert strip_codex_context_variant_suffix("gpt-6.1-sol-900k") == "gpt-6.1-sol"
# The base keeps the advertised 272K; only the explicit variant opts into the bump.
assert _verified_codex_ctx_for_slug("gpt-6.1-sol") is None
- assert _CODEX_OAUTH_STALE_ADVERTISED_CTX < _verified_codex_ctx_for_slug("gpt-6.1-sol-900k") < 922_000 # model page max input
+ assert _CODEX_OAUTH_STALE_ADVERTISED_CTX < _verified_codex_ctx_for_slug("gpt-6.1-sol-900k") < 922_000 # 1.05M context - 128K max output
assert _OFFICIAL_DOCS_PRICING[("openai", "gpt-6.1-sol-900k")] is _OFFICIAL_DOCS_PRICING[("openai", "gpt-6.1-sol")]
assert _compression_threshold_for_model("gpt-6.1-sol-900k", provider="openai-codex") is None