Fix user message text silently dropped when message contains both text and image#8071
Merged
DOsinga merged 3 commits intoblock:mainfrom Mar 24, 2026
Merged
Conversation
c484ffc to
b579349
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c484ffc27d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3878169 to
0f4ad9d
Compare
When a user message contained both `MessageContent::Text` and `MessageContent::Image` blocks, the text was silently dropped because text and image content were collected into separate arrays, and the final assembly only used one of them. Fix: push all content blocks into a single array in their original order, preserving the interleaving the caller specified. When only text is present, collapse back to the simple string format for backward compatibility. Closes block#8067 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: Vincenzo Palazzo <[email protected]>
0f4ad9d to
5bcfe70
Compare
added 2 commits
March 24, 2026 18:40
DOsinga
approved these changes
Mar 24, 2026
Collaborator
DOsinga
left a comment
There was a problem hiding this comment.
The fix is correct — user message text was silently dropped when a message contained both text and image content. The unified content_array with has_non_text_content flag properly preserves ordering. Removed two restatement comments per project style guidelines; everything else looks good.
DOsinga
approved these changes
Mar 24, 2026
lifeizhou-ap
added a commit
that referenced
this pull request
Mar 25, 2026
* main: Fix user message text silently dropped when message contains both text and image (#8071) fix: use pnpm when publishing (#8092) Alexhancock/publish npm file format fix (#8091) fix: iteration on the publish-npm workflow (#8087) chore: ignore unmaintained warning for proc-macro-error (#8084) chore: clean up stray recipe.yaml (#8086) chore(release): bump version to 1.29.0 (minor) (#8088) Update lockfile references (#8085) Fix version bump (#8083) Add a code review step which uses a short-lived provider token (#7932)
michaelneale
added a commit
that referenced
this pull request
Mar 25, 2026
* origin/main: Fix user message text silently dropped when message contains both text and image (#8071) fix: use pnpm when publishing (#8092) Alexhancock/publish npm file format fix (#8091) fix: iteration on the publish-npm workflow (#8087) chore: ignore unmaintained warning for proc-macro-error (#8084) chore: clean up stray recipe.yaml (#8086) chore(release): bump version to 1.29.0 (minor) (#8088) Update lockfile references (#8085) Fix version bump (#8083) Add a code review step which uses a short-lived provider token (#7932)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MessageContent::TextandMessageContent::Imageblocks, the text was silently dropped in the OpenAI format conversiontext_arrayandcontent_arraywere populated independently, but the final assembly used anif-elsethat only picked one — whencontent_arraywas non-empty (image present),text_arraywas ignoredtext_arrayentries intocontent_arrayas{"type": "text", "text": "..."}objects before serializationtest_format_messages_with_text_and_imagecovering the mixed text+image caseCloses #8067
Test plan
test_format_messages_with_text_and_imagepassescargo clippyclean🤖 Generated with Claude Code