release: persist assistant message per step (#603)
Merged
SW
5mo ago+251+251+012345678901234567890123456789-283-283-012345678901234567890123456789
Summary
Promotes `test` to `main`. Contains the squashed PR:
- #603 — `feat(chat-workflow): persist assistant message per step`. Moves assistant message persistence from the workflow body into `runAgentStep` via `createUIMessageStream`'s `onStepFinish` + `onFinish` callbacks. Adds `update` option to `upsertChatMessage` for DO UPDATE on conflict. Verified end-to-end on preview — assistant row `QquxcYrQjN90QRWr` persists into `chat_messages` with full metadata.
Test plan
- PR #603 CI green (format, lint, test, Vercel, CodeRabbit)
- PR #603 end-to-end verified on preview via `GET /api/sessions/{sid}/chats/{cid}`
- Watch Vercel production deploy after merge
Summary by cubic
Persist the assistant message on every step of the chat workflow so partial replies are saved and survive refreshes. Moves persistence into the step stream and makes writes idempotent via DO UPDATE.
- New Features
- Stream through
createUIMessageStreamand persist ononStepFinishandonFinish; uses a stableassistantMessageIdfor one row per turn. persistAssistantMessagenow overwrites the row as it grows and bumpsupdated_atandlast_assistant_message_aton every persist (partials show as unread).upsertChatMessageadds{ update: true }to enable DO UPDATE (setsignoreDuplicates: false).runAgentStepacceptschatIdand handles per-step persistence;runAgentWorkflowdrops its own persist call and still uses the final message for credits.- Tests updated to cover the new streaming, persistence, and upsert behavior.
- Stream through