Files
hermes-agent/tests
Teknium 407303dfdc fix(telegram): move dm_topic_auto_transfer to adapter ingress so the reply lands in the new topic
Builds on the salvaged #139188 (@KoNit-K). The salvaged commit ran the transfer in the runner's
_hmwa_resolve_session, which is too late through the real adapter. By then the adapter has keyed
the session on the root-DM source, and _handle_message has already answered with the lobby
reminder. So with the key on, no topic was ever created, and every root-DM message got the
"main chat is reserved" notice.

- The transfer now runs in TelegramAdapter.handle_message before session keying
  (telegram_topic_transfer.py), through a runner hook (_transfer_telegram_root_dm) wired in
  _wire_adapter_handlers next to topic recovery.
- If topic creation fails, the hook returns the lobby-recovery topic (fallback). Commands,
  internal wakes, routed events and unauthorized senders are never moved.
- The first reply in the new topic carries no reply anchor (the root message lives outside the
  topic), via reply_anchor_override="". This replaces the base.py metadata flag.
- With the key unset (default), behaviour is unchanged and the v0.22 lobby recovery stays
  (#136567).
- The top-level `telegram: dm_topic_auto_transfer` YAML key is bridged into extra, like
  disable_topic_auto_rename.
- Documented in the Telegram multi-session docs.

Refs #139136
Refs #134889 (MSG-15)
Refs #141321
2026-10-18 19:27:36 -07:00
..
…
…