Skip to content

fix: load final state on project entry; replay only on Replay button (Issue #1227)#1234

Open
spider-yamet wants to merge 18 commits intoeigent-ai:mainfrom
spider-yamet:feature/Task-should-not-auto-replay
Open

fix: load final state on project entry; replay only on Replay button (Issue #1227)#1234
spider-yamet wants to merge 18 commits intoeigent-ai:mainfrom
spider-yamet:feature/Task-should-not-auto-replay

Conversation

@spider-yamet
Copy link
Contributor

@spider-yamet spider-yamet commented Feb 11, 2026

Summary

Tasks no longer auto-replay when entering a project. The UI shows the final state immediately on entry and replays only when the user clicks the Replay button.

Changes

Load vs Replay behavior

  • Load (project entry): Loads final state with no animation, waits for completion, then navigates.
  • Replay (Replay button): Replays with animation and navigates immediately.

Implementation

  • src/lib/replay.ts: Added loadProjectFromHistory() for loading final state; replayProject() / replayActiveTask() for Replay button.
  • src/store/projectStore.ts: Added loadProjectFromHistory (delay 0, no animation); replayProject uses delay 0.2 for animation.
  • src/store/chatStore.ts: Replay flow waits for SSE stream to finish before resolving so load can complete before navigation.
  • Entry points use loadProjectFromHistory when opening a project: ProjectGroup, HistorySidebar, SearchHistoryDialog, Project.tsx, ProjectDialog.
  • ChatBox Replay button still uses replayActiveTaskreplayProject.

Closes #1227

@spider-yamet
Copy link
Contributor Author

spider-yamet commented Feb 11, 2026

Untitled.3.mp4

now it is no longer refresh whenever switch the project, just relying the refresh on refresh button

@spider-yamet
Copy link
Contributor Author

@Wendong-Fan @bytecii @Pakchoioioi @4pmtong Please review my PR.
Regards

);

for (let index = 0; index < taskIds.length; index++) {
const taskId = taskIds[index];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we check whether current active project id is still the loadProjectId? If not we should cancel the loading?

Same for the function in replayProject

for (let index = 0; index < taskIds.length; index++) {
        const taskId = taskIds[index];
        console.log(
          `[ProjectStore] Creating replay for task ${index + 1}/${taskIds.length}: ${taskId}`
        );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bytecii I updated by following your comment, you can check on current PR.

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.

Also can we add some unit tests for the replay? Thanks.

try {
await ssePromise;
} catch {
// Stream completed (aborted) or error - expected when load completes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Improve this such as?

if (type === 'replay') {
  try {
    await ssePromise;
  } catch (err) {
    if (err instanceof DOMException && err.name === 'AbortError') {
      // Expected: stream closed normally, we aborted to resolve the promise
      return;
    }
    // Unexpected: actual error during stream
    console.error(`SSE stream failed for task ${newTaskId}:`, err);
    throw err; // Let loadProjectFromHistory handle it
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bytecii I improved try catch clause for exception handling by following your comment.

@spider-yamet
Copy link
Contributor Author

spider-yamet commented Feb 13, 2026

@bytecii I updated the code logics and added test cases by following your comment. Please review my PR.

All the test cases are passing now.

@spider-yamet
Copy link
Contributor Author

spider-yamet commented Feb 13, 2026

@bytecii @Wendong-Fan could you please review the PR?

Regards

@spider-yamet
Copy link
Contributor Author

@Wendong-Fan @bytecii Could you please check PR status?

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] Task should not auto-replay upon entering project

2 participants