Skip to content

fix(auto-reply): allow message tool for media/file sends in group chats#31410

Closed
zerone0x wants to merge 1 commit into
openclaw:mainfrom
zerone0x:fix/group-chat-message-tool-media-31368
Closed

fix(auto-reply): allow message tool for media/file sends in group chats#31410
zerone0x wants to merge 1 commit into
openclaw:mainfrom
zerone0x:fix/group-chat-message-tool-media-31368

Conversation

@zerone0x

@zerone0x zerone0x commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: In all group-chat sessions (Telegram forum topics, regular groups, Discord channels, etc.), the persistent system-prompt context block contained: "Do not use the message tool to send to this same group — just reply normally." — intended to suppress duplicate text echoes, but the model read it as a blanket prohibition on the message tool, including for file and media attachments.
  • Why it matters: Users in Telegram forum topics (and other group chats) who ask the bot to send a file, image, or document receive a refusal like "message tool disabled in this chat" despite having tools.allow: ["*"] and actions.sendMessage: true. The exec-tool workaround is the only option today.
  • What changed: Updated the one instruction line in buildGroupChatContext() (src/auto-reply/reply/groups.ts) to clarify the distinction: plain-text replies go through the normal reply pipeline (no message tool), while file/media sends still need the message tool (action=send with media/filePath).
  • What did NOT change: The auto-threading helper resolveTelegramAutoThreadId() already injects the correct message_thread_id when the message tool targets the originating forum topic — no changes needed there.

Fixes #31368

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Gateway / orchestration
  • Integrations

Testing

  • All 879 tests in src/auto-reply/ continue to pass.
  • The change is a one-line prompt text update; no new test infrastructure is needed, but a unit test for buildGroupChatContext covering both the text-only and media cases can be added in follow-up.

🤖 Generated with Claude Code

In group-chat sessions (including Telegram forum topics), the persistent
system-prompt context block told the model:

  "Do not use the message tool to send to this same group — just reply
  normally."

The intent was to prevent duplicate text messages (the reply pipeline
delivers text automatically). However, the model interpreted this as a
blanket prohibition, including for file attachments and media. When asked
to send a file in a forum topic the agent responded with something like
"message tool disabled in this chat".

Fix: update the instruction to distinguish plain-text replies (still
routed automatically, no message tool needed) from media/file sends
(which require the message tool with action=send + media/filePath).

The updated wording mirrors the existing system-prompt guidance that
already explains the NO_REPLY pattern for when the message tool delivers
the reply.

Fixes #31368

Co-Authored-By: Claude <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a usability issue where users in group chats (Telegram forum topics, Discord channels, etc.) couldn't send files or media because the system prompt blocked all use of the message tool. The fix updates one line in buildGroupChatContext() to clarify that:

  • Plain text responses should go through the normal reply pipeline (no message tool)
  • File/media sends should use the message tool with action=send and media/filePath parameters

The change preserves the original intent of preventing duplicate text echoes while unblocking legitimate file/media sends. The updated instruction references correct tool parameters verified in src/agents/tools/message-tool.ts.

Key points:

  • One-line prompt clarification in src/auto-reply/reply/groups.ts:102
  • No API changes, no breaking changes
  • Enables previously blocked functionality (file/media sends in groups)
  • All 879 auto-reply tests continue to pass

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects a well-scoped prompt text clarification that addresses a real bug without introducing new risks. The change is technically accurate (verified tool parameters), preserves existing behavior for text responses, and enables previously blocked functionality. All existing tests pass, confirming no regressions.
  • No files require special attention

Last reviewed commit: 162bc37

@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r: too-many-prs Auto-close: author has more than twenty active PRs. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Message tool (file attachments) auto-disabled in Telegram forum topics

2 participants