Skip to content

fix: handle Telegram channel-post commands - #9500

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

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.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Telegram regression fix. This is now superseded by a broader implementation already on main.

  • Automated hermes-sweeper review verified plugins/platforms/telegram/adapter.py:7468-7476 resolves channel posts through Update.effective_message, and :7511-7531 routes the resulting message through the COMMAND event path.
  • tests/gateway/test_telegram_channel_posts.py:168-181 covers command dispatch from a channel post, including channel identity.
  • Commit 704872a62f87c642a0c69fcb0f138d48896e0d59 (fix(telegram): handle channel post updates) shipped in v2026.5.28. The related fix(telegram): handle channel post updates #25327 discussion also records that this broader effective-message approach superseded the same Telegram adapter does not process channel_post updates #3634 root cause.

Closing as implemented on main.

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 sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants