Bug Description
When processing Telegram reply contexts, describeReplyTarget() in the send handler lacks a typeof check on replyLike.text / replyLike.caption, causing [object Object] to appear in the delivered message content.
Location
dist/send-Bwxyans7.js line ~508:
body = (replyLike.text ?? replyLike.caption ?? "").trim();
If replyLike.text or replyLike.caption is not a string (e.g., an object from a Telegram API edge case), JavaScript coerces it to [object Object].
Contrast with existing pattern
Elsewhere in the same codebase, proper type guards are used:
const text = typeof msg.text === "string" ? msg.text : void 0; // ✅
The reply context path is missing this protection. ❌
Steps to Reproduce
- Run OpenClaw with Telegram channel configured
- Receive a message that is a reply to another message
- If the replied-to message's
text or caption field is not a plain string (Telegram API edge case), the agent receives [object Object] instead of actual content
Expected Behavior
Reply context should apply typeof === "string" guard before using text/caption, falling back gracefully if the value is not a string.
Suggested Fix
const rawText = replyLike.text ?? replyLike.caption ?? "";
body = (typeof rawText === "string" ? rawText : "").trim();
Environment
- OpenClaw latest (npm)
- Telegram channel
- macOS / Node v24
Bug Description
When processing Telegram reply contexts,
describeReplyTarget()in the send handler lacks atypeofcheck onreplyLike.text/replyLike.caption, causing[object Object]to appear in the delivered message content.Location
dist/send-Bwxyans7.jsline ~508:If
replyLike.textorreplyLike.captionis not a string (e.g., an object from a Telegram API edge case), JavaScript coerces it to[object Object].Contrast with existing pattern
Elsewhere in the same codebase, proper type guards are used:
The reply context path is missing this protection. ❌
Steps to Reproduce
textorcaptionfield is not a plain string (Telegram API edge case), the agent receives[object Object]instead of actual contentExpected Behavior
Reply context should apply
typeof === "string"guard before usingtext/caption, falling back gracefully if the value is not a string.Suggested Fix
Environment