Skip to content

feat(gateway): Telegram reply threading modes + forum topic fix#855

Closed
raulvidis wants to merge 2 commits into
NousResearch:mainfrom
raulvidis:feature/telegram-reply-to-mode-clean
Closed

feat(gateway): Telegram reply threading modes + forum topic fix#855
raulvidis wants to merge 2 commits into
NousResearch:mainfrom
raulvidis:feature/telegram-reply-to-mode-clean

Conversation

@raulvidis

@raulvidis raulvidis commented Mar 10, 2026

Copy link
Copy Markdown

Summary

  • Fix forum topic replies: Responses now land in the correct Telegram forum topic thread. The base dispatcher (_process_message_background) properly passes thread_id via metadata to send().
  • Configurable reply threading: New reply_to_mode setting (off/first/all) controls whether multi-chunk replies thread to the original message. Configurable via reply_to_mode in platform config or TELEGRAM_REPLY_TO_MODE env var. Default first preserves existing behavior.

Test plan

  • 25 unit tests covering all reply modes, config serialization, env var overrides, and edge cases
  • Manual testing on live Telegram bot — confirmed forum topic replies work correctly
  • Verified default behavior (first mode) is unchanged from previous behavior

🤖 Generated with Claude Code

opencode and others added 2 commits March 10, 2026 21:52
Adds configurable threading behavior for multi-chunk Telegram responses:

- reply_to_mode: 'off' - Never thread replies
- reply_to_mode: 'first' - Only first chunk threads (default)
- reply_to_mode: 'all' - All chunks thread to original message

Useful for bots in busy groups where threaded replies keep
conversations organized.

Configurable via gateway.json or TELEGRAM_REPLY_TO_MODE env var.

Based on OpenClaw's ReplyToMode implementation.
- Fix forum topic replies: base.py _process_message_background() now
  passes event.source.thread_id via metadata to send(), so responses
  land in the correct Telegram forum topic thread
- Remove unused _delivery_progress dict from TelegramAdapter
- Remove unused chat_id param from _should_thread_reply()
- Fix tests to use numeric IDs (matching real Telegram IDs)
- Remove redundant @pytest.mark.asyncio (asyncio_mode=auto handles it)
- Add TestEnvVarOverride tests for TELEGRAM_REPLY_TO_MODE env var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
teknium1 pushed a commit that referenced this pull request Mar 11, 2026
Add configurable reply_to_mode for Telegram multi-chunk replies:
- off: never thread replies to original message
- first: only first chunk threads (default, preserves current behavior)
- all: all chunks thread to original message

Configurable via reply_to_mode in platform config or TELEGRAM_REPLY_TO_MODE
env var.

Cherry-picked from PR #855 by raulvidis, rebased onto current main.
Dropped asyncio_mode=auto pyproject.toml change, added @pytest.mark.asyncio
decorators, fixed test IDs to use numeric strings.

Co-authored-by: Raul <77628552+raulvidis@users.noreply.github.com>
@teknium1

Copy link
Copy Markdown
Contributor

Cherry-picked into PR #956 with contributor credit preserved (--author + Co-authored-by). Thank you @raulvidis!

Changes from the original PR:

  • Forum topic fix was already working on main (base.py already passes thread_id via metadata) — skipped
  • Dropped asyncio_mode = "auto" from pyproject.toml (would affect the entire test suite)
  • Added @pytest.mark.asyncio decorators to async tests instead
  • Fixed test IDs to use numeric strings (matching real Telegram IDs)

@teknium1 teknium1 closed this Mar 11, 2026
@raulvidis

Copy link
Copy Markdown
Author

Thanks for the merge! I'll keep contributing — aiming to bring the same quality with every PR 🙏

teknium1 added a commit that referenced this pull request Mar 25, 2026
Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR #855 by raulvidis.
teknium1 added a commit that referenced this pull request Mar 25, 2026
Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR #855 by raulvidis.
@teknium1

Copy link
Copy Markdown
Contributor

Your reply threading mode feature has been salvaged and merged via PR #2907. Core logic preserved, adapted to current main. Thanks @raulvidis!

InB4DevOps pushed a commit to InB4DevOps/hermes-agent that referenced this pull request Mar 25, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 28, 2026
Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 28, 2026
Add configurable reply_to_mode for Telegram multi-chunk replies:
- off: never thread replies to original message
- first: only first chunk threads (default, preserves current behavior)
- all: all chunks thread to original message

Configurable via reply_to_mode in platform config or TELEGRAM_REPLY_TO_MODE
env var.

Cherry-picked from PR NousResearch#855 by raulvidis, rebased onto current main.
Dropped asyncio_mode=auto pyproject.toml change, added @pytest.mark.asyncio
decorators, fixed test IDs to use numeric strings.

Co-authored-by: Raul <77628552+raulvidis@users.noreply.github.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
CumulusService pushed a commit to Cumulus-Service-GmbH/hermes-agent that referenced this pull request May 30, 2026
Add configurable reply_to_mode for Telegram multi-chunk replies:
- off: never thread replies to original message
- first: only first chunk threads (default, preserves current behavior)
- all: all chunks thread to original message

Configurable via reply_to_mode in platform config or TELEGRAM_REPLY_TO_MODE
env var.

Cherry-picked from PR NousResearch#855 by raulvidis, rebased onto current main.
Dropped asyncio_mode=auto pyproject.toml change, added @pytest.mark.asyncio
decorators, fixed test IDs to use numeric strings.

Co-authored-by: Raul <77628552+raulvidis@users.noreply.github.com>
CumulusService pushed a commit to Cumulus-Service-GmbH/hermes-agent that referenced this pull request May 30, 2026
Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ch#2907)

Add reply_to_mode setting (off/first/all) to control whether Telegram
replies quote/thread to the user's original message.

- 'off': Never thread replies (no quote bubble)
- 'first': Only first chunk threads to user's message (default, preserves existing behavior)
- 'all': All chunks in multi-part replies thread to user's message

Configurable via:
- reply_to_mode in platform config (gateway config YAML)
- TELEGRAM_REPLY_TO_MODE env var

Based on PR NousResearch#855 by raulvidis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants