Skip to content

bug(platform): a PNG still over 2 MiB after the composer's compression never reaches the model, and the sender is not told #5396

Closed

Description

@yannickmonney

Summary

A PNG that is still over 2 MiB after the chat composer has compressed it never reaches the model, and nothing tells the sender. The model is given the text [attachment: <name>] instead of the picture and answers that it cannot read the image. The message sends normally, the attachment chip looks like any other, and the only trace is a server log line.

Found on 2026-11-06 while re-testing a customer acceptance list against the preview (v0.5.101), whose PNG finding reads "an error is thrown when PNG is processed". It is not known whether that customer's file hits this; the PNG itself was not available.

Reproduction (preview, v0.5.101, Auto model, one image per new chat)

Prompt: "Which code is in the image? Answer with the code only." Every image shows the same black text CODE ZEBRA-4711 on a clean white box.

Image Size on disk Result
2400 × 1600, plain grey background 36 KB ZEBRA-4711
3000 × 3000, text box clean, a noisy strip below 3.7 MB ZEBRA-4711
1700 × 1100, noisy background 3.3 MB "Ich kann das Bild hier nicht auslesen."
2400 × 1600, noisy background 7.8 MB "Ich kann den Bildinhalt hier nicht erkennen."
3000 × 3000, text box clean, a larger noisy strip 9.3 MB "Ich kann das Bild hier nicht auslesen."

The text is equally legible in all five, so the picture's content is not the cause. Noise stands in for what a scan, a photo or a detailed screenshot does to a PNG: it does not shrink.

What the repository says today

Observed at ee243d4f5 (v0.5.100 plus 18 commits); the preview behaves the same.

  • Composer: compressImage (services/platform/lib/utils/compress-image.ts) aims at 1 MB (MAX_IMAGE_SIZE, line 7) but only caps the longer side at 2048 px (line 9) and re-encodes once. A PNG stays a PNG, "to keep transparency" (lines 117-119), and a canvas PNG has no quality setting. It never checks the result against the 1 MB aim, so a detailed PNG leaves the composer at several MB.
  • Server: loadWireImage (services/platform/backend/core/chat/turn_action.ts:491-518) refuses any image over INLINE_IMAGE_MAX_BYTES, 2 MiB (line 474). It logs console.warn and returns null. settleWireAttachments (line 530) then appends [attachment: <name>] to the message in its place.
  • Nothing reaches the sender. No toast on attach, no note on the chip, no hint in the reply. The model has only the placeholder, so it says it cannot read the image; it cannot say why.
  • JPEG is not affected in practice: it is re-encoded at quality 0.85 and rarely stays over 2 MiB at 2048 px.

Not examined: whether other paths send images over the bound (REST turns, tasks, the harness bridge).

Options (no preference)

  1. Make the composer keep its promise: if the result is still over the bound, re-encode as JPEG when the image has no transparency, or step the dimensions down until it fits.
  2. Do the same on the server in loadWireImage, so an image from any path fits instead of falling back to its text surface.
  3. Keep the fallback, but say so: refuse or warn at attach time ("this image is too large for the model to see"), and tell the model that the picture was left out, not only that a file exists.

Options 1 and 3 can go together.

Questions

  • Is 2 MiB the right bound for the providers Tale supports, or only a safe one? Some providers accept 5 MB or more per image.

Related

Activity

  1. added
    priority: medium
    bug
    service: platform
    on Nov 6, 2026
  2. added
    agent-ready
    on Nov 6, 2026
  3. added a commit that references this issue on Nov 6, 2026
    882564b
  4. yannickmonney commented on Nov 6, 2026

    @yannickmonney
    ContributorAuthor

    Fixed by 882564b0b (fix(platform): fit a large picture under what a model is shown) on the merge train #5408, for v0.5.102. It combines options 1 and 3.

    • The composer fits images under the model's limit. It steps its redraw down until the picture fits the 2 MiB a model is shown. That limit is now one constant, CHAT_IMAGE_MODEL_MAX_SIZE, which the server reads too. A picture without transparency becomes a JPEG; one with transparency stays a PNG at smaller sizes first.
    • What is left as it was:
      • An original already within the limit is never stepped down.
      • A task's files and a sandbox thread's are only redrawn, as before.
    • Images it cannot fit: an image the composer cannot fit, such as an animated GIF, is named under the staged attachments before the send. The model reads its name and the reason, for example [attachment: x.gif — not sent to you: the image is 2.40 MB, over the 2 MB limit for one image].
    • A second bug found while testing: a converted image kept the type it was picked with, so JPEG bytes went out labelled image/png or image/webp. The upload now carries the bytes' type, and the model wire labels each image by its bytes.

    On the open question: the bound stays at 2 MiB.

    Not examined, the issue's other question: REST sends carry no images, and task agents read attachments as files. The composer is therefore the one path that puts images into a model request.

    Checked in a real browser with a stand-in vision model that reports what it receives:

    Attached What the model received
    Noisy PNG, 3.4 MB JPEG, 0.83 MB
    3000×3000 PNG, 6.6 MB JPEG, 0.68 MB, 2048 px, text legible
    Transparent PNG, 5.9 MB PNG, 1.86 MB, alpha kept
    GIF, 2.4 MB Flagged before the send; the model received its name and the reason
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions