Files
BrowserOS/apps/agent/lib/conversations
Nikhil 92c20eef73 fix: filter empty-parts messages to prevent follow-up conversation crash (#402)
* fix: filter out messages with empty parts to prevent follow-up crash

When an assistant response is interrupted or errors before producing content,
a UIMessage with empty parts remains in the chat state. On the next send, the
AI SDK validates all messages and rejects the empty-parts message with
"Message must contain at least one part". This filters them out when not
streaming and adds a safety guard in formatConversationHistory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: filter empty-parts messages before persisting to storage

Addresses race condition where the save effect could persist messages
with empty parts before the cleanup effect's state update applies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:20:36 -08:00
..
2026-01-30 23:33:57 +05:30