Skip to content

fix(discord): accept metadata in media send methods#1109

Closed
insecurejezza wants to merge 1 commit intoNousResearch:mainfrom
insecurejezza:fix/discord-media-metadata
Closed

fix(discord): accept metadata in media send methods#1109
insecurejezza wants to merge 1 commit intoNousResearch:mainfrom
insecurejezza:fix/discord-media-metadata

Conversation

@insecurejezza
Copy link
Contributor

Bug Description

Discord media delivery could fail even when tool output succeeded.

When Hermes returned a MEDIA: attachment from tools like text_to_speech, the base gateway send pipeline passed platform metadata into Discord media delivery calls. On main, Discord's send_voice, send_image_file, and send_image methods did not accept a metadata kwarg.

Root Cause

BasePlatformAdapter passes metadata through media send calls, but the Discord adapter's native media methods had stale signatures that omitted metadata.

That created a method-signature mismatch in the Discord attachment-delivery path.

Fix

  • add metadata: Optional[Dict[str, Any]] = None to:
    • DiscordAdapter.send_voice
    • DiscordAdapter.send_image_file
    • DiscordAdapter.send_image
  • add a regression test covering those method signatures

How to Verify

  1. Trigger a response that returns a MEDIA: audio or image attachment in Discord
  2. Confirm the attachment appears in the channel/thread
  3. Run:
    python -m pytest tests/gateway/test_discord_media_metadata.py tests/gateway/test_platform_base.py -q

Test Plan

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

Risk Assessment

Low — this only aligns Discord method signatures with the existing base adapter call path. No behavior change beyond accepting the already-passed kwarg.
EOF; __hermes_rc=$?; printf 'HERMES_FENCE_a9f7b3'; exit $__hermes_rc

@insecurejezza insecurejezza force-pushed the fix/discord-media-metadata branch from 586cd24 to 6978d56 Compare March 13, 2026 04:24
teknium1 pushed a commit that referenced this pull request Mar 13, 2026
…adata fix

- Add /thread slash command that creates a Discord thread and starts a
  new Hermes session in it. The starter message (if provided) becomes
  the first user input in the new session.
- Add discord.auto_thread config option (DISCORD_AUTO_THREAD env var):
  when enabled, every message in a text channel automatically creates
  a thread, allowing parallel isolated sessions.
- Fix Discord media method signatures to accept metadata kwarg
  (send_voice, send_image_file, send_image) — prevents TypeError
  when the base adapter passes platform metadata.
- Fix test mock isolation: add app_commands and ForumChannel to
  discord mocks so tests pass in full-suite runs.

Based on PRs #866 and #1109 by insecurejezza, modified per review:
removed /channel command (unsafe), added auto_thread feature,
made /thread dispatch new sessions.

Co-authored-by: insecurejezza <insecurejezza@users.noreply.github.com>
@teknium1
Copy link
Contributor

Merged via PR #1178. Media metadata fix included with authorship preserved. Thank you @insecurejezza!

@teknium1 teknium1 closed this Mar 13, 2026
teknium1 added a commit that referenced this pull request Mar 13, 2026
…adata fix (#1178)

- Add /thread slash command that creates a Discord thread and starts a
  new Hermes session in it. The starter message (if provided) becomes
  the first user input in the new session.
- Add discord.auto_thread config option (DISCORD_AUTO_THREAD env var):
  when enabled, every message in a text channel automatically creates
  a thread, allowing parallel isolated sessions.
- Fix Discord media method signatures to accept metadata kwarg
  (send_voice, send_image_file, send_image) — prevents TypeError
  when the base adapter passes platform metadata.
- Fix test mock isolation: add app_commands and ForumChannel to
  discord mocks so tests pass in full-suite runs.

Based on PRs #866 and #1109 by insecurejezza, modified per review:
removed /channel command (unsafe), added auto_thread feature,
made /thread dispatch new sessions.

Co-authored-by: insecurejezza <insecurejezza@users.noreply.github.com>
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.

2 participants