Repository navigation
fix: resume analysis streams after chat disconnects - #104
Merged
Merged
Conversation
hustcc
force-pushed
the
fix/chat-stream-reconnect
branch
from
November 25, 2026 14:01
18e24c8 to
0ae7e4b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Snapshot replay can duplicate live text chunks, and reader cancellation clears the running indicator and stops completion tracking while analysis continues in the background.
2 open issues
What changed in this PR
This PR lets chats reconnect to ongoing analysis without cancelling background work, supporting the session-switching workflow tracked in #45.
Changes:
- Buffer analysis chunks and expose snapshots through a new reconnect API.
- Replay buffered chunks and resume live streaming after loading chat history.
- Keep analysis running when a renderer stream disconnects.
| File | Description |
|---|---|
src/shared/api.ts |
Defines the stream snapshot type and reconnect API. |
src/renderer/components/chat/ipc-chat-transport.ts |
Adds snapshot replay and live reconnection; removes cancellation on disconnect. |
src/renderer/components/chat/chat.tsx |
Attempts stream recovery after loading conversation history. |
src/preload/index.ts |
Exposes reconnect through the typed IPC bridge. |
src/main/services/analysis/index.ts |
Buffers active-task chunks and provides reconnect snapshots. |
src/main/ipc/index.ts |
Handles reconnect requests and forwards stream events. |
Review effort: Balanced
Contributor
|
@hustcc 发送和重连的 IPC 订阅应该还能共用一套逻辑,简化一些,也能防止两路同时存在会有重复chunk的问题。合适的话我补个commit到这个 pr。 |
yvonneyx
approved these changes
Nov 26, 2026
Member
Author
|
@yvonneyx transport 中新增 commit 的改动还是把 getMessage 和 reconnect 耦合在一起了,看看是否必要,没有必要就不去耦合了。 |
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.


AVAv4. #45