The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge remote-tracking branch 'origin/main' into HEAD
teknium1a516db44e72f
diff --cc agent/model_metadata.pyindex b4e10b7d559,34e6e8309a7..e068709c008--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@@ -1727,24 -1772,10 +1775,11 @@@ def _codex_oauth_token_fingerprint(accereturn hashlib.sha256(access_token.encode("utf-8")).hexdigest()[:16]- def _extract_chatgpt_account_id(access_token: str) -> Optional[str]:- """``chatgpt_account_id`` from the Codex OAuth JWT, or None on any parse error. Without the- ``ChatGPT-Account-Id`` header /backend-api/codex/models returns ``{"models":[]}`` (HTTP 200)- and the probe silently falls back. Mirrors auxiliary_client.py."""- try:- payload_b64 = access_token.split(".")[1]- claims = json.loads(base64.urlsafe_b64decode(payload_b64 + "=" * (-len(payload_b64) % 4)))- acct_id = claims.get("https://api.openai.com/auth", {}).get("chatgpt_account_id") if isinstance(claims, dict) else None- return acct_id if isinstance(acct_id, str) and acct_id else None- except Exception:- return None--def _fetch_codex_oauth_context_lengths_with_source(access_token: str) -> Tuple[Dict[str, int], bool]:"""Codex catalogue ``{slug: context_window}`` plus whether it came from HTTP. Cached per token- fingerprint (windows vary by entitlement). An in-process hit reports False: not a fresh- provider confirmation, must not drive persistent writes."""+ fingerprint (windows vary by entitlement); ``max_context_window`` lands in+ ``_codex_oauth_max_context_cache`` under the same key. An in-process hit reports False: not a+ fresh provider confirmation, must not drive persistent writes."""now = time.time()cache_key = _codex_oauth_token_fingerprint(access_token)cached = _codex_oauth_context_cache.get(cache_key)