test(copilot): cover supported xhigh request paths

Add current-main regression coverage for both the registered provider
profile and core GitHub Responses path while leaving live catalog loading
to the complementary catalog-resolution work in #51953.
This commit is contained in:
Bryan Nathan 2026-07-10 19:10:08 +08:00 committed by Teknium
parent cf73b3d411
commit b099652d9f

View file

@ -1995,23 +1995,38 @@ class TestBuildApiKwargs:
)
assert kwargs["extra_body"]["reasoning"] == {"effort": "medium"}
def test_reasoning_xhigh_normalized_for_copilot(self, agent):
"""xhigh effort should normalize to high for Copilot GitHub Models."""
def test_reasoning_xhigh_preserved_for_copilot_when_supported(self, agent, monkeypatch):
"""The registered Copilot profile must preserve a supported xhigh."""
from agent.transports import get_transport
from providers import get_provider_profile
monkeypatch.setattr(
"hermes_cli.models.github_model_reasoning_efforts",
lambda _model: ["none", "low", "medium", "high", "xhigh"],
)
transport = get_transport("chat_completions")
profile = get_provider_profile("copilot")
msgs = [{"role": "user", "content": "hi"}]
kwargs = transport.build_kwargs(
model="gpt-5.4",
model="gpt-5.5",
messages=msgs,
tools=None,
supports_reasoning=True,
reasoning_config={"enabled": True, "effort": "xhigh"},
provider_profile=profile,
)
assert kwargs["extra_body"]["reasoning"] == {"effort": "high"}
assert kwargs["extra_body"]["reasoning"] == {"effort": "xhigh"}
def test_core_responses_preserves_supported_xhigh(self, agent, monkeypatch):
"""The core GitHub Responses path must preserve a supported xhigh."""
monkeypatch.setattr(
"hermes_cli.models.github_model_reasoning_efforts",
lambda _model: ["none", "low", "medium", "high", "xhigh"],
)
agent.model = "gpt-5.5"
agent.reasoning_config = {"enabled": True, "effort": "xhigh"}
assert agent._github_models_reasoning_extra_body() == {"effort": "xhigh"}
def test_reasoning_omitted_for_non_reasoning_copilot_model(self, agent):
agent.base_url = "https://api.githubcopilot.com"