You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vector-sdk: Channel::history is empty after a bot restart #115
After a bot restarts, Channel::history and Channel::history_before return nothing for a Community channel, even when the bot's database holds the messages. Channel::sync does not bring them back.
Why
Channel::history calls VectorCore::get_messages_before, and it reads only STATE (vector-core/src/lib.rs).
A new process starts with an empty STATE, and the SDK does not load stored messages into it.
Ingest skips a message whose id is already stored (apply_chat_to_state_in in community/v2/inbound.rs: "in-memory STATE holds only a window"). So a sync page with old messages gives 0 new and adds nothing to STATE.
The walk loop in the Channel::sync_before doc then stops at once: history is empty and sync returns 0, so the bot thinks it is at the start of history.
The Channel::history doc says it "answers from the bot's own store". The SDK CHANGELOG says "What was sent before the bot began listening is history, as before: channel.history()". The desktop app reads its pages from the database (get_message_views).
In community/v2/service.rs with TestBed: ingest channel messages with v2_ingest_chat_page, then swap_to the same actor again. This opens the same database in a new session, so STATE is empty, like a new process. get_message still finds the rows, but get_messages_before(channel, None, 10) returns []. Ingesting the same page again gives 0 new, and history stays [].
I'll open a PR for this: VectorCore::get_messages_before reads the store too, with a cursor query in db/events.rs.
Activity