Skip to content

Conversation

@SannidhyaSah
Copy link
Collaborator

@SannidhyaSah SannidhyaSah commented Jun 30, 2025

Fixes #4885

Problem

The completion notification sound was playing every time a user reopened an already completed task, which created a poor user experience and made the sound notification less meaningful.

Solution

Implemented a completionSoundPlayed flag to track whether the completion sound has already been played for a task, preventing it from replaying when the task is reopened.

Changes Made

  • packages/types/src/history.ts: Added optional completionSoundPlayed?: boolean field to HistoryItem type
  • webview-ui/src/components/chat/ChatView.tsx: Modified to check the flag before playing completion sound and prevent sound on task resumption
  • src/core/task/Task.ts: Updated to persist the completionSoundPlayed flag when saving task state
  • webview-ui/src/components/chat/__tests__/ChatView.spec.tsx: Updated tests to match the new behavior

Testing Performed

  • ✅ All existing tests pass
  • ✅ New test coverage for the completion sound flag behavior
  • ✅ Manual testing confirmed sound only plays once per task completion
  • ✅ Linting and type checking pass

Behavior

  • Before: Completion sound played every time a completed task was reopened
  • After: Completion sound plays only once when a task is actually completed, not when reopening

This change improves the user experience by making the completion sound more meaningful and less intrusive.


Important

Adds completionSoundPlayed flag to prevent replaying completion sound on reopening completed tasks.

  • Behavior:
    • Adds completionSoundPlayed flag to HistoryItem in history.ts to track if completion sound has been played.
    • In ChatView.tsx, checks completionSoundPlayed before playing sound for task completion.
    • In Task.ts, sets completionSoundPlayed to true when a task is completed.
  • Testing:
    • Updates ChatView.spec.tsx to test new behavior, ensuring sound plays only once per task completion.
    • Confirms no sound on task resumption if completionSoundPlayed is true.

This description was created by Ellipsis for 3b83ea9. You can customize this summary. It will automatically update as commits are pushed.

@SannidhyaSah SannidhyaSah requested review from cte, jr and mrubens as code owners June 30, 2025 07:01
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jun 30, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 30, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 30, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 30, 2025
@daniel-lxs
Copy link
Member

Hey I took a look at the PR and I think there's an easier way to fix this. Instead of adding the completionSoundPlayed flag and tracking state, we can just remove the sounds from the resume cases entirely.

The core issue is that sounds shouldn't play when reopening tasks from history, whether they're completed or not. So instead of tracking whether we already played a sound, we can just prevent sounds from playing on resume.

Specifically, remove the celebration sound from the resume_completed_task case and the notification sound from the resume_task case in ChatView.tsx. Keep the sounds only for when tasks actually complete.

This approach is simpler and addresses the root cause directly without needing to track additional state.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 30, 2025
@SannidhyaSah SannidhyaSah force-pushed the fix/4885-completion-sound-replay branch from 3b83ea9 to adaefdf Compare July 1, 2025 07:44
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 1, 2025
Copy link
Collaborator Author

@SannidhyaSah SannidhyaSah left a comment

Choose a reason for hiding this comment

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

The PR has been updated to resolve this issue. The fix was implemented by removing the playSound calls from the resume_task and resume_completed_task cases in webview-ui/src/components/chat/ChatView.tsx. This prevents the completion sound from replaying when a task is reopened from history, which provides a cleaner solution than tracking the sound's played state.

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jul 1, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Thank you!

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 1, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 1, 2025
@mrubens mrubens merged commit e4b051b into RooCodeInc:main Jul 3, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 3, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 3, 2025
@SannidhyaSah SannidhyaSah deleted the fix/4885-completion-sound-replay branch July 12, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Completion notification sound plays when reopening already completed tasks

4 participants