Skip to content

fix(gateway): bridge top-level require_mention to Telegram config#19429

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 3, 2026
Merged

fix(gateway): bridge top-level require_mention to Telegram config#19429
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 3, 2026

Salvage of #19317 by @konsisumer onto current main.

Summary

A top-level require_mention: true in config.yaml was ignored by the Telegram adapter unless also duplicated under telegram.require_mention. Bridge the top-level shorthand into the TELEGRAM_REQUIRE_MENTION env var (with telegram.require_mention taking precedence when set), matching existing shorthand handling for other platform knobs.

Also corrects telegram.md: bare /cmd without @botname is rejected when require_mention is enabled; only /cmd@botname (bot-menu form) passes.

Changes

  • gateway/config.py: shorthand bridge + precedence rules (+16/-2)
  • tests: regression coverage
  • website/docs/user-guide/messaging/telegram.md: clarify bot-menu vs bare /cmd

Validation

scripts/run_tests.sh tests/gateway/test_telegram_group_gating.py → 14 passed

Original PR: #19317
Fixes: #3979

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 #3979
@teknium1 teknium1 merged commit 6fda92a into main May 3, 2026
4 checks passed
@teknium1 teknium1 deleted the hermes/hermes-8c54fd4a branch May 3, 2026 23:59
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter area/config Config system, migrations, profiles labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: require_mention ignored in groups — bot responds to every message

3 participants