Skip to content

test(utilities): cover non-dict message content blocks - #9467

Merged
Vidit Ostwal (Vidit-Ostwal) merged 1 commit into
crewAIInc:mainfrom
Sakura-798:test/message-content-non-dict-blocks
Nov 20, 2026
Merged

Vidit Ostwal (Vidit-Ostwal) merged 1 commit into
crewAIInc:mainfrom
Sakura-798:test/message-content-non-dict-blocks

Conversation

@Sakura-798

Copy link
Copy Markdown
Contributor

Related issue

Fixes #9466

Summary

Adds regression coverage for non-dict blocks in message_content_text().

  • A list containing None, a string, and an integer alongside a valid text block still returns the valid text.
  • A list containing only non-dict blocks returns [multimodal content] rather than a Python repr.
  • No runtime changes.

Verification

  • uv run pytest lib/crewai/tests/utilities/test_agent_utils.py::TestMessageContentText -q -> 11 passed
  • uv run pytest -o addopts='' -p no:cacheprovider lib/crewai/tests/utilities/test_agent_utils.py::TestMessageContentText -q -> 11 passed
  • uv run ruff check lib/ --no-fix
  • uv run ruff format --check lib/

AI assistance

This PR was prepared with AI assistance. The llm-generated label could not be applied by the author because external contributors do not have label permissions; please add it during triage.

@strix-security

strix-security Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 45 commits after the last Strix review (541240b). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

✅ No open security findings.

PR summary: Adds two test cases to TestMessageContentText pinning that non-dict entries in a multimodal content list are skipped, and that a list with no usable text blocks renders as "[multimodal content]" instead of a Python repr. No runtime changes.

Review summary

This PR adds two regression tests and changes no production code: the new cases only assert the string output of the existing message_content_text helper in lib/crewai/src/crewai/utilities/message_utils.py, covering lists that mix non-dict entries with a valid text block and lists of non-dict entries alone. I read the full diff, the helper the tests exercise, and the call sites that consume it, and confirmed the assertions match the implemented behavior (11 tests pass locally). Nothing in the change alters request handling, access control, input parsing, or any other runtime path, so there is no security-relevant behavior introduced or newly exposed.

Review 1 on this PR · 541240b · requested Nov 15 09:59 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings · Try a deeper review with @strix-security /deep

@Sakura-798
Sakura-798 force-pushed the test/message-content-non-dict-blocks branch from 541240b to 7fe2785 Compare November 19, 2026 03:03
@Sakura-798

Copy link
Copy Markdown
Contributor Author

Strix (@strix-security) please review the latest changes after the rebase (head 7fe2785).

@Sakura-798 Sakura-798 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strix (@strix-security) please review the latest changes after the rebase (head 7fe2785).

@Vidit-Ostwal
Vidit Ostwal (Vidit-Ostwal) force-pushed the test/message-content-non-dict-blocks branch from 7fe2785 to c815230 Compare November 20, 2026 09:05
@Vidit-Ostwal
Vidit Ostwal (Vidit-Ostwal) merged commit 0c31a44 into crewAIInc:main Nov 20, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TEST] Cover non-dict blocks in message_content_text

2 participants