Skip to content

fix: accept all document attachments - #12468

Closed
zesty-clawd wants to merge 2 commits into
NousResearch:mainfrom
zesty-clawd:fix/all-file-attachments
Closed

fix: accept all document attachments#12468
zesty-clawd wants to merge 2 commits into
NousResearch:mainfrom
zesty-clawd:fix/all-file-attachments

Conversation

@zesty-clawd

Copy link
Copy Markdown

Bug Description

Discord/Telegram/Slack would skip non-whitelisted document extensions, so files like .json were treated as empty text-only messages.

Root Cause

Each platform adapter gated document handling on SUPPORTED_DOCUMENT_TYPES and rejected any extension not in the allowlist.

Fix

  • Treat any non-media upload as a document instead of skipping it
  • Fall back to the attachment MIME type or application/octet-stream for unknown files
  • Preserve text injection for common text-like formats, including JSON
  • Add regression tests for JSON and unknown-document handling

How to Verify

  1. Send a .json file in Discord and confirm it is cached as a document
  2. Send a document with no filename/mime in Telegram and confirm it is still cached
  3. Run the gateway document tests

Test Plan

  • Added regression test for this bug
  • Existing tests still pass
  • Manual verification of the fix

Risk Assessment

Low — the change only broadens document acceptance and keeps existing media handling unchanged.

Treat non-media Discord, Telegram, and Slack uploads as documents instead of skipping unsupported extensions.

- Cache unknown file types with a safe fallback MIME type
- Preserve plain-text injection for common text-like formats
- Add regression tests for JSON and unnamed uploads
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter platform/telegram Telegram bot adapter platform/slack Slack app adapter labels Apr 23, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This is implemented on current main through a broader gateway-wide solution. This is an automated hermes-sweeper review.

  • 4314d451ca961cb50c3430197a3a2c7a8575fd0e (fix(gateway): accept any inbound file type across all messaging platforms), shipped in v2026.7.1, changed the shared attachment path.
  • gateway/platforms/base.py:1678 now caches every authorized non-media upload as a document instead of rejecting it by extension; unknown files retain their supplied MIME or use application/octet-stream.
  • gateway/run.py:10536 surfaces every accepted document to the agent with a path context note.
  • tests/gateway/test_document_cache.py:221 covers unknown-file caching and the octet-stream fallback.
  • The related discussion in feat: expand supported document types for gateway file uploads #6787 already identifies this broader approach and was closed as implemented by the same commit.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter platform/slack Slack app adapter platform/telegram Telegram bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants