anomalyco / anomalyco/opencode
Web: image attachments fail on insecure origins; no client-side optimization
Open
@Hona is already working on this.
Since Aug 31, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Attaching an image in the web app is unreliable, especially over remote/slow or insecure connections:
- Large photos upload as full-size payloads, and HEIC/HEIF are not accepted by the picker or readable by the vision model.
- On an insecure (http) origin,
crypto.subtleis undefined, so blob ID generation throws and the attachment silently never gets added to the prompt.
Expected
Attach a JPG/PNG/HEIC and have it appear in the prompt reliably, with a reasonably-sized payload.
Actual
- Blob reference creation fails on insecure origins (
TypeError: ... digest). - Large images are sent un-optimized; HEIC/HEIF are unsupported.
Suggested fix
- Downscale/re-encode images client-side (HEIC/WebP/JPEG → JPEG, PNG kept, capped at 1920px / quality 0.82) with a short timeout fallback to the original.
- Fall back to
crypto.getRandomValueswhencrypto.subtleis unavailable.
Related (not duplicates)
- #46168 (crypto.randomUUID in insecure context) - same root cause class (crypto unavailable on insecure origins), but affects other call sites (session delete, drag-drop). The
uuid()helper already has a random fallback; the directcrypto.randomUUID()calls are separate. My change targetscrypto.subtleindraft-store.tsspecifically, which is still unfixed ondev. - #45986 (images persisted but stripped from model request on v2 beta) - different layer (server-side
stripMedia/ message-v2 path), not the client attachment failure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.