Skip to content

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

Merged
raulvidis merged 3 commits into
mainfrom
feature/telegram-reply-to-mode
Mar 10, 2026
Merged

feat(gateway): Telegram reply threading modes + forum topic fix#1
raulvidis merged 3 commits into
mainfrom
feature/telegram-reply-to-mode

Conversation

@raulvidis

Copy link
Copy Markdown
Owner

Summary

  • Fix forum topic replies: Responses now land in the correct Telegram forum topic thread. The base dispatcher (_process_message_background) was dropping event.source.thread_id when calling send() — now passes it via metadata.
  • 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.
  • Skin cleanup: Remove poseidon/sisyphus/charizard skins and banner_logo/banner_hero fields from the skin engine.

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 3 commits March 10, 2026 09:15
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>
Restores poseidon/sisyphus/charizard skins and banner_logo/banner_hero
fields that were unintentionally removed in this branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raulvidis raulvidis merged commit 043271c into main Mar 10, 2026
@raulvidis raulvidis deleted the feature/telegram-reply-to-mode branch March 10, 2026 20:03
raulvidis added a commit that referenced this pull request Mar 13, 2026
- Route CancelledError handler through adapter.stream_delete(deferred=True)
  instead of accessing _streaming_manager directly (encapsulation fix)
- Add deferred parameter to stream_delete() to support both immediate and
  deferred deletion patterns
- Add logging to silent exception handlers in run.py
- Track deferred delete task with done_callback to surface errors
- Add test for discard_stream returning message_id without flushing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant