Skip to content

[Bug] iOS: large chat image attachments fail or blow up memory (48MP frames, no client-side resize) #68524

Description

@maxperf

Problem

Attaching multiple photos from the iOS app's chat composer — particularly modern iPhone 48MP photos — causes one or more of:

  • Attachments silently fail to deliver
  • Memory pressure during base64 encoding on the MainActor
  • Per-attachment payload exceeds gateway/model limits (typical ceiling ~5 MB)
  • Stack overflows during image decode when multiple full-resolution assets are loaded at once

Tested on iPhone 16 Pro Max (iOS 26.3.1) against gateway 2026.4.15 over WAN WebSocket. Multi-image send in a single message reliably degrades the experience.

Expected

iOS client resizes/compresses attachments before transport:

  • Progressive resize to a budget (e.g. 3.5 MB per image) targeting Anthropic's 5 MB limit with headroom
  • Decode + resize off MainActor
  • Aspect-ratio preserving
  • Pixel-count cap to avoid 48MP decode bombs
  • Per-message total budget across N attachments

Context

This was partially prototyped locally in the branch anker3/image-resize-chat-attachments (not yet upstreamed):

  • 9 commits
  • 22 tests
  • 4 adversarial review rounds (8/8 pass)
  • Fixes: 48MP decode stack overflow, base64 off MainActor, progressive resize to 3.5 MB budget

Related but distinct:

This issue is specifically about the iOS client composer resizing before transport, not server-side resize.

Repro

  1. Open iOS app, Control UI or node mode
  2. Attach 3–6 recent Camera Roll photos (HEIC/JPEG, default iPhone capture)
  3. Send
  4. Observe partial failure, memory spike, or payload rejection

Proposed fix

Upstream the prototype from anker3/image-resize-chat-attachments. If desired I can prep a PR with the 9-commit stack rebased onto current main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions