test: guard custom reasoning roots at the transport boundary

This commit is contained in:
2026-09-09 01:35:14 -04:00
parent 47488ee4fd
commit a0a33c0c01
+28
View File
@@ -1115,3 +1115,31 @@ class TestDefaultClientFactory:
assert client.trust_env is trust_env assert client.trust_env is trust_env
finally: finally:
await client.aclose() 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()