Skip to content

feat(max): make inbound attachment download cap configurable - #1837

Open
therebro13 wants to merge 1 commit into
chenhg5:mainfrom
therebro13:feat/configurable-max-attachment-size
Open

therebro13 wants to merge 1 commit into
chenhg5:mainfrom
therebro13:feat/configurable-max-attachment-size

Conversation

@therebro13

Copy link
Copy Markdown

Problem

The MAX platform hard-coded its inbound attachment download limit at 25 MiB (maxAttachmentBytes in platform/max/max.go), below the project-wide core.DefaultMaxAttachmentSize (50 MiB) used elsewhere (e.g. the send side / max_attachment_size_mb). Any file, image, or voice message larger than 25 MiB that a user sends to a MAX bot is rejected during download with attachment exceeds N bytes and never reaches the agent — with no way to raise the limit via config.

Observed in production: a ~30 MiB .docx sent to the bot failed with
max: file download failed error="attachment exceeds 26214400 bytes".

Change

  • Default the inbound cap to the shared core.DefaultMaxAttachmentSize (50 MiB) instead of the hard-coded 25 MiB, so MAX is consistent with the rest of cc-connect.
  • Add a per-platform override max_attachment_size_mb (MiB), matching the naming of the existing global send-side option. 0/unset keeps the default.
  • Document the option in config.example.toml (EN + 中文) and add TestNewMaxAttachmentSize.

No behaviour change for existing configs below 25 MiB; the default simply rises from 25 → 50 MiB and becomes tunable.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GehKUtQ1YRKccv5PbHhHix

The MAX platform hard-coded its inbound attachment download limit at
25 MiB, below the project-wide core.DefaultMaxAttachmentSize (50 MiB)
used everywhere else. Files/images/voice larger than 25 MiB were
rejected with "attachment exceeds N bytes" and never reached the agent.

Default the cap to core.DefaultMaxAttachmentSize for consistency and
allow a per-platform override via the max_attachment_size_mb option
(MiB), matching the naming of the existing global send-side setting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GehKUtQ1YRKccv5PbHhHix
@therebro13
therebro13 requested a review from chenhg5 as a code owner September 12, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant