Skip to content

An attachment larger than the model's context breaks every later run in the chat #480

Closed

Description

@iamnbutler

Found while adding PDF attachments (#479). Attachments are capped at 1.5 MB per message (the hosted-channel row cap), which counts bytes, not tokens. A large text file or PDF can fit under that cap and still exceed the model's context: Keynote's multilingual license PDF extracted to about 1 MB of text, about 466K tokens, over Haiku's 200K window.

Actual: that run fails, and every later run in the chat fails the same way until the message is deleted (#467 deletion replaces it in context).
Expected: the oversized attachment is refused or trimmed when sent, or the run explains what happened and the chat stays usable.

Possible directions: check the attachment's estimated tokens against the chosen model's context window where the channel knows it (pi-ai model metadata), or have the context edit drop or summarize an attachment that overflows.

Present since #469 (text attachments). Part of #26 and #5.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions