Skip to content

Fix Duplicate task execution after network reconnection#1214

Merged
bytecii merged 4 commits intoeigent-ai:mainfrom
spider-yamet:feat/duplicate-task-execution
Feb 12, 2026
Merged

Fix Duplicate task execution after network reconnection#1214
bytecii merged 4 commits intoeigent-ai:mainfrom
spider-yamet:feat/duplicate-task-execution

Conversation

@spider-yamet
Copy link
Contributor

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-source would retry on connection errors even when the task had already finished, which could re-run the same task.

What changed

  • In chatStore.ts, the SSE onerror handler now checks if the task status is FINISHED before 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 so fetch-event-source does not retry.
  • Added a unit test in 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 ensure fetchEventSource is only called once and the "already finished, stopping retry" path is exercised when the task is FINISHED and an error occurs.

Verification

  • Run: npm run test -- --run test/unit/store/chatStore.test.ts -t "issue #1212"

Closes #1212

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Copy link
Collaborator

@bytecii bytecii left a comment

Choose a reason for hiding this comment

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

Thanks, in general LGTM. We can merge if @4pmtong thinks it's good to be merged

@spider-yamet
Copy link
Contributor Author

@Wendong-Fan @4pmtong Could you please review my PR?

@bytecii bytecii merged commit 05c0bdb into eigent-ai:main Feb 12, 2026
7 checks passed
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.

[Feature Request] Duplicate task execution after network reconnection and system wake-up

2 participants