The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(astra): probe the chatgpt.com catalog with a JWT-shaped OAuth token
kshitijk4poor5b320a0ebfc5
diff --git a/tests/agent/test_astra_baseline_runtime.py b/tests/agent/test_astra_baseline_runtime.pyindex 1c1d514b70c..68e50afa955 100644--- a/tests/agent/test_astra_baseline_runtime.py+++ b/tests/agent/test_astra_baseline_runtime.py@@ -1,10 +1,18 @@"""Focused real-path coverage for the GPT-6 Astra baseline contract."""+import base64+import jsonfrom types import SimpleNamespaceimport pytest+def _chatgpt_oauth_token() -> str:+ """A JWT-shaped ChatGPT OAuth access token (chatgpt.com only accepts JWTs; #121486)."""+ enc = lambda obj: base64.urlsafe_b64encode(json.dumps(obj).encode()).rstrip(b"=").decode()+ return f"{enc({'alg': 'RS256'})}.{enc({'https://api.openai.com/auth': {'chatgpt_account_id': 'acct'}})}.sig"++def test_explicit_astra_resolves_and_uses_official_responses(monkeypatch, tmp_path):"""A fresh profile resolves metadata and routes the official endpoint without live I/O."""monkeypatch.setenv("HERMES_HOME", str(tmp_path))@@ -66,8 +74,9 @@ def test_astra_900k_opt_in_preserves_live_limits_and_wire_contract(monkeypatch,json=lambda: {"models": [{"slug": "gpt-6-astra", "context_window": advertised}]},))route = {"base_url": "https://chatgpt.com/backend-api/codex", "provider": "openai-codex"}- assert metadata.get_model_context_length("gpt-6-astra-900k", api_key="test-token", **route) == expected- assert metadata.get_model_context_length("gpt-6-astra", api_key="test-token", **route) == advertised+ token = _chatgpt_oauth_token()+ assert metadata.get_model_context_length("gpt-6-astra-900k", api_key=token, **route) == expected+ assert metadata.get_model_context_length("gpt-6-astra", api_key=token, **route) == advertisedassert codex_supported_efforts("gpt-6-astra-900k") == CODEX_ASTRA_EFFORTSfor config in ({"effort": "max"}, {"enabled": False}):