fix(gateway): bridge top-level require_mention to Telegram config#19317
Closed
konsisumer wants to merge 1 commit into
Closed
fix(gateway): bridge top-level require_mention to Telegram config#19317konsisumer wants to merge 1 commit into
konsisumer wants to merge 1 commit into
Conversation
Users commonly place `require_mention: true` at the top level of config.yaml alongside `group_sessions_per_user`, expecting it to gate Telegram group messages. The key was silently ignored because the config loader only checked `yaml_cfg["telegram"]["require_mention"]`. When `require_mention` is found at the top level and no telegram-specific value is set, the fix now: - adds it to platforms_data["telegram"]["extra"] so _telegram_require_mention() picks it up via the primary config.extra path - sets TELEGRAM_REQUIRE_MENTION env var for the secondary fallback path A telegram-specific value (telegram.require_mention) still takes precedence over the top-level shorthand. Also corrects telegram.md: bare /cmd without @botName is rejected when require_mention is enabled; only /cmd@botname (bot-menu form) passes. Fixes NousResearch#3979
Collaborator
|
Fixes #3979 — bridges top-level to Telegram platform config when no is set. |
Contributor
|
Salvaged via #19429 onto current main — your commit's authorship was preserved. Thanks @konsisumer! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bot responds to every group message despite
require_mention: truein config.yaml when that key is placed at the top level (same level asgroup_sessions_per_user).What changed and why
gateway/config.py: whenrequire_mentionis found at the top level of config.yaml and notelegram.require_mentionis already set, the value is now bridged toplatforms_data["telegram"]["extra"]["require_mention"](picked up by_telegram_require_mention()via its primaryconfig.extracheck) and toTELEGRAM_REQUIRE_MENTIONenv var (secondary fallback). A platform-specifictelegram.require_mentionstill overrides the top-level shorthand.tests/gateway/test_telegram_group_gating.py: two new tests cover the top-level shorthand and confirm thattelegram.require_mention: falseoverrides a top-levelrequire_mention: true.website/docs/user-guide/messaging/telegram.md: corrected the list of accepted message types underrequire_mention: true— bare/cmd(without@botname) is rejected; only/cmd@botname(Telegram bot-menu form) passes.How to test
require_mention: trueandgroup_sessions_per_user: trueat the top level of~/.hermes/config.yaml(notelegram:section).@botname hello— the bot should respond.pytest tests/gateway/test_telegram_group_gating.py -v— all 14 tests pass.What platforms tested on
Fixes #3979