diff --git a/tests/unit/test_openai_compat.py b/tests/unit/test_openai_compat.py index 497b062..f54f796 100644 --- a/tests/unit/test_openai_compat.py +++ b/tests/unit/test_openai_compat.py @@ -1115,3 +1115,31 @@ class TestDefaultClientFactory: assert client.trust_env is trust_env finally: await client.aclose() + + +@pytest.mark.parametrize("key", ["depth.key", "off_control", "switch"]) +async def test_custom_profile_raw_roots_cannot_override_managed_intent(key): + registry = { + "custom": ProviderProfile( + name="custom", + thinking=ThinkingWire( + off={"off_control": False}, on_base={"switch": True}, effort_key="depth.key" + ), + strip_think_tags=False, + ) + } + sent = [] + transport = _transport_for( + lambda request: sent.append(request) or _sse_stream(_chunk(content="x")), registry=registry + ) + try: + with pytest.raises(RequestRejectedError, match="冲突"): + await _complete( + transport, + _source(provider="custom"), + reasoning_effort=Effort.HIGH, + overlay={key: True}, + ) + assert sent == [] + finally: + await transport.aclose()