Decode HEIC chat attachments to JPEG via the OS decoder - #7
Open
TeleporterGuy wants to merge 2 commits into
Open
Decode HEIC chat attachments to JPEG via the OS decoder#7TeleporterGuy wants to merge 2 commits into
TeleporterGuy wants to merge 2 commits into
Conversation
iPhone photos were skipped as unsupported binaries; converting with sips (or a user-supplied PATH tool) lets the model and Chromium see them without shipping HEVC.
TeleporterGuy
marked this pull request as ready for review
August 25, 2026 13:42
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
sipson macOS, optionalheif-convert/magickon PATH) so Stem never ships HEVC.image/heic.Scope (what this does and does not do)
This is chat attachments only: paperclip, drop onto the conversation, clipboard paste. Those files are decoded to JPEG and sent to the model as native images.
Connected / shared folders are unchanged. The folder index still catalogs Markdown,
.txt, PDF text layers, and Word. HEIC (like PNG/JPEG) is skipped as an unsupported binary — Stem will not search, memorize, or automatically vision-read photos sitting in a connected folder. Dropping a.heicfrom that folder onto the chat still works, because that is the attachment path. The agent can still open other files in the folder as ordinary files while working, same as today.Licensing
Stem does not distribute HEVC. Decode is delegated to the OS (
sips/ ImageIO on macOS) or a user-installed tool on PATH (heif-convert,magick). The official Docker image does not install libheif. Linux/Windows without such a tool skip the file with a named note.Why the tests look like this
HEIC decode is a patented codec we refuse to ship. The unit suite therefore cannot assume a real decoder exists on Linux/Windows CI, and must not depend on checking in a copyrighted iPhone
.heicfixture.setHeicDecoderForTests) for ingest, skip notes, client-already-converted JPEG, and Chromium preview. That covers the Stem contract: HEIC becomesimage/jpegfor pi, garbage is named inrejected, converted attachments are not decoded twice.ftypheicstub is enough to assert brand detection. A real photo is unnecessary for classification tests.sipssmoke builds a 1×1 HEIC from a PNG and decodes it back. That is the path Stem actually ships; a mock cannot catch a wrongsipsflag. It is skipped on Linux/Windows, and if encode is blocked (sandbox) the test returns rather than failing CI.previewImageDatareturns a JPEG data URL — Chromium cannot paintimage/heic, so an optimistic HEIC thumbnail would be a broken<img>.Swallowing decode/preview failures is intentional (preview is not the send; a missing PATH tool is the Linux default). Those catches carry
// quiet:soquiet-failures.test.tsagrees.CI note
Unit tests, typecheck, and lint are green. The remaining red jobs (
teston macOS and Ubuntu) fail one Playwright E2E:tests/e2e/external-server.spec.ts— a turn killed along with the server stops pretending to runAfter SIGKILL + restart it expects
Echo: after the second crashand never finds an assistant bubble. That spec exercises reconnect/resync after a killedstem-server. It does not attach images or call the HEIC decoder. 100+ other E2E tests in the same run passed;unit-windowspassed. Treat this as an unrelated flake of the replay/resync path unless a re-run reproduces it.Test plan
.heicfrom Downloads or paperclip on macOS — bubble shows thumbnail and model sees the photo.heif-convert: skip note names the file and mentions decode failure..heicin a connected folder is still not indexed; dropping it onto the chat still works.