Skip to content

fix(bluebubbles): add group chat filters - #33541

Open
skyc1e wants to merge 1 commit into
NousResearch:mainfrom
skyc1e:fix/bluebubbles-group-filters
Open

fix(bluebubbles): add group chat filters#33541
skyc1e wants to merge 1 commit into
NousResearch:mainfrom
skyc1e:fix/bluebubbles-group-filters

Conversation

@skyc1e

@skyc1e skyc1e commented May 28, 2026

Copy link
Copy Markdown
Contributor

Adds chat-level filters to the BlueBubbles adapter:

  • BLUEBUBBLES_IGNORE_GROUP_CHATS drops incoming group chat events before dispatch.
  • BLUEBUBBLES_ALLOWED_CHATS limits handling to specific BlueBubbles chat GUIDs and also works as a group chat auth allowlist.

Docs and tests are updated for both env vars.

Closes #33489

Checked with pytest -o addopts='' tests/gateway/test_bluebubbles.py and git diff --check.

@skyc1e
skyc1e marked this pull request as ready for review May 28, 2026 00:15
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have labels May 28, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused BlueBubbles filtering work. The feature remains distinct from the merged mention gate: the maintainer comment on #35606 explicitly calls #33541 complementary.

Problems

  • The group authorization additions target the old GatewayRunner path (gateway/run.py:6473 in this PR). On current main, that logic was extracted to gateway/authz_mixin.py:329-343 and :388-391; without porting the mappings there, the claimed group-chat auth allowlist is absent.
  • The filters are applied at gateway/platforms/bluebubbles.py:952-963 only after attachment handling at :878-912, so ignored group traffic can still download and cache attachments.
  • The new controls are documented as non-secret environment variables, while AGENTS.md:102-107 requires behavioral settings in config.yaml; current BlueBubbles group gating uses platforms.bluebubbles.extra in website/docs/user-guide/messaging/bluebubbles.md:45-64.

Suggested changes

  • Port the authorization and unauthorized-DM handling to gateway/authz_mixin.py, move filtering before attachment retrieval, and cover an ignored attachment-bearing group webhook.
  • Re-scope the controls to platforms.bluebubbles.extra and document that YAML surface.

Automated hermes-sweeper review.

Comment thread gateway/run.py
if source.chat_type in {"group", "forum", "channel"} and source.chat_id:
chat_allowlist_env = {
Platform.TELEGRAM: "TELEGRAM_GROUP_ALLOWED_CHATS",
Platform.BLUEBUBBLES: "BLUEBUBBLES_ALLOWED_CHATS",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main extracted this authorization path into gateway/authz_mixin.py:329-343 and :388-391. Please port the BlueBubbles group-chat mapping (and the related unauthorized-DM allowlist handling) to that mixin; this old GatewayRunner edit will not implement the claimed authorization behavior on current main.


session_chat_id = chat_guid or chat_identifier
is_group = bool(record.get("isGroup")) or (";+;" in (chat_guid or ""))
if is_group and self._ignore_group_chats:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gate runs after the attachment loop above, so an ignored group message can still download and cache inbound attachments. Resolve the chat identity and apply the filter before attachment retrieval, with a test asserting the downloader is not called for an ignored group payload.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] BlueBubbles adapter: add group chat filtering (IGNORE_GROUP_CHATS or ALLOWED_CHATS)

3 participants