Skip to content

test(gateway): add regression tests for Discord message.txt auto-attachment (#12511)#12519

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/discord-message-txt-attachment-handling
Closed

test(gateway): add regression tests for Discord message.txt auto-attachment (#12511)#12519
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/discord-message-txt-attachment-handling

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

Ensure Discord auto-generated message.txt attachments (from large pastes) are read and injected into the agent's context.

What changed and why

  • Added TestDiscordMessageTxtAutoAttachment class to tests/gateway/test_discord_document_handling.py with 5 targeted scenarios for the exact user flow described in [Bug]: Discord auto-generated message.txt attachments from pasted code/long lines are silently ignored #12511
  • Covered: free-response channel paste, server channel with @mention (content empty after strip), caption + attachment ordering, no-mention drop (expected gating), and content_type=None filename-extension fallback
  • All tests pass against the existing implementation, confirming the gateway already handles each path and establishing a regression baseline

How to test

  • pytest tests/gateway/test_discord_document_handling.py -v — all 16 tests pass
  • To reproduce the user scenario manually: in a DM or free-response channel, paste >2000 chars of code so Discord creates a message.txt; Hermes receives [Content of message.txt]:... prepended to the event text
  • In a server channel with default settings, users must @mention the bot even when pasting code — this is intentional gating behaviour, not a bug

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #12511


autocontrib · issue-new-76f9beaf · 2026-04-19T10:46:48Z

…chment

Covers the scenario from issue NousResearch#12511: when Discord converts a large paste
into a message.txt attachment, the gateway must inject the content into
event.text so the agent can read the pasted material.

Five new tests in TestDiscordMessageTxtAutoAttachment verify:
- Free-response channel: bare message.txt paste is injected (no mention needed)
- Server channel: @mention + message.txt, content injected after mention strip
- Server channel: @mention + caption + message.txt, injection prepended before caption
- Server channel: message.txt without @mention is dropped (expected gating)
- content_type=None: filename extension fallback still identifies and injects .txt

All scenarios pass with the existing gateway implementation, confirming the
feature works and establishing a regression baseline.
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.

[Bug]: Discord auto-generated message.txt attachments from pasted code/long lines are silently ignored

1 participant