Skip to content

fix: handle Telegram channel-post commands#9500

Open
lucientavano wants to merge 1 commit into
NousResearch:mainfrom
lucientavano:fix/telegram-channel-post-commands
Open

fix: handle Telegram channel-post commands#9500
lucientavano wants to merge 1 commit into
NousResearch:mainfrom
lucientavano:fix/telegram-channel-post-commands

Conversation

@lucientavano

@lucientavano lucientavano commented Apr 14, 2026

Copy link
Copy Markdown

Bug Description

Telegram channel posts containing slash commands were not reaching the command handler, so commands like /sethome failed when posted from channels.

Root Cause

The Telegram adapter only registered the normal command handler, and _handle_command() only read update.message. Telegram channel-post commands arrive via update.channel_post / update.edited_channel_post, so they were ignored.

Fix

  • register a Telegram command handler for filters.UpdateType.CHANNEL_POSTS & filters.COMMAND
  • normalize command updates through a small helper that accepts message, edited_message, channel_post, and edited_channel_post
  • add regression tests covering both channel-post command routing and handler registration

How to Verify

  1. source venv/bin/activate && python -m pytest tests/gateway/test_telegram_channel_posts.py tests/gateway/test_telegram_group_gating.py tests/gateway/test_telegram_reactions.py -q
  2. Post a slash command like /sethome in a Telegram channel where Hermes is admin
  3. Confirm the command reaches the gateway command handler instead of being ignored

Test Plan

  • Added regression test for this bug
  • Existing targeted Telegram tests still pass
  • Manual verification in a live Telegram channel

Risk Assessment

Low — the change is narrowly scoped to Telegram command update routing and is covered by targeted regression tests.

@lucientavano

Copy link
Copy Markdown
Author

Operator note: I ran a broader python -m pytest tests/gateway/ -q sweep after landing this fix. The gateway suite is currently not green on upstream main; I reproduced representative failures on clean HEAD without this branch checked in. The failures appear pre-existing and unrelated to this PR (display_config imports, matrix sync auth retry tests, Telegram approval-button tests, session hygiene/env tests, and Feishu test drift). This PR stays intentionally scoped to Telegram channel-post command routing.

@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 labels Apr 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #3634 (open issue for same bug) and closed #3683 (prior PR attempt). This PR appears to be a fresh fix for the same root cause: Telegram adapter ignoring channel_post updates.

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 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.

2 participants