Skip to content

[Bug] message tool sends files to DM instead of staying in Telegram topic #52286

@GreenTeodoro839

Description

@GreenTeodoro839

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When the AI needs to send a file in a Telegram forum topic, it uses the message tool with target={user_id}, which causes the file to be sent to the user's DM instead of staying in the topic. Text replies don't have this problem because they go through OpenClaw's built-in reply router which automatically preserves the topic context.

Steps to reproduce

  1. Configure a Telegram bot with topics enabled in a supergroup forum.
  2. Start a conversation in a specific topic (not General).
  3. Ask the AI to perform a task that produces a file and send it back to the user (e.g., "do X and send me the result file").
  4. The AI executes the task, then uses the message tool with target=user_id to send the file.
  5. The file arrives in the user's DM instead of in the originating topic.

Expected behavior

The file should be sent to the same Telegram topic where the conversation is taking place, using the topic's chat_id + thread_id. This is consistent with how text replies work — they automatically stay in the current topic.

Actual behavior

The file is sent to the user's DM instead of the topic. The AI chooses the user ID as the message tool target, bypassing the topic context entirely. Text replies (which use the built-in reply router) do not have this issue and correctly stay in the topic.

OpenClaw version

2026.3.13

Operating system

Linux (Debian)

Install method

No response

Model

minimax-portal/MiniMax-M2.7

Provider / routing chain

direct to minimax portal

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Users in Telegram forum topics who ask the AI to send files.
Severity: Medium (files leak to DM, breaks workflow)
Frequency: Always when AI uses message tool to send files in topic context
Consequence: Files are sent to user's DM instead of topic, bypassing the group conversation

Additional information

Root cause: Text replies use the built-in reply mechanism which automatically includes chat_id+thread_id from the current session context. File/media sends require explicit use of the message tool, and the AI chooses user ID as target instead of preserving the topic's chat_id+thread_id.

Proposed solution: Extend OpenClaw's reply mechanism to support file/media attachments transparently, so the AI can reply with a file the same way it replies with text — without explicitly calling the message tool.

Related: #2777 (fixed in main), #31368 (still open), #31410 (fix PR not merged, r: too-many-prs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions