← Back to PRs

#17676: fix: support HEIC/HEIF/AVIF image attachments

by meepbot-oss open 2026-02-16 02:37 View on GitHub →
stale size: S
## Problem HEIC images sent via iMessage (and other channels) are not delivered to the agent context. The attachment metadata is captured correctly, but: 1. `resolveAttachmentKind()` doesn't recognize `.heic`/`.heif`/`.avif` extensions, so these attachments are classified as `unknown` instead of `image` 2. Even when MIME type detection works, HEIC files aren't converted to a format supported by vision models ## Changes **`src/media-understanding/attachments.ts`:** - Add `.heic`, `.heif`, `.avif` to the image extension list in `resolveAttachmentKind()` - Add HEIC→JPEG conversion using macOS `sips` in the local file path of `MediaAttachmentCache.getBuffer()` - Conversion is best-effort — falls through to the original buffer if `sips` is unavailable or fails ## Notes - `sips` is available on all macOS installations (ships with the OS) - Conversion uses a temp directory that is cleaned up in a `finally` block - Non-macOS hosts will skip conversion gracefully (sips not found → catch → original buffer) Fixes #17670 <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds support for HEIC/HEIF/AVIF image extensions and implements macOS `sips`-based conversion to JPEG for HEIC/HEIF files. The PR correctly identifies these formats as images and converts local HEIC/HEIF files to JPEG before sending to vision models. **Critical issue found:** - Remote HEIC/HEIF/AVIF attachments fetched via URL bypass the conversion logic entirely and will be sent to vision models in their original format, likely causing failures **Issues noted in previous review threads (not re-commented):** - AVIF files are recognized as images but not included in the conversion logic - No verification that macOS `sips` supports AVIF format <h3>Confidence Score: 2/5</h3> - This PR has a critical logic gap that will cause remote HEIC/HEIF/AVIF attachments to fail - Score reflects a significant functional gap: the conversion logic only applies to local file paths, not remote URLs. Remote HEIC/HEIF/AVIF attachments (a common scenario for iMessage and other messaging channels) will bypass conversion and fail at the vision model. Additionally, AVIF support is incomplete as noted in previous threads. - Pay close attention to `src/media-understanding/attachments.ts` - the remote URL code path needs the same conversion logic as the local file path <sub>Last reviewed commit: 2eed6f3</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs