-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(session-notification): add question tool sound and skip background completion sound #1455
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
base: dev
Are you sure you want to change the base?
feat(session-notification): add question tool sound and skip background completion sound #1455
Conversation
…nd completion sound - Add playSoundOnQuestion config option (default: true) to play notification when AI uses question tool requiring user input - Add skipSoundOnBackgroundCompletion config option (default: true) to prevent notification sound when background tasks complete - Track background completion via message.part.updated event detecting '[BACKGROUND TASK' or '[ALL BACKGROUND TASKS COMPLETE]' markers - Only play question notification for main sessions (not subagents) Closes code-yeongyu#1453
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA). To sign the CLA, please comment on this PR with: This is a one-time requirement. Once signed, all your future contributions will be automatically accepted. I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
1 issue found across 1 file
Confidence score: 4/5
backgroundCompletionTriggeredIdleinsrc/hooks/session-notification.tsis never cleared on user activity/cancelled notifications, which can suppress sound on later normal idle notifications- Overall risk is low since this is a localized state-handling issue with limited scope, but it could affect notification behavior
- Pay close attention to
src/hooks/session-notification.ts- ensure the background marker is reset appropriately
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/hooks/session-notification.ts">
<violation number="1" location="src/hooks/session-notification.ts:339">
P2: backgroundCompletionTriggeredIdle is never cleared on user activity/cancelled notifications, so a background marker can suppress sound on later normal idle notifications.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| if (sessionID && partType === "text" && text) { | ||
| if (text.includes("[BACKGROUND TASK") || text.includes("[ALL BACKGROUND TASKS COMPLETE]")) { | ||
| backgroundCompletionTriggeredIdle.add(sessionID) |
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.
P2: backgroundCompletionTriggeredIdle is never cleared on user activity/cancelled notifications, so a background marker can suppress sound on later normal idle notifications.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/hooks/session-notification.ts, line 339:
<comment>backgroundCompletionTriggeredIdle is never cleared on user activity/cancelled notifications, so a background marker can suppress sound on later normal idle notifications.</comment>
<file context>
@@ -315,7 +328,39 @@ export function createSessionNotification(
+
+ if (sessionID && partType === "text" && text) {
+ if (text.includes("[BACKGROUND TASK") || text.includes("[ALL BACKGROUND TASKS COMPLETE]")) {
+ backgroundCompletionTriggeredIdle.add(sessionID)
+ }
+ }
</file context>
|
Thanks for the review! However, this appears to be a false positive. Looking at lines 262-264: const shouldSkipSound = mergedConfig.skipSoundOnBackgroundCompletion &&
backgroundCompletionTriggeredIdle.has(sessionID)
backgroundCompletionTriggeredIdle.delete(sessionID) // ← Cleared immediately after checkThe flow is:
Additionally, line 379 provides cleanup on session stop: backgroundCompletionTriggeredIdle.delete(sessionInfo.id)The marker is always cleared in one of two ways:
There's no scenario where the marker persists to suppress later normal idle notifications. |
Summary
Changes
playSoundOnQuestionconfig option (default:true) - plays notification when question tool awaits user inputskipSoundOnBackgroundCompletionconfig option (default:true) - prevents notification when background tasks completemessage.part.updatedevent detecting[BACKGROUND TASKor[ALL BACKGROUND TASKS COMPLETE]markersWhy
Testing
Closes #1453
Summary by cubic
Adds a sound when the question tool asks for user input and skips sounds when background/subagent tasks finish. Reduces noise while making prompts harder to miss. Addresses #1453.
Written for commit 57a5346. Summary will update on new commits.