Skip to content

Fix first chat response transport#5778

Merged
ComputelessComputer merged 1 commit into
mainfrom
fix/chat-first-response-transport
Jun 26, 2026
Merged

Fix first chat response transport#5778
ComputelessComputer merged 1 commit into
mainfrom
fix/chat-first-response-transport

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

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.

ChatSession now builds an AI SDK Chat instance (recreated when transport changes) and wires useChat({ chat }), with a stub transport until the model is ready. sendMessage accepts optional { chatGroupId }; that id (or the user row’s persisted chat_group_id) is used in onFinish so assistant replies land on the correct group, including overlapping in-flight sends. When status is ready, persisted TinyBase messages sync into the SDK without clobbering streaming UI state. handleSendMessage passes the group id used when creating a group on first send.

Types in ChatContent and expanded session-provider tests document the new behavior.

Reviewed by Cursor Bugbot for commit 7d7b284. Bugbot is set up for automated code reviews on this repo. Configure here.

@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for old-char canceled.

Name Link
🔨 Latest commit 7d7b284
🔍 Latest deploy log https://app.netlify.com/projects/old-char/deploys/6a3e555064800b0008618074

Comment thread apps/desktop/src/chat/components/session-provider.tsx Outdated
@ComputelessComputer ComputelessComputer force-pushed the fix/chat-first-response-transport branch from b3f3360 to d8c567d Compare June 26, 2026 09:23
Comment thread apps/desktop/src/chat/components/session-provider.tsx
@ComputelessComputer ComputelessComputer force-pushed the fix/chat-first-response-transport branch from d8c567d to 7c48495 Compare June 26, 2026 10:02
Comment thread apps/desktop/src/chat/components/session-provider.tsx Outdated
@ComputelessComputer ComputelessComputer force-pushed the fix/chat-first-response-transport branch from 7c48495 to 2ec9ccf Compare June 26, 2026 10:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Fix All in Cursor

❌ 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.

Comment thread apps/desktop/src/chat/components/session-provider.tsx
Recreate chat sessions when transport becomes ready and persist first-send responses against the newly created chat group.
@ComputelessComputer ComputelessComputer force-pushed the fix/chat-first-response-transport branch from 2ec9ccf to 7d7b284 Compare June 26, 2026 10:32
@ComputelessComputer ComputelessComputer merged commit a3a9f65 into main Jun 26, 2026
10 checks passed
@ComputelessComputer ComputelessComputer deleted the fix/chat-first-response-transport branch June 26, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant