Subject: Regression: Loss of message_thread_id context in Forum topics after local history deletion.
Technical Findings:
State Mismatch: There exists a critical discrepancy between the Server-Side Thread State and the Client-Side Anchor Reference. While a forum_topic remains active on the Telegram infrastructure, the local client's ability to reference it depends entirely on the persistence of the forum_topic_created service message.
The "Ghost Routing" Trigger: When a user executes "Delete and Block" or "Clear History," the forum_topic_created anchor is removed from the local database. Upon unblocking and restarting the bot, the client UI successfully renders the topic (resurrected by incoming bot messages), but fails to attach the message_thread_id to outgoing Update objects.
JSON Schema Omission: Outgoing messages from the glitched client arrive at the Webhook/Long-Polling endpoint as standard Message objects where message_thread_id is entirely omitted from the JSON payload, despite the user visually typing within a topic folder.
Anchor Nullification: Because the original message ID that defined the thread (the anchor) is missing from the local client cache, the client defaults to the root chat context (thread_id: 0 / null).
Impact: This breaks FSM (Finite State Machine) logic.
Requested Resolution:
The client should dynamically re-fetch or derive the message_thread_id from the server's chat state even if the local forum_topic_created message is missing, ensuring every message sent from within a topic container strictly includes its parent message_thread_id in the Update payload.
Steps to reproduce
Create Anchor: Have the bot create a forum topic. This generates the forum_topic_created service message, which serves as the Client-Side Anchor.
Local Purge: On the Telegram mobile or desktop app, select the bot and choose "Clear History" or "Delete and Block" then "Unblock". This deletes the local anchor message while the topic remains active on Telegram's servers.
Resurrection: Trigger the bot to send any message into that existing topic ID. The client UI will visually restore the folder and show the message inside it.
Failure Trigger: While visually viewing that restored folder, the user types a message or taps a button and hits Send.
Analyze Payload: Inspect the raw JSON Update received by the bot.
Log in here to report bugs or suggest features. Please enter your phone number in the international format and we will send a confirmation message to your account via Telegram.