← Back to PRs

#22389: Fix: Matrix plugin not sending images from content blocks

by fryccerGit open 2026-02-21 03:35 View on GitHub →
channel: matrix size: S
## Problem When tools return image data in the `content` array, the Matrix plugin ignores these images and only sends text. ## Solution This fix extracts image blocks from `reply.content`, saves base64 data to temp files, and adds them to the media list for sending. ## Changes - Extract content blocks and separate images from text - Write base64 images to temp files with index counter to avoid collisions - Include extracted images in the media list - Clean up temp files after sending <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR successfully implements support for sending images from content blocks in Matrix plugin replies. The implementation extracts image blocks from `reply.content`, converts base64 data to temporary files, and includes them in the media list for delivery. **Key changes:** - Adds content block extraction logic to parse image and text blocks from `reply.content` - Creates temporary directory for storing base64-decoded images - Properly cleans up temp files in finally block - Maintains backward compatibility with existing `reply.text` field **Issues found:** - File naming uses `Date.now()` which could cause collisions if multiple images are processed within the same millisecond - Type casting bypasses TypeScript type safety (though this is a pragmatic workaround) <h3>Confidence Score: 4/5</h3> - This PR is generally safe to merge with one minor race condition that should be addressed - The implementation correctly handles the core functionality of extracting and sending images from content blocks. Resource cleanup is properly implemented with try-finally. However, there's a potential file name collision issue using Date.now() for temp file naming that could cause failures under rapid successive image processing. The type casting is pragmatic but not ideal. - Pay attention to `extensions/matrix/src/matrix/monitor/replies.ts:77` for the file naming race condition <sub>Last reviewed commit: 73ca371</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs