Skip to content

Commit c7106bf

Browse files
bug(fix): Make bell notifications only for final response and untrusted tools (#1251)
Improve user experience by only playing bell notifications when necessary: - Play bell for final responses (no tools suggested) - Play bell for tools that require confirmation - Skip bell for trusted tools that don't require confirmation 🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer) Co-authored-by: Sai Srinivas S <[email protected]>
1 parent 194fd10 commit c7106bf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

crates/q_cli/src/cli/chat/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,6 +2076,10 @@ where
20762076
!tool.tool.requires_acceptance(&self.ctx)
20772077
};
20782078

2079+
if self.settings.get_bool_or("chat.enableNotifications", false) {
2080+
play_notification_bell(!allowed);
2081+
}
2082+
20792083
self.print_tool_description(tool, allowed).await?;
20802084

20812085
if allowed {
@@ -2389,7 +2393,8 @@ where
23892393
}
23902394

23912395
if self.interactive && self.settings.get_bool_or("chat.enableNotifications", false) {
2392-
play_notification_bell();
2396+
// For final responses (no tools suggested), always play the bell
2397+
play_notification_bell(tool_uses.is_empty());
23932398
}
23942399

23952400
// Handle citations for non-summarization responses

crates/q_cli/src/util/spinner.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ pub enum SpinnerComponent {
5353
}
5454

5555
/// Play the terminal bell notification sound
56-
/// This is a separate function to make it easier to call from multiple places
57-
pub fn play_notification_bell() {
56+
pub fn play_notification_bell(requires_confirmation: bool) {
57+
// Don't play bell for tools that don't require confirmation
58+
if !requires_confirmation {
59+
return;
60+
}
61+
5862
// Check if we should play the bell based on terminal type
5963
if should_play_bell() {
6064
print!("\x07"); // ASCII bell character

0 commit comments

Comments
 (0)