-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
Summary
Bug
When an agent sends a message using the message tool with the target parameter (as defined in the tool schema), the send is not tracked by the
reply suppression system. This causes the agent's text output to be delivered as a separate message even though the agent already sent content
via the message tool to the same recipient.
Root Cause
The message tool schema in src/agents/tools/message-tool.ts defines the routing parameter as target:
// message-tool.ts line 41
target: Type.Optional(channelTargetSchema({ description: "Target channel/user id or name." })),
However, extractMessagingToolSend in src/agents/pi-embedded-subscribe.tools.ts only checks args.to:
// pi-embedded-subscribe.tools.ts line 179
const toRaw = typeof args.to === "string" ? args.to : undefined;
if (!toRaw) {
return undefined; // <-- exits here when agent uses target instead of to
}
Since the send is never tracked in messagingToolSentTargets, shouldSuppressMessagingToolReplies in src/auto-reply/reply/reply-payloads.ts never
fires, and any text the agent outputs after its tool calls gets delivered as a visible message.
Suggested Fix
In extractMessagingToolSend, check both args.to and args.target (and args.channelId for completeness, since message-tool.ts also accepts that):
const toRaw = typeof args.to === "string" ? args.to
: typeof args.target === "string" ? args.target
: undefined;
Workaround
Instruct the agent to use to instead of target in its message tool calls. Both work for sending, but only to is recognized by the suppression
tracker.
Steps to reproduce
- Configure an agent that sends media via message tool with target: "<chat_id>"
- Agent uses exec to generate audio, then message with action: send, target: ..., media: ...
- Agent outputs NO_REPLY as text
- Text gets delivered to Telegram as a visible message
Expected behavior
No_Reply an reasoning should not leak to Telegram, when trying to create voice only bots.
Actual behavior
Instead, I'm getting (often) leaking reasoning chains. Sometimes incredibly long reasoning chains, even when the agent knows to only send output to Telegram.
OpenClaw version
2026.2.22
Operating system
Windows 11
Install method
Pinokio NPM
Logs, screenshots, and evidence
https://imgur.com/a/eL5sbdfImpact and severity
This primarily affects voice-only agents that use exec + message tool to send media. The agent's NO_REPLY / internal reasoning text leaks to
the user as a second text message on Telegram (and presumably other channels).
Additional information
No response