Skip to content

Conversation

@afarber
Copy link
Contributor

@afarber afarber commented Dec 9, 2025

Summary

Adds an optional terminal bell notification (\x07) that plays when:

  • A response completes
  • The system awaits tool approval

The general.terminalBell setting is enabled by default and can be disabled in settings. Only triggers in TTY environments.

Details

Writes \x07 (BEL character) to stderr when:

  1. A response finishes (in the submitQuery finally block)
  2. Waiting for tool approval (streamingState becomes WaitingForConfirmation)

Uses Ink's useStdout() hook rather than process.stdout to bypass patchStdio() which redirects stdout writes to event emitters.

Users who find it annoying can disable with general.terminalBell: false in settings.

Related Issues

Closes #14643
Partially fixes #14696

How to Validate

  1. First check your terminal supports bell: echo -e "\a" (should beep)
  2. Run gemini and submit any query - bell should sound when response completes
  3. Trigger a tool that needs approval (e.g. file edit) - bell should sound when waiting
  4. Set general.terminalBell: false in settings, repeat steps 2-3, no bell should sound
  5. Pipe output somewhere (gemini --help | cat) - no bell (TTY check)

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@afarber afarber requested review from a team as code owners December 9, 2025 11:12
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @afarber, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience of the CLI by adding an optional audible terminal bell notification. This feature provides immediate feedback to users when a long-running operation, such as receiving a response or requiring tool approval, has completed, ensuring they are promptly alerted without needing to constantly monitor the terminal. The implementation includes a new configurable setting and safeguards to only activate in interactive sessions.

Highlights

  • New Feature: Terminal Bell Notification: Introduced a new general.terminalBell setting, enabled by default, that triggers an audible terminal bell. This notification sounds when a response from the CLI completes or when the system is awaiting user approval for a tool action.
  • Conditional Activation: The terminal bell notification is designed to only activate in interactive terminal environments (TTYs), preventing unintended sounds in non-interactive contexts like piped output.
  • User Configurability: Users can easily disable the terminal bell feature by setting general.terminalBell: false in their configuration settings, providing control over their notification preferences.
  • Dependency Updates: Several peer dependency flags were added or removed in package-lock.json for various packages, indicating a dependency management update.
  • Comprehensive Testing: New test cases have been added to ensure the terminal bell functionality works as expected, covering scenarios where the setting is enabled, disabled, and when the terminal is not a TTY.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful terminal bell notification feature, which is a nice addition for user experience. The implementation looks solid, adding a new setting and integrating the bell logic at the two key points: response completion and tool approval waiting. However, the test suite for this new feature is incomplete. While there are good tests for the tool approval scenario, tests for the response completion scenario are missing. I've added a comment to address this.

@afarber afarber force-pushed the 14643-audio-notification branch 2 times, most recently from bd4633e to 8b49d07 Compare December 9, 2025 11:27
@afarber
Copy link
Contributor Author

afarber commented Dec 9, 2025

@gemini-code-assist review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a terminal bell notification for response completion and tool approval, controlled by a new setting. The implementation is well-structured and includes comprehensive tests. I've identified one potential robustness issue where writing to stdout could cause an unhandled error during application shutdown. I've suggested a fix to handle this gracefully.

@afarber afarber force-pushed the 14643-audio-notification branch from 48683ca to 7715df3 Compare December 9, 2025 13:09
@afarber
Copy link
Contributor Author

afarber commented Dec 9, 2025

Smoke tested with Ubuntu 26.01 and macOS 26.1 (I can hear the bell after issuing the following prompt "Run 'git diff upstream/main...HEAD' and summarize the ongoing PR for me"):

image

@Alexmarco-gif
Copy link

@afarber how is it going i was also trying to do this, but you are already working on it. Just wanted to know how it is going

@afarber
Copy link
Contributor Author

afarber commented Dec 10, 2025

Hi, my implementation is complete, tested on my Ubuntu and Macbook Air computers and now just waiting for the merge by @jackwotherspoon or his colleagues

@afarber afarber force-pushed the 14643-audio-notification branch from 7715df3 to 2a10f79 Compare December 10, 2025 13:46
@jackwotherspoon
Copy link
Collaborator

Our hooks implementation is in preview (behind a feature flag), I always envisioned us implementing a robust notifications system (bell noise, visual notification, customizing when they happen, etc) that users can fully customize through the hooks system.

So I am a little torn if this PR makes sense with that being said. Maybe you would like to start on the notification system? We probably need to look at an open issue and work on a design approach together.

@afarber
Copy link
Contributor Author

afarber commented Dec 10, 2025

Thanks for the feedback @jackwotherspoon!

For audio notifications via hooks, would users configure something like this in ~/.gemini/settings.json?

  {
    "tools": {
      "enableHooks": true,
      "enableMessageBusIntegration": true
    },
    "hooks": {
      "Notification": [{
        "matcher": "ToolPermission",
        "hooks": [{
          "type": "command",
          "command": "node my-audio-notification-script.js"
        }]
      }]
    }
  }

The hooks approach is very flexible, but I see a few trade-offs compared to this PR's simple terminal bell:

  1. "\x07" requires no additional packages
  2. Works on macOS, Linux, Windows without users writing platform-specific scripts
  3. The terminal bell lets users configure their preferred notification style in their terminal emulator - audio beep, visual flash, tab badge, or any combination. The app just sends the signal; the terminal respects user preferences (see macOS settings screenshot below)

Would it make sense to have both?

  • A simple built-in general.terminalBell option (this PR) for users who want zero-config audio/visual feedback
  • The hooks system for users who want customizable desktop notifications (via https://github.com/mikaelbr/node-notifier?) or other advanced behaviors
image

@Alexmarco-gif
Copy link

@jackwotherspoon i likewhat you guy are doing, am i want to be part of it, so dont know if there is anything i can add, if you would permit

@afarber afarber force-pushed the 14643-audio-notification branch from 2a10f79 to db19fe9 Compare December 15, 2025 16:02
@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality labels Jan 7, 2026
@afarber afarber force-pushed the 14643-audio-notification branch from db19fe9 to ebf2dfc Compare January 10, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Desktop Notification for User Permission Prompts Please add ability to have an Audio Notification whenever the chat replies

3 participants