Fix first chat response transport#5778
Merged
Merged
Conversation
✅ Deploy Preview for old-char canceled.
|
b3f3360 to
d8c567d
Compare
d8c567d to
7c48495
Compare
7c48495 to
2ec9ccf
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2ec9ccf. Configure here.
Recreate chat sessions when transport becomes ready and persist first-send responses against the newly created chat group.
2ec9ccf to
7d7b284
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Recreate chat sessions when transport becomes ready and persist first-send responses against the newly created chat group.
Note
Medium Risk
Touches core chat persistence, SDK lifecycle, and message sync; regressions could lose messages, show stale UI, or attach replies to the wrong group.
Overview
Fixes chat sessions that started before the model transport was ready, and assistant rows that were saved under the wrong group when the first message created a new chat group.
ChatSessionnow builds an AI SDKChatinstance (recreated whentransportchanges) and wiresuseChat({ chat }), with a stub transport until the model is ready.sendMessageaccepts optional{ chatGroupId }; that id (or the user row’s persistedchat_group_id) is used inonFinishso assistant replies land on the correct group, including overlapping in-flight sends. When status isready, persisted TinyBase messages sync into the SDK without clobbering streaming UI state.handleSendMessagepasses the group id used when creating a group on first send.Types in
ChatContentand expandedsession-providertests document the new behavior.Reviewed by Cursor Bugbot for commit 7d7b284. Bugbot is set up for automated code reviews on this repo. Configure here.