Skip to content

Conversation

@NaccOll
Copy link
Contributor

@NaccOll NaccOll commented Aug 12, 2025

Related GitHub Issue

Closes: #5015 (comment)

Roo Code Task Context (Optional)

Description

Implementing system notifications similar to Kilo. But it is triggered only when vscode is not the focused window.

Currently, different system notifications are displayed to users for errors, pending user approval, and task completion.

However, user customization of issues, priority levels, and the ability to directly complete actions when prompted by system notifications are not yet implemented.

Test Procedure

  1. Enable System Notifications in setting
  2. chat and trigger tool use
  3. system notification will display

You can try all scene with sound effects occur

  • api_req_failed
  • mistake_limit_reached
  • followup
  • tool
  • browser_action_launch
  • command
  • use_mcp_server
  • completion_result

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

image

Documentation Updates

Additional Notes

Get in Touch


Important

Adds system notifications for various events with platform-specific logic and UI settings, enabling users to receive alerts for important actions.

  • Behavior:
    • Adds system notifications for events like API request failures, mistake limits, follow-ups, tool requests, browser actions, commands, MCP server usage, and task completions.
    • Notifications can be enabled/disabled via systemNotificationsEnabled in global-settings.ts and ClineProvider.ts.
    • showSystemNotification() function in showSystemNotification.ts handles notification display with debounce.
  • UI Components:
    • Updates NotificationSettings.tsx to include system notification settings and test button.
    • ChatView.tsx triggers notifications for specific events.
  • Platform Support:
    • Implements platform-specific notification logic in notifications/index.ts for macOS, Windows, and Linux.
  • Localization:
    • Adds system notification strings to multiple locale files including settings.json for various languages.

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

@NaccOll NaccOll requested review from cte, jr and mrubens as code owners August 12, 2025 06:43
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Aug 12, 2025
Copy link
Contributor

@roomote roomote bot 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 for your contribution! I've reviewed the system notification implementation and found several issues that need attention before this can be merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing error handling feedback to users. When notifications fail, users have no way to know. Consider implementing a fallback mechanism:

Suggested change
console.error("Could not show system notification", error)
} catch (error) {
console.error("Could not show system notification", error);
// Fallback to VSCode's built-in notification
vscode.window.showInformationMessage(options.message);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The Windows implementation hardcodes "Roo Code" which might not work correctly in all configurations. Could we make this configurable or detect the actual application name?

Copy link
Contributor

Choose a reason for hiding this comment

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

The 100ms debounce is hardcoded. Would it be beneficial to make this configurable for different use cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

The NotificationOptions interface is quite basic. Based on the issue requirements, shouldn't it support priority levels and action buttons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not supported yet

Copy link
Contributor

Choose a reason for hiding this comment

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

Good integration with the chat events! However, consider adding test coverage for these notification triggers to ensure they work correctly across different scenarios.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 12, 2025
@NaccOll NaccOll mentioned this pull request Aug 12, 2025
4 tasks
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 12, 2025
@mrubens
Copy link
Collaborator

mrubens commented Aug 12, 2025

I like the idea of this a lot! I'm trying on my Mac though and the test system notification isn't working. Any ideas?

@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 12, 2025

@mrubens I need to confirm whether the click test on the settings page works.

Unlike Kilo, my commits don't display notifications when the VSCode window is focused. This is because I'm using the secondary sidebar, and the system notifications obscure my send message button.

@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 12, 2025

@mrubens

I tested it on my Mac Mini, but I still couldn't get notifications, and Kilo's notification feature didn't work either.

The reason is that the following script no longer works on macOS:

osascript -e 'display notification "hello" with title "word" sound name "Frog" '

If I change it to:

osascript -e 'display alert "hello" message "world"'

Then I can call the alert function.
image

@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 12, 2025

@mrubens After more detailed testing, it is found that notifications can only be displayed when the script editor is allowed to notify and the user is not in do not disturb mode. This should be a limitation of macOS itself.

QQ_1755012191970

@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 12, 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 for implementing system notifications! I've reviewed the changes and found some issues that need attention before merging.

Copy link
Member

Choose a reason for hiding this comment

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

Is the 100ms debounce intentional? This could cause distinct notifications to be dropped if they occur within the same window. For example, if both a "tool request" and "command" notification trigger within 100ms, only the last one will be shown.

Consider using throttling instead of debouncing, or implementing message-based deduplication to avoid losing important notifications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This design is inspired by Kilo. Switching to throttling is indeed more reasonable, as it helps send notifications faster. However, I need to introduce throttle-debounce as a dependency—is that acceptable?

Additionally, the two different types of notifications you described are unlikely to trigger within 100 milliseconds.
This is because notifications are limited to completion, failure, and waiting for user input—these three scenarios are unlikely to occur within 100 ms. Moreover, unlike Kilo, my notification requires VS Code not to be the currently focused window in order to trigger.

Copy link
Member

Choose a reason for hiding this comment

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

In that case I think we can keep it like this unless we get reports of it causing issues

Copy link
Member

Choose a reason for hiding this comment

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

The Linux implementation assumes notify-send is available but doesn't handle the case where it's not installed. Consider checking for the binary first or providing a helpful error message:

Suggested change
throw new Error(`Failed to show Linux notification: ${error}`)
} catch (error: any) {
if (error.code === 'ENOENT') {
throw new Error('notify-send is not installed. Please install libnotify-bin (apt install libnotify-bin on Debian/Ubuntu)')
}
throw new Error(`Failed to show Linux notification: ${error}`)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Aug 18, 2025
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Aug 18, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Aug 18, 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 @NaccOll!

@NaccOll NaccOll force-pushed the feature-system-notification branch from 032c82b to 814040a Compare August 25, 2025 00:46
@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Needs Prelim Review] in Roo Code Roadmap Aug 25, 2025
@mrubens
Copy link
Collaborator

mrubens commented Aug 25, 2025

I still can't get this to work on Mac. I like the idea of system notifications but I think we have to make it more obvious to people how to set it up, otherwise it just seems broken.

@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 25, 2025

I still can't get this to work on Mac. I like the idea of system notifications but I think we have to make it more obvious to people how to set it up, otherwise it just seems broken.

I have a Mac mini, but I'm not familiar with Mac OS, so writing a guide for Mac users is a challenge.

Should I change "display notification" to "display alert"? This won't allow use the various Mac notification settings, but it will avoid the complicated setup process.

@daniel-lxs
Copy link
Member

@NaccOll Are the alerts visible if the window is in the background, if so then I think it makes sense.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Aug 25, 2025
@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 26, 2025

osascript -e 'display alert "hello" message "world"'

Yeah, it work,like follow:
QQ_1756220430967

The advantage is that it no requires user configuration; simply toggle it on in RooCode and you'll receive alert when VSCode is not focused. However, even with Do Not Disturb enabled on mac, it still works.

Is there a way to change notification on Mac to alert?

@hannesrudolph hannesrudolph changed the title system notification like kilocode Add system notifications Aug 26, 2025
@hannesrudolph hannesrudolph force-pushed the feature-system-notification branch from 47ba79e to 814040a Compare August 26, 2025 21:22
@NaccOll NaccOll force-pushed the feature-system-notification branch from 814040a to 2d3d43d Compare August 28, 2025 16:51
@NaccOll
Copy link
Contributor Author

NaccOll commented Aug 28, 2025

Without changing the existing implementation, I followed ⁠https://forum.latenightsw.com/t/trying-to-use-terminal-for-display-notification/5068/6⁠ and enabled notification permissions in the script editor. System notifications are working on my mac mini.

@NaccOll NaccOll requested a review from daniel-lxs August 28, 2025 16:56
@NaccOll NaccOll force-pushed the feature-system-notification branch from 2d3d43d to faf1d1e Compare September 4, 2025 06:29
@hannesrudolph hannesrudolph force-pushed the feature-system-notification branch 2 times, most recently from 1eebada to faf1d1e Compare September 8, 2025 18:17
@hannesrudolph
Copy link
Collaborator

notification permissions in the script editor is not a sollution that works IMO. Closing.

@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Notification for Actions

4 participants