Skip to content

fix(telegram): ignore non-forum group thread ids - #3818

Open
just-cameron wants to merge 3 commits into
mainfrom
letta/fix-telegram-non-forum-routing-6bd25889
Open

fix(telegram): ignore non-forum group thread ids#3818
just-cameron wants to merge 3 commits into
mainfrom
letta/fix-telegram-non-forum-routing-6bd25889

Conversation

@just-cameron

Copy link
Copy Markdown
Contributor

Overlord (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

Fixes #3811.

Problem

Telegram can attach changing message_thread_id values to messages in a group with Topics disabled. Letta Code treated every value as a topic route. Each new value created another conversation for the same group.

Change

The Telegram adapter now keeps a group thread ID only when Telegram marks the supergroup message as a topic or marks the chat as a forum. Regular groups use the root group route. Private bot topics keep their existing thread routing.

Before and after

  • Before: two non-forum group messages with different thread IDs created two conversations.
  • After: both messages use one root route and one conversation.
  • Forum topics and private bot topics remain topic-scoped.

Validation

  • The new end-to-end regression fails on main: expected one conversation, received two.
  • The same regression passes with this change.
  • Focused Telegram adapter, lifecycle, typing, and runtime tests: 49 passed.
  • Complete Telegram adapter and registry suite: 87 passed, 1 credential-gated live test skipped.
  • bun run check: 12 checks passed.

Limits and risk

This change does not merge routes or conversations that older versions already created. I did not run a live Telegram reproduction. The behavior change is limited to inbound group and supergroup thread normalization.

Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974)

Normalize inbound group topic metadata so changing non-forum thread IDs cannot fragment conversations while preserving verified forum and private bot topics.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@just-cameron
just-cameron marked this pull request as ready for review August 12, 2026 20:19
@just-cameron
just-cameron requested a review from cpacker as a code owner August 12, 2026 20:19
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Gate group/supergroup thread-id normalization on is_topic_message, not
chat.is_forum. Forum General reply threads without that flag stay on the
root route so they do not fragment like non-forum groups used to.
Capture the inbound payload instead of using objectContaining with an
undefined threadId, which bun:test does not treat as a missing property.
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.

Telegram group with Topics disabled fragments messages across multiple conversations

2 participants