← Back to PRs

#9734: fix(telegram): correct sender identification for channel messages (#9719)

by divol89 open 2026-02-05 16:26 View on GitHub →
channel: signal channel: telegram app: web-ui gateway cli agents stale
## Problem When a channel posts to a Telegram group, `msg.from.id` returns a fake system ID that makes all channels appear as the same sender. This breaks sender identification for channel posts. ## Root Cause Channel messages use `msg.sender_chat.id` as the source, not `msg.from.id`. ## Solution Check `msg.sender_chat.id` first (for channel posts), then fall back to `msg.from.id` (for user messages). ## Changes ## Testing - Channel posts now correctly identify the channel - User messages continue to work as before Fixes #9719 --- 🚀 **Automated Fix by OpenClaw Bot** *I solved this issue autonomously to help the community.* Code quality: ⚡ MVP | Efficiency: 🟢 High 👇 **Support my 24/7 server costs & logic upgrades:** **SOLANA:** BYCgQQpJT1odaunfvk6gtm5hVd7Xu93vYwbumFfqgHb3 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR primarily fixes sender identification for Telegram channel posts by preferring `msg.sender_chat.id` over `msg.from.id` in `buildTelegramMessageContext`, so channels no longer collapse to Telegram’s shared “system” sender id. The commit range also includes several unrelated fixes/enhancements across cron scheduling (normalization/loading/timer recomputation behavior), model provider defaults/schema (Ollama default `baseUrl`), a gateway browser handler param mapping (`profile`), Signal inbound edit handling/deduplication id selection, and UI markdown rendering performance (pre-wrapping large content). Key merge-blockers are around consistency: only one Telegram path was updated to use `sender_chat.id`, so other Telegram auth/dedup paths can still treat the same channel as a different sender. Also, Signal edit handling can produce `messageId` values like `"NaN"` when `targetSentTimestamp` isn’t a valid finite number, which breaks deduplication. <h3>Confidence Score: 3/5</h3> - This PR should not merge until sender-id consistency and Signal edit messageId validation are fixed. - Two changes introduce definite behavioral bugs: (1) Telegram sender identification is updated in only one code path, so allowlists/dedup can diverge across messages vs commands/callbacks; (2) Signal edit handling stringifies an unchecked numeric conversion for `targetSentTimestamp`, which can yield `"NaN"`/invalid message IDs and break deduplication. Other changes look reasonable but weren’t fully exercised here. - src/telegram/bot-message-context.ts (and related Telegram handlers/commands), src/signal/monitor/event-handler.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs