fix(telegram): multiplexed profiles keep separate DM topic lanes in the shared state.db (#76423 #87239, salvage #76487) - #101249
Merged
Merged
Conversation
૮ >ﻌ< ა ci reviewran on e3e07d2 — chore: map contributor crdesign8@hotmail.com -> @crdesign8
|
Issue #76423: under multiplex_profiles a shared state.db keyed topic mode and bindings only by Telegram chat_id/thread_id, so private-chat ids collided across bots/profiles. - Add profile_name to telegram_dm_topic_mode and telegram_dm_topic_bindings - Schema v2→v3 rebuild; legacy rows migrate into the "default" namespace - Keyword-only profile_name="default" on SessionDB topic APIs (compat)
Issue #76423 follow-up: wire SessionDB profile_name through gateway paths. - Resolve profile from source.profile (never process-global active profile) - Stamp adapter._hermes_profile_name for prune under multiplex - /topic enable/status and binding record/recover/disable/restore paths
Address hermes-sweeper review on #76487: - Prefer hermes_profile from send metadata when pruning stale topic bindings so profile_routes cannot delete the transport adapter's namespace instead of the routed runtime's - Namespace lobby/capability cooldowns and /topic off cleanup by (profile, chat_id) - Document profile_name PKs and scoped cleanup SQL in telegram.md - Regression: primary-adapter stamp + routed metadata prune isolation
…driven rebuild Same behavior as the salvaged #76487 migration (fresh installs get the v3 shape; v1/v2 tables rebuild with profile_name leading the PK, legacy rows into 'default' only, CASCADE FK supplied on the way), with the per-table DDL written once instead of three times and the now-redundant v1->v2 CASCADE-only rebuild dropped (the v3 rebuild subsumes it). Co-authored-by: Celio Monteiro <crdesign8@hotmail.com>
teknium1
force-pushed
the
salvage/mux-telegram-topics
branch
from
September 2, 2026 12:46
e3e07d2 to
bc10b41
Compare
This was referenced Sep 2, 2026
Closed
13 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bots served by one multiplexed gateway share
state.db, and a private Telegram chat_id is the user's id —identical across bots — so
telegram_dm_topic_mode/telegram_dm_topic_bindingskeyed by(chat_id)/(chat_id, thread_id)made/topicon one bot enable topic recovery for every bot, let bindings clobber eachother, and had prune/cooldowns act on the wrong profile. Both tables now carry
profile_name(leading the PK),every gateway read/write passes the routed
source.profile(never the process-global active profile), andstale-topic prune resolves the namespace from send metadata.
Changes
profile_nameon both topic tables; one table-driven rebuild for v1/v2 → v3, legacy rows →defaultGatewayRunner._telegram_topic_profile_name(source)threaded through all 10 topic call sites +/topicslash paths(profile, chat);/topic offresets the same key_thread_metadata_for_sourcestampshermes_profile; Telegram prune uses it over the adapter stamp;secondary adapters stamped with their profile
Validation
/topicon alpha → beta topic modeCredits
@crdesign8 — #76487, commits cherry-picked with authorship (first submitter, 2026-08-02; sorry the conflicts sat
unanswered). @mjshorty — #76423 first report. @cherryb16 — #87239 / #87240 fuller diagnosis. @sadgen — #93491.
Fixes #76423
Fixes #87239
Infographic