I found what looks like a conversation-store bug in laravel/ai v0.1.5.
DatabaseConversationStore::latestConversationId() selects the latest conversation by ordering agent_conversations.updated_at DESC.
However, agent_conversations.updated_at appears to only be written when the conversation row is created. When later user/assistant messages are stored, the parent conversation row is not updated.
Why this matters
If a user has multiple remembered conversations, continueLastConversation() can resume the wrong one:
- create conversation A
- create conversation B
- add more messages to conversation A
- call
continueLastConversation()
At that point, conversation A is the most recently active conversation, but conversation B may still win because its parent row has the newer updated_at.
Expected
The “last conversation” lookup should reflect the most recently active conversation.
Actual
It reflects the most recently created conversation row, unless something else updates the parent row externally.
Relevant code
src/Storage/DatabaseConversationStore.php
latestConversationId()
storeConversation()
storeUserMessage()
storeAssistantMessage()
Possible fixes could be either:
- updating
agent_conversations.updated_at whenever a message is stored, or
- deriving “latest” from message timestamps instead of the parent row timestamp.
I found what looks like a conversation-store bug in
laravel/aiv0.1.5.DatabaseConversationStore::latestConversationId()selects the latest conversation by orderingagent_conversations.updated_at DESC.However,
agent_conversations.updated_atappears to only be written when the conversation row is created. When later user/assistant messages are stored, the parent conversation row is not updated.Why this matters
If a user has multiple remembered conversations,
continueLastConversation()can resume the wrong one:continueLastConversation()At that point, conversation A is the most recently active conversation, but conversation B may still win because its parent row has the newer
updated_at.Expected
The “last conversation” lookup should reflect the most recently active conversation.
Actual
It reflects the most recently created conversation row, unless something else updates the parent row externally.
Relevant code
src/Storage/DatabaseConversationStore.phplatestConversationId()storeConversation()storeUserMessage()storeAssistantMessage()Possible fixes could be either:
agent_conversations.updated_atwhenever a message is stored, or