fix: handle forum/topics in Telegram DM thread routing (#17980)

resolveTelegramThreadSpec now checks isForum in the non-group path.
DMs with forum/topics enabled return scope 'forum' so each topic
gets its own session, while plain DM threads keep scope 'dm'.
This commit is contained in:
8BlT
2026-02-16 18:52:26 +07:00
committed by Peter Steinberger
parent c25c276e00
commit e20b87f1ba
2 changed files with 37 additions and 6 deletions

View File

@@ -101,13 +101,15 @@ export function resolveTelegramThreadSpec(params: {
scope: params.isForum ? "forum" : "none",
};
}
if (params.messageThreadId == null) {
return { scope: "dm" };
// DM with forum/topics enabled — treat like a forum, not a flat DM
if (params.isForum && params.messageThreadId != null) {
return { id: params.messageThreadId, scope: "forum" };
}
return {
id: params.messageThreadId,
scope: "dm",
};
// Preserve thread ID for non-forum DM threads (session routing, #8891)
if (params.messageThreadId != null) {
return { id: params.messageThreadId, scope: "dm" };
}
return { scope: "dm" };
}
/**