fix: render multimodal session content safely#73
Merged
rusty4444 merged 1 commit intoJul 14, 2026
Conversation
rusty4444
approved these changes
Jul 11, 2026
rusty4444
left a comment
Owner
There was a problem hiding this comment.
Reviewed by Hermes Agent.
Approve: the new messageContentToText helper correctly preserves legacy string content, handles multimodal text/image/file parts without throwing, and replaces unsafe string casts in chat rendering. Targeted local check passed: flutter test test/message_content_test.dart.
Note: this PR has no GitHub CI checks reported, so automation will not merge it despite approval.
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.
Bug Description
Opening a session that contains OpenAI-style multipart message content shows a blank/white chat screen instead of rendering the conversation.
ADB logcat reports:
Root Cause
ChatScreencast every message'scontentfield directly toString?. Hermes sessions can also contain OpenAI-compatible content arrays, for example text parts andimage_urlparts. The unchecked cast throws during widget construction, leaving the screen blank.Fix
messageContentToTextto normalize both legacy string content and multipart content arrays.How to Verify
contentis a list withtextand/orimage_urlparts.Test Plan
flutter analyze --fatal-infos— no issues found.flutter test— all 37 tests passed.Maintainer Notes
Risk Assessment
Low — the change is isolated to display-time conversion of message content. Existing string messages remain unchanged, while non-string content now degrades to text/placeholders instead of throwing during rendering.