-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: prevent completion sound from replaying when reopening completed tasks (#4885) #5249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent completion sound from replaying when reopening completed tasks (#4885) #5249
Conversation
|
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. |
3b83ea9 to
adaefdf
Compare
SannidhyaSah
left a comment
There was a problem hiding this 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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
LGTM
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
completionSoundPlayedflag 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 optionalcompletionSoundPlayed?: booleanfield toHistoryItemtypewebview-ui/src/components/chat/ChatView.tsx: Modified to check the flag before playing completion sound and prevent sound on task resumptionsrc/core/task/Task.ts: Updated to persist thecompletionSoundPlayedflag when saving task statewebview-ui/src/components/chat/__tests__/ChatView.spec.tsx: Updated tests to match the new behaviorTesting Performed
Behavior
This change improves the user experience by making the completion sound more meaningful and less intrusive.
Important
Adds
completionSoundPlayedflag to prevent replaying completion sound on reopening completed tasks.completionSoundPlayedflag toHistoryIteminhistory.tsto track if completion sound has been played.ChatView.tsx, checkscompletionSoundPlayedbefore playing sound for task completion.Task.ts, setscompletionSoundPlayedtotruewhen a task is completed.ChatView.spec.tsxto test new behavior, ensuring sound plays only once per task completion.completionSoundPlayedistrue.This description was created by
for 3b83ea9. You can customize this summary. It will automatically update as commits are pushed.