Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR fixes a streaming regression in the Mothership copilot chat by introducing server-side stream serialization ( Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Route as mothership/chat/route.ts
participant Streaming as chat-streaming.ts
participant Go as Go Backend
Note over Client,Go: Happy path — no prior stream
Client->>Route: POST /api/mothership/chat (chatId)
Route->>Streaming: waitForPendingChatStream(chatId)
Streaming-->>Route: (no entry — returns immediately)
Route->>Streaming: createSSEStream(chatId, streamId)
Streaming->>Streaming: registerPendingChatStream(chatId, streamId)
Streaming->>Go: orchestrateCopilotStream(...)
Go-->>Client: SSE events
Streaming->>Streaming: finally → resolvePendingChatStream(chatId)
Note over Client,Go: Stop & retry — previous stream still in-flight
Client->>Route: POST /api/mothership/chat (same chatId)
Route->>Streaming: waitForPendingChatStream(chatId)
Streaming->>Streaming: abortActiveStream(prevStreamId)
Streaming-->>Route: await promise (previous stream settles)
Note over Streaming: previous finally block runs → resolve()
Route->>Streaming: createSSEStream(chatId, newStreamId)
Streaming->>Streaming: registerPendingChatStream(chatId, newStreamId)
Streaming->>Go: orchestrateCopilotStream(...)
Go-->>Client: SSE events
Note over Client,Streaming: Client-side stop
Client->>Client: stopGeneration()
Client->>Client: busy-wait until chatIdRef set (≤3 s)
Client->>Route: POST /api/copilot/chat/abort {streamId}
Route->>Streaming: abortActiveStream(streamId)
Last reviewed commit: c0a4471 |
ba5b490 to
5acc229
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.
Summary
Fix mothership stream management
Type of Change
Testing
Tested with @icecrasher321 @TheodoreSpeaks
Checklist