From 45f8ba0b9b13a037d73882aacfe1c017bcbfc894 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 20 Jul 2026 03:42:54 -0700 Subject: [PATCH] fix: widen geo-prefix parity to all Bedrock ID normalization sites The au./apac. additions from #46297 and #65973 covered is_anthropic_bedrock_model and _normalize_bedrock_model_name; the same prefix lists exist at two more sibling sites that would still miss au./ca./sa./me./af. profiles: - anthropic_adapter._looks_like_bedrock_model_id - chat_completion_helpers (reasoning stale-timeout floor resolution) All four sites now share the same 11-prefix set (global/us/eu/apac/ap/ au/jp/ca/sa/me/af, longest-first so apac. wins over ap.). The Bedrock picker's BEDROCK_GEO_PREFIXES is deliberately untouched: au. absent there fails open (profile shown), and adding it requires a region-to-geo remap to avoid hiding Sydney profiles. --- agent/anthropic_adapter.py | 5 ++++- agent/bedrock_adapter.py | 5 ++++- agent/chat_completion_helpers.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index 5768ae3ea904..fc5503e41117 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -1582,7 +1582,10 @@ def _is_bedrock_model_id(model: str) -> bool: """ lower = model.lower() # Regional inference-profile prefixes - if any(lower.startswith(p) for p in ("global.", "us.", "eu.", "ap.", "jp.")): + if any(lower.startswith(p) for p in ( + "global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.", + "ca.", "sa.", "me.", "af.", + )): return True # Bare Bedrock model IDs: provider.model-family if lower.startswith("anthropic."): diff --git a/agent/bedrock_adapter.py b/agent/bedrock_adapter.py index e65867921c45..d3e6dfcd101e 100644 --- a/agent/bedrock_adapter.py +++ b/agent/bedrock_adapter.py @@ -448,7 +448,10 @@ def is_anthropic_bedrock_model(model_id: str) -> bool: """ model_lower = model_id.lower() # Strip regional prefix if present - for prefix in ("us.", "global.", "eu.", "apac.", "ap.", "au.", "jp."): + for prefix in ( + "global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.", + "ca.", "sa.", "me.", "af.", + ): if model_lower.startswith(prefix): model_lower = model_lower[len(prefix):] break diff --git a/agent/chat_completion_helpers.py b/agent/chat_completion_helpers.py index 6e583f2cae42..b2e5c8653a48 100644 --- a/agent/chat_completion_helpers.py +++ b/agent/chat_completion_helpers.py @@ -341,7 +341,10 @@ def _bedrock_reasoning_stale_floor(model_id: object) -> "float | None": if not model_id or not isinstance(model_id, str): return None name = model_id.strip().lower() - for prefix in ("us.", "eu.", "apac.", "ap.", "global.", "jp."): + for prefix in ( + "global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.", + "ca.", "sa.", "me.", "af.", + ): if name.startswith(prefix): name = name[len(prefix):] break