Conversation history without user messages
Recently, i've faced an issue where the list of messages that were pased to the AI model consists of only assistant messages + the last message from a user. Thus, AI looses the context as there are no previous user-related messages in the conversation history.
I am using the upstash storage (all user messages successfully stored to the database - I've verified that).
I've attached screenshots from langfuse: the first one is the current state where only the last question is related to the user. On. the second screenshot is the expected history, which includes user-related messages.


3 Replies
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/9025
GitHub
[DISCORD:1429476174068842546] Conversation history without user mes...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1429476174068842546 Recently, i've faced an issue where the list of messages that were pased to the AI...
upd.
After further investigation, it seems that messages returned from Upstash are not sorted properly. After increasing the lastMessages property to 50, some user messages were included in the list (not all of them, but some are now visible).
Thanks @awy for the addtional info, I added it to the GH issue mentioned above 😉