Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6423,11 +6423,12 @@ def _anthropic_preserve_dots(self) -> bool:
Alibaba/DashScope keeps dots (e.g. qwen3.5-plus).
MiniMax keeps dots (e.g. MiniMax-M2.7).
OpenCode Go/Zen keeps dots for non-Claude models (e.g. minimax-m2.5-free).
ZAI/Zhipu keeps dots (e.g. glm-4.7, glm-5.1)."""
if (getattr(self, "provider", "") or "").lower() in {"alibaba", "minimax", "minimax-cn", "opencode-go", "opencode-zen", "zai"}:
ZAI/Zhipu keeps dots (e.g. glm-4.7, glm-5.1).
AWS Bedrock inference-profile IDs contain dots (e.g. us.anthropic.claude-sonnet-4-5-20250929-v1:0)."""
if (getattr(self, "provider", "") or "").lower() in {"alibaba", "bedrock", "minimax", "minimax-cn", "opencode-go", "opencode-zen", "zai"}:
return True
base = (getattr(self, "base_url", "") or "").lower()
return "dashscope" in base or "aliyuncs" in base or "minimax" in base or "opencode.ai/zen/" in base or "bigmodel.cn" in base
return "dashscope" in base or "aliyuncs" in base or "minimax" in base or "opencode.ai/zen/" in base or "bigmodel.cn" in base or "bedrock-runtime" in base

def _is_qwen_portal(self) -> bool:
"""Return True when the base URL targets Qwen Portal."""
Expand Down
24 changes: 24 additions & 0 deletions tests/agent/test_minimax_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,30 @@ def test_normalize_converts_without_preserve(self):
# Without preserve_dots, dots become hyphens (broken for MiniMax)
assert normalize_model_name("MiniMax-M2.7", preserve_dots=False) == "MiniMax-M2-7"

def test_bedrock_provider_preserves_dots(self):
"""Bedrock inference-profile IDs contain dots that must not be collapsed."""
from types import SimpleNamespace
agent = SimpleNamespace(provider="bedrock", base_url="")
from run_agent import AIAgent
assert AIAgent._anthropic_preserve_dots(agent) is True

def test_bedrock_url_preserves_dots(self):
"""Bedrock base URLs (bedrock-runtime) should also preserve dots."""
from types import SimpleNamespace
agent = SimpleNamespace(provider="custom", base_url="https://bedrock-runtime.us-east-1.amazonaws.com")
from run_agent import AIAgent
assert AIAgent._anthropic_preserve_dots(agent) is True

def test_normalize_preserves_bedrock_inference_profile_dots(self):
from agent.anthropic_adapter import normalize_model_name
# A real Bedrock inference-profile ID must retain its dots
assert normalize_model_name("us.anthropic.claude-sonnet-4-5-20250929-v1:0", preserve_dots=True) == "us.anthropic.claude-sonnet-4-5-20250929-v1:0"

def test_normalize_bedrock_dots_broken_without_preserve(self):
from agent.anthropic_adapter import normalize_model_name
# Without preserve_dots the ID is mangled — this is the bug we are fixing
assert normalize_model_name("us.anthropic.claude-sonnet-4-5-20250929-v1:0", preserve_dots=False) == "us-anthropic-claude-sonnet-4-5-20250929-v1:0"


class TestMinimaxSwitchModelCredentialGuard:
"""Verify switch_model() does not leak Anthropic credentials to MiniMax.
Expand Down
Loading