Fix Duplicate task execution after network reconnection#1214
Merged
bytecii merged 4 commits intoeigent-ai:mainfrom Feb 12, 2026
Merged
Fix Duplicate task execution after network reconnection#1214bytecii merged 4 commits intoeigent-ai:mainfrom
bytecii merged 4 commits intoeigent-ai:mainfrom
Conversation
Contributor
Author
|
@Wendong-Fan @4pmtong Could you please review my PR? |
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.
Description
Fixes duplicate task execution when the SSE connection is lost and then restored (e.g. network reconnect, Wi‑Fi disconnect/reconnect, or system sleep/wake). Previously,
fetch-event-sourcewould retry on connection errors even when the task had already finished, which could re-run the same task.What changed
chatStore.ts, the SSEonerrorhandler now checks if the task status isFINISHEDbefore allowing a retry. If the task is already finished, it logs that retry is being stopped to avoid duplicate execution, cleans up the connection, and throws sofetch-event-sourcedoes not retry.chatStore.test.ts: "SSE onerror - no retry when task already finished (issue [Feature Request] Duplicate task execution after network reconnection and system wake-up #1212)" to ensurefetchEventSourceis only called once and the "already finished, stopping retry" path is exercised when the task isFINISHEDand an error occurs.Verification
npm run test -- --run test/unit/store/chatStore.test.ts -t "issue #1212"Closes #1212
What is the purpose of this pull request?