Background
While building the SDK test-build coverage branch, provider message conversion tests found that ContentElement allows inconsistent payloads.
Reproducer
message = Message(role='user', content=[ContentElement(type='image_url')])
message.get_content_platform_message_chain()
Expected: model validation should reject type='image_url' unless image_url is present, or conversion should return a structured validation error.
Actual: construction succeeds, and conversion later crashes when it assumes the image payload exists.
Risk
- Invalid provider messages can be accepted at SDK boundary and fail later in conversion.
- Plugin authors get a runtime exception far away from the bad input.
- Similar typed content variants may need required-payload validation as well.
Test Signal
Locked in test-build as an xfail(strict=True) contract test:
tests/api/entities/builtin/test_provider_message.py::test_message_image_url_content_should_validate_required_payload
No source fix is included in the test-build branch.
Background
While building the SDK
test-buildcoverage branch, provider message conversion tests found thatContentElementallows inconsistent payloads.Reproducer
Expected: model validation should reject
type='image_url'unlessimage_urlis present, or conversion should return a structured validation error.Actual: construction succeeds, and conversion later crashes when it assumes the image payload exists.
Risk
Test Signal
Locked in
test-buildas anxfail(strict=True)contract test:tests/api/entities/builtin/test_provider_message.py::test_message_image_url_content_should_validate_required_payloadNo source fix is included in the test-build branch.