Skip to content

[test-build] ContentElement allows image_url type without image payload #60

@huanghuoguoguo

Description

@huanghuoguoguo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions