Skip to content

feat(discord): support regex wake-word patterns - #66836

Open
rich-jojo wants to merge 1 commit into
NousResearch:mainfrom
rich-jojo:fix/discord-natural-wake-prefixes-v2
Open

feat(discord): support regex wake-word patterns#66836
rich-jojo wants to merge 1 commit into
NousResearch:mainfrom
rich-jojo:fix/discord-natural-wake-prefixes-v2

Conversation

@rich-jojo

@rich-jojo rich-jojo commented Jul 18, 2026

Copy link
Copy Markdown

Summary

  • add discord.mention_patterns / DISCORD_MENTION_PATTERNS regex wake-word support
  • treat matching channel messages as satisfying require_mention without disabling channel gating globally
  • preserve the same behavior for live events and missed-message recovery
  • skip invalid regexes with a warning and cache compiled patterns
  • document config and environment-variable usage

Motivation

Discord supported literal @mention gating and free-response channels, but unlike Slack, Telegram, and other adapters it had no configurable wake-word path. Users who want a natural prefix such as hermes status had to either mention the bot every time or make an entire channel free-response.

This adds parity while keeping the safe require_mention: true default. Anchored patterns let operators accept only messages that begin with a configured bot name.

Verification

  • RED: the live routing test initially failed because the message was dropped by mention gating
  • RED: after rebasing onto current main, the recovered-message regression test failed at the new pre-dispatch mention gate
  • pytest tests/gateway/test_discord_free_response.py -q -o 'addopts=' → 62 passed
  • pytest tests/gateway/test_discord*.py -q -o 'addopts=' → 597 passed
  • git diff --check

@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #29393 and #49613: this is a Discord-local regex mention-pattern implementation, while those open PRs use shared mention-pattern and alternate name-trigger approaches. These are competing feature designs, not duplicates.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Discord routing change. The feature premise is present on the current PR base: plugins/platforms/discord/adapter.py:6285-6287 drops server-channel messages that have neither a Discord mention nor another accepted trigger. The existing generic bridge already forwards discord.mention_patterns into platform config (gateway/config.py:1294-1295, 1352), and the proposed implementation follows established adapter-local mention-pattern behavior.

No concrete correctness defect was found in the reviewed four-file diff. This is an automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 18, 2026
@rich-jojo
rich-jojo force-pushed the fix/discord-natural-wake-prefixes-v2 branch from e5c9a28 to 2bfefd6 Compare July 21, 2026 05:42
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary

Two PRs address Discord regex wake words under mention gating. #29393 adds shared pattern helpers, leading-wake-word stripping, live-message routing, tests, and an unrelated watchdog script; #66836 implements Discord-local cached patterns across live and recovered-message routing, with configuration documentation and focused tests.

Related pull requests

  • [codex] Add Discord mention pattern wake phrases #29393 related — (+311/-2) — n/a: Adds shared regex compilation, matching, and leading-pattern stripping for live Discord messages, but the complete diff also adds an unrelated macOS-specific watchdog, bypasses the current explicit-mention helper, and tests the private pattern field rather than the config bridge. The contributor keep_open review requests removing the watchdog, preserving _self_is_explicitly_mentioned(message), and adding user-guide and config-bridge coverage.
  • feat(discord): support regex wake-word patterns #66836 related — (+137/-1) — n/a: Adds a Discord-local cached regex implementation that satisfies mention gating in both live and recovered-message paths while preserving _self_is_explicitly_mentioned(message), and includes config/environment documentation plus focused tests. This supports the maintainer-bot keep_open verdict, which found no concrete correctness defect in the four-file diff.

Duplicates

None: the contributor assessment identifies #29393 and #66836 as competing shared-helper and Discord-local designs rather than duplicates.

Suggested consolidation

Keep #66836 open with a salvage path centered on its focused Discord-local implementation, recovered-message parity, documentation, and tests, consistent with the maintainer-bot keep_open verdict. For #29393, author action: rebase onto main and split out the Discord feature while removing the unrelated watchdog, preserving the current explicit-mention helper, and adding the requested documentation and config-bridge coverage; do not close either PR as a duplicate on the available evidence.

Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 26 kB of PR diffs, 3 kB of issue/PR text, 2 kB of discussion (2 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter 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 type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants