Skip to content

fix(tools): chunk long messages in send_message_tool before platform dispatch#1646

Merged
teknium1 merged 3 commits intomainfrom
hermes/hermes-923bc090
Mar 17, 2026
Merged

fix(tools): chunk long messages in send_message_tool before platform dispatch#1646
teknium1 merged 3 commits intomainfrom
hermes/hermes-923bc090

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Cherry-picked from PR #1557 by @llbn onto current main.

The standalone platform senders in send_message_tool.py (used by send_message tool and cron auto-delivery) didn't apply message chunking before sending. Long messages exceeded platform limits and were silently rejected.

Changes:

  • Convert BasePlatformAdapter.truncate_message() to @staticmethod (uses no instance state)
  • Apply smart chunking centrally in _send_to_platform() using per-platform MAX_MESSAGE_LENGTH constants
  • Telegram: media files attach to last chunk only
  • Remove naive message[i:i+2000] character split in _send_discord() in favor of centralized chunking
  • Add regression tests for chunking and media placement

Fixes #1552

youssefea and others added 3 commits March 17, 2026 01:49
…dispatch

  - Convert BasePlatformAdapter.truncate_message() to @staticmethod
  - Apply truncate_message() in _send_to_platform() with per-platform
    max lengths
  - Remove naive character split in _send_discord()
  - Attach media files to last chunk only for Telegram
  - Add regression tests for chunking and media placement
@teknium1 teknium1 merged commit 1f6a1f0 into main Mar 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants