fix(mothership): chat stream structuring + logs resource post fix#4189
fix(mothership): chat stream structuring + logs resource post fix#4189icecrasher321 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The home Stopping a chat stream now always clears Reviewed by Cursor Bugbot for commit c956577. Configure here. |
Greptile SummaryThis PR fixes two related chat streaming bugs: (1) when a chat is active, the API now returns an effective transcript that splices the live Redis-backed stream snapshot into the persisted message list via A significant client-side refactor moves streaming updates from a local Confidence Score: 5/5Safe to merge — no P0/P1 issues found across any changed file. All findings are P2 or lower. The core logic in buildEffectiveChatTranscript, the stop-route cancelled-block synthesis, and the React Query cache migration are all verifiably correct after tracing through normalizeMessage. New test files provide solid coverage for the new modules. The handleTaskStatusEvent narrowing (list-only, workspace-scoped) is safe because the workspaceId guard in useTaskEvents ensures the function is always called with a defined string. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Client (useChat)
participant RQ as React Query Cache
participant API as API Route
participant Redis as Redis (stream snapshot)
participant DB as Database
C->>RQ: cancelQueries(detail)
C->>RQ: upsertTaskChatHistory (optimistic user + assistant)
C->>API: POST /api/mothership/chat (send message)
API-->>C: SSE stream begins
loop During streaming
C->>RQ: upsertTaskChatHistory (flush: update assistant snapshot)
end
API->>Redis: write stream events
API->>DB: persist final messages
API-->>C: stream complete
C->>C: finalize() → invalidateChatQueries
C->>API: GET /api/mothership/chats/{chatId}
API->>DB: fetch chat + conversationId
API->>Redis: fetch streamSnapshot
API->>API: buildEffectiveChatTranscript(messages, snapshot)
API-->>C: effective transcript (persisted + live tail)
C->>RQ: update cache with server response
Note over C,RQ: SSE task_status → only list key invalidated (not detail)
Reviews (2): Last reviewed commit: "address comments" | Re-trigger Greptile |
|
bugbot run |
|
@greptile |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c956577. Configure here.
Summary
Clean up chat streaming order of ops to make react query client refetch redis first when conversation active. Also logs resource when open left chat hanging.
Type of Change
Testing
Tested manually
Checklist