The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(openai): cap Astra Codex OAuth fallback
Eva3825d251916d
diff --git a/agent/model_metadata.py b/agent/model_metadata.pyindex 6dabad25481..de4a2b34dbf 100644--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@ -1438,6 +1438,7 @@ def _query_anthropic_context_length(model: str, base_url: str, api_key: str) -># Codex OAuth `context_window` values (what Codex enforces — lower than the direct API for the same# slugs). Fallback when the live probe fails; longest-key-first. gpt-5.3-codex-spark is listed so "gpt-5.3-codex" doesn't win._CODEX_OAUTH_CONTEXT_FALLBACK: Dict[str, int] = {+ "gpt-6-astra": 272_000,"gpt-5.1-codex-max": 272_000, "gpt-5.1-codex-mini": 272_000, "gpt-5.3-codex": 272_000,"gpt-5.3-codex-spark": 128_000, "gpt-5.2-codex": 272_000, "gpt-5.4-mini": 272_000,"gpt-5.6-sol": 272_000, "gpt-5.6-terra": 272_000, "gpt-5.6-luna": 272_000, "gpt-daybreak-blue-latest": 272_000,diff --git a/tests/agent/test_astra_baseline_runtime.py b/tests/agent/test_astra_baseline_runtime.pyindex 7ba62cecd47..c26b25786bb 100644--- a/tests/agent/test_astra_baseline_runtime.py+++ b/tests/agent/test_astra_baseline_runtime.py@@ -35,3 +35,14 @@ def test_explicit_astra_resolves_and_uses_official_responses(monkeypatch, tmp_pa)assert kwargs["reasoning"]["effort"] == "low"assert kwargs["prompt_cache_options"] == {"ttl": "30m"}+++def test_astra_codex_oauth_fallback_uses_backend_context_limit():+ """OAuth keeps the Codex backend's 272K fallback; direct API metadata remains 1.05M."""+ from agent.model_metadata import (+ DEFAULT_CONTEXT_LENGTHS,+ _resolve_codex_oauth_context_length_with_source,+ )++ assert DEFAULT_CONTEXT_LENGTHS["gpt-6-astra"] == 1_050_000+ assert _resolve_codex_oauth_context_length_with_source("gpt-6-astra") == (272_000, "fallback")