Skip to content

Support large file metadata via Discord attachments#26

Merged
VulcanoSoftware merged 2 commits into
mainfrom
fix-large-file-metadata-overflow-5237680782998250731
Jul 5, 2026
Merged

Support large file metadata via Discord attachments#26
VulcanoSoftware merged 2 commits into
mainfrom
fix-large-file-metadata-overflow-5237680782998250731

Conversation

@VulcanoSoftware

Copy link
Copy Markdown
Owner

Implemented a metadata overflow mechanism to handle Discord's 4000-character message limit. This allows DCFS to support files with a very large number of parts (such as 10GB+ files) by automatically switching to file attachments for descriptor storage when the serialized JSON exceeds the text limit.

Key changes:

  • Added get_text() to MessageApi for transparent large payload retrieval.
  • Updated MessageApi.send_text and edit_message_text to handle overflows via attachments.
  • Enhanced DiscordBotAPI to support simultaneous text and media updates.
  • Updated DCMsgFDRepository to utilize the new overflow-aware retrieval.
  • Added comprehensive unit tests in tests/dcfs/core/api/message/test_overflow.py.

PR created automatically by Jules for task 5237680782998250731 started by @VulcanoSoftware

Discord messages have a 4000-character limit. For very large files (e.g., 10GB+),
the JSON-serialized file descriptor containing hundreds of part message IDs
can exceed this limit, causing uploads to fail with a 400 Bad Request error.

This patch introduces a transparent overflow mechanism in MessageApi:
- Payloads exceeding 4000 characters are automatically uploaded as an
  'overflow.json' attachment.
- The message content is set to a 'DCFS_OVERFLOW' sentinel.
- MessageApi.get_text() transparently retrieves the full payload by
  downloading the attachment when the sentinel is detected.

DCMsgFDRepository has been updated to use this mechanism, enabling support
for arbitrarily large file metadata.

Co-authored-by: VulcanoSoftware <113239901+VulcanoSoftware@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Discord messages have a 4000-character limit. For very large files (e.g., 10GB+),
the JSON-serialized file descriptor containing hundreds of part message IDs
can exceed this limit, causing uploads to fail with a 400 Bad Request error.

This patch introduces a transparent overflow mechanism in MessageApi:
- Payloads exceeding 4000 characters are automatically uploaded as an
  'overflow.json' attachment.
- The message content is set to a 'DCFS_OVERFLOW' sentinel.
- MessageApi.get_text() transparently retrieves the full payload by
  downloading the attachment when the sentinel is detected.

DCMsgFDRepository has been updated to use this mechanism, enabling support
for arbitrarily large file metadata.

Includes a fix for a Mypy issue in the unit tests identified in the first CI run.

Co-authored-by: VulcanoSoftware <113239901+VulcanoSoftware@users.noreply.github.com>
@VulcanoSoftware VulcanoSoftware marked this pull request as ready for review July 5, 2026 13:41
@VulcanoSoftware VulcanoSoftware merged commit da3044f into main Jul 5, 2026
1 check passed
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