I hit this on laravel/ai v0.1.5 while testing remembered conversations.
DatabaseConversationStore::getLatestConversationMessages() currently maps every stored row back to a plain Laravel\Ai\Messages\Message:
->map(fn ($m) => new Message($m->role, $m->content));
But the store writes richer data than that:
- user message attachments are stored in
attachments
- assistant tool calls are stored in
tool_calls
- tool results are stored in
tool_results
Because that data is ignored on rehydration, continuing a remembered conversation loses non-text context.
Impact
This breaks continued conversations in at least these cases:
- previous user messages had attachments
- previous assistant turns included tool calls
- previous tool results need to remain in context for later turns
In practice, the conversation history becomes behaviorally different after retrieval than it was when originally stored.
Expected
Rehydration should restore the original message types and associated structured data, for example:
UserMessage with attachments
AssistantMessage with tool calls
ToolResultMessage where applicable
Actual
Every row becomes a plain text Message, so structured context is discarded.
Relevant code
src/Storage/DatabaseConversationStore.php
storeUserMessage()
storeAssistantMessage()
getLatestConversationMessages()
If useful, I can open a PR with a proposed reconstruction path.
I hit this on
laravel/aiv0.1.5while testing remembered conversations.DatabaseConversationStore::getLatestConversationMessages()currently maps every stored row back to a plainLaravel\Ai\Messages\Message:But the store writes richer data than that:
attachmentstool_callstool_resultsBecause that data is ignored on rehydration, continuing a remembered conversation loses non-text context.
Impact
This breaks continued conversations in at least these cases:
In practice, the conversation history becomes behaviorally different after retrieval than it was when originally stored.
Expected
Rehydration should restore the original message types and associated structured data, for example:
UserMessagewith attachmentsAssistantMessagewith tool callsToolResultMessagewhere applicableActual
Every row becomes a plain text
Message, so structured context is discarded.Relevant code
src/Storage/DatabaseConversationStore.phpstoreUserMessage()storeAssistantMessage()getLatestConversationMessages()If useful, I can open a PR with a proposed reconstruction path.