Skip to content

Telegram: fix group messages silently dropped with groupPolicy allowlist + groupAllowFrom but no groups config#28310

Open
harjothkhara wants to merge 2 commits intoopenclaw:mainfrom
harjothkhara:fix/telegram-group-allowlist-regression-28107
Open

Telegram: fix group messages silently dropped with groupPolicy allowlist + groupAllowFrom but no groups config#28310
harjothkhara wants to merge 2 commits intoopenclaw:mainfrom
harjothkhara:fix/telegram-group-allowlist-regression-28107

Conversation

@harjothkhara
Copy link
Copy Markdown

@harjothkhara harjothkhara commented Feb 27, 2026

Fixes #28307

What

Pass hasGroupAllowFrom in the resolveGroupPolicy closure in src/telegram/bot.ts so that resolveChannelGroupPolicy can activate the senderFilterBypass path when groupPolicy: "allowlist" is set with groupAllowFrom but no explicit per-group groups: entries.

Why

resolveChannelGroupPolicy already contains the correct logic for this case:

const senderFilterBypass =
  groupPolicy === "allowlist" && !hasGroups && Boolean(params.hasGroupAllowFrom);
const allowed =
  groupPolicy === "disabled"
    ? false
    : !allowlistEnabled || allowAll || Boolean(groupConfig) || senderFilterBypass;

But the closure in bot.ts never forwarded hasGroupAllowFrom, so senderFilterBypass was always false. The result: when a user configured groupPolicy: "allowlist" + groupAllowFrom without any groups: block, every inbound group message was silently dropped — even from allowlisted senders.

Changes

  • src/telegram/bot.ts: forward hasGroupAllowFrom in the resolveGroupPolicy closure
  • src/telegram/bot.create-telegram-bot.test.ts: two regression tests covering allowFrom and groupAllowFrom without explicit groups: config

Testing

  • pnpm build
  • pnpm check
  • pnpm test -- src/telegram/bot.create-telegram-bot.test.ts — 45/45 passed ✅

AI-assisted. Fix manually reviewed; regression tests written and verified locally.

🤖 AI-Assisted PR

  • AI-assisted (Augment Agent / Claude Sonnet 4.6)
  • Degree of testing: fully tested — regression tests written and passing, build and lint clean
  • Fix manually reviewed and understood — one missing parameter in an existing closure; the senderFilterBypass logic in group-policy.ts was already correct and just needed to be wired up
  • Prompt/session logs available on request

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: XS labels Feb 27, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Correctly passes hasGroupAllowFrom to resolveChannelGroupPolicy in Telegram bot, fixing a bug where group messages were silently dropped when using groupPolicy: "allowlist" with groupAllowFrom but no explicit groups: config.

  • Fixed src/telegram/bot.ts:310: now passes hasGroupAllowFrom parameter to activate the sender filter bypass path in resolveChannelGroupPolicy
  • Added two regression tests covering both allowFrom and groupAllowFrom configurations without explicit groups config
  • The fix aligns with the existing WhatsApp implementation pattern (already passing hasGroupAllowFrom)
  • Clean, minimal change that directly addresses the root cause

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a simple, targeted parameter addition that resolves a clear bug. The logic already existed in resolveChannelGroupPolicy but was never activated due to the missing parameter. Tests comprehensively cover the regression case, and the implementation matches the existing pattern used in WhatsApp channel
  • No files require special attention

Last reviewed commit: 275d18c

When groupPolicy="allowlist" is set with allowFrom/groupAllowFrom but no
explicit groups config, the resolveGroupPolicy closure was calling
resolveChannelGroupPolicy without hasGroupAllowFrom, so senderFilterBypass
was always false. This caused evaluateTelegramGroupPolicyAccess to return
group-chat-not-allowed for every group message, silently dropping them.

Fixes openclaw#28107.
… groups config

Covers the case where groupPolicy="allowlist" is configured with
allowFrom or groupAllowFrom but without any per-group groups entries.
Authorized senders must pass through; the sender-level filter handles
individual access control so the chat-level check must not block all
messages in this configuration.
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 5, 2026
@openclaw-barnacle openclaw-barnacle bot removed the stale Marked as stale due to inactivity label Mar 27, 2026
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram group messages silently dropped with groupPolicy: allowlist + groupAllowFrom but no explicit groups config

1 participant