Repository navigation
Convert HEIC/HEIF photo attachments to JPEG so Claude and Codex accept them - #1677
Conversation
Solenta-Message-Id: d3b1c9b5-333c-4659-99b9-5dcbec4b5a1c
Resolve useCoderWorkspace fromPaths: keep threadId, take main's saveImageOrNull. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a250826f5a
ℹ️ 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".
| return Promise.all( | ||
| list.map(async (a) => { |
There was a problem hiding this comment.
Limit concurrent HEIC decoder processes
When a user multi-selects or drops a large batch of HEIC photos, this Promise.all invokes heicToJpeg for every item simultaneously. Each conversion can launch up to three external processes with 30-second timeouts, so an ordinary photo album can create a child-process storm that exhausts CPU, memory, or process limits and stalls the attachment request; process these conversions sequentially or with bounded concurrency.
Useful? React with 👍 / 👎.
| async function heicToJpeg(src, dir) { | ||
| const out = path.join(dir, `${Date.now()}-${randomUUID().slice(0, 8)}.jpg`); |
There was a problem hiding this comment.
Preserve source identity when generating the JPEG path
When the same HEIC is selected more than once, this generates a new random JPEG path on every conversion. The composer deduplicates attachments only by path (useComposerAttachments.ts:41-42), so unlike other attachments, reselecting one HEIC creates duplicate chips and sends the image multiple times; reuse a prior conversion or retain a stable source identity for deduplication.
Useful? React with 👍 / 👎.
iPhone photos (HEIC, the camera default) couldn't be attached as images. The picker filter skipped them, and anything that did get through went to the agent as a path that no provider can read as an image. Now every HEIC/HEIF attachment is converted to a JPEG before the agent sees it. The original file is not modified. Fixes #463.
Changes
sipsfirst (built into macOS), thenheif-convert, then ImageMagick. The JPEG goes into the thread's attachments folder, which the existing pruning already cleans up..heic/.heifnow show up in the picker's Images filter.Verification
electron/test/attachments.test.js20/20. This includes a real macOS round trip: a HEIC made withsipscomes back as a JPEG, and the thumbnail path serves it asimage/jpeg. The converter fallback order and the plain-file fallback are tested with a fakeexecFile.tsc --noEmitis clean andvite buildsucceeds.test:electronbefore the merge with main: 4734 pass / 14 fail, none in attachment code. Four of the failing files (mcp-inject, provider-usage, worktrees, memory-sup) had 9 failures in one combined run, then passed 146/0 on a rerun of the same tree and also 146/0 on pre-change code. The other failures in that run were not rerun.heif-convert/magickruns (only the fake), and clicking through the running app.Notes for reviewers
classifyPathsnow labels.heicaskind: "image". That is only true aftertranscodeHeicruns. Both of its callers (attachments:pick,attachments:fromPaths) go through it. A new caller that skips it would send a HEIC image path.pick/fromPathsnow take an optionalthreadIdso the JPEG has a thread folder to live in. Without one, HEIC stays a plain file.claude-opus-5-5 via Claude Code
🤖 Generated with Claude Code