-
Notifications
You must be signed in to change notification settings - Fork 0
Add desktop notifications with anti-spam throttling to AEA monitor #4
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: main
Are you sure you want to change the base?
Conversation
|
Unable to perform a code review. You have run out of credits 😔 |
Co-authored-by: 0xrinegade <[email protected]>
Co-authored-by: 0xrinegade <[email protected]>
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.
Pull Request Overview
This PR adds desktop notification support to the AEA monitor script, alerting users when new messages are detected even when the terminal is not in focus.
Key Changes:
- Added
send_notification()helper function that usesnotify-sendwhen available - Integrated desktop notifications into the message detection workflow
- Notifications display for 10 seconds with graceful fallback if
notify-sendis unavailable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scripts/aea-monitor.sh
Outdated
| fi | ||
|
|
||
| # Send desktop notification | ||
| send_notification "AEA Monitor" "New messages in $project_name" |
Copilot
AI
Oct 26, 2025
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 notification is sent every time check_project_messages() detects unprocessed messages, which could result in repeated notifications during the same monitoring cycle. Consider adding a condition to only send the notification when messages are first detected, or throttling notifications to avoid spam.
|
@copilot The notification is sent every time check_project_messages() detects unprocessed messages, which could result in repeated notifications during the same monitoring cycle. Consider adding a condition to only send the notification when messages are first detected, or throttling notifications to avoid spam. |
Co-authored-by: 0xrinegade <[email protected]>
Added notification throttling in commit 5156e7b. The monitor now tracks message count per project and only sends notifications when the count increases (new messages arrive). Repeated checks for the same messages no longer trigger notifications. State is automatically cleared when all messages are processed. |
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Send desktop notification only if message count has increased | ||
| # Track notification state to avoid spam | ||
| local notif_state_file="$CONFIG_DIR/.notification_state_$(echo "$project_path" | md5sum | cut -d' ' -f1)" |
Copilot
AI
Oct 26, 2025
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 state file path construction is duplicated in two places (lines 362 and 381). Extract this to a local variable at the beginning of the function to avoid repetition and ensure consistency.
| local notif_state_file="$CONFIG_DIR/.notification_state_$(echo "$project_path" | md5sum | cut -d' ' -f1)" | |
| local notif_state_file | |
| notif_state_file="$CONFIG_DIR/.notification_state_$(echo "$project_path" | md5sum | cut -d' ' -f1)" |
| local last_notified_count=0 | ||
|
|
||
| if [ -f "$notif_state_file" ]; then | ||
| last_notified_count=$(cat "$notif_state_file" 2>/dev/null || echo 0) |
Copilot
AI
Oct 26, 2025
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 fallback || echo 0 executes when cat fails (file doesn't exist), but also when the file exists and is empty or contains invalid data. This could lead to notifications being sent repeatedly if the state file is corrupted. Consider explicit validation of the file content or initialization with a default value.
| last_notified_count=$(cat "$notif_state_file" 2>/dev/null || echo 0) | |
| notif_content=$(cat "$notif_state_file" 2>/dev/null) | |
| if [[ "$notif_content" =~ ^[0-9]+$ ]]; then | |
| last_notified_count="$notif_content" | |
| else | |
| last_notified_count=0 | |
| fi |
The AEA monitor logs message arrivals to the terminal but provides no notification when the terminal is not in focus.
Changes
scripts/aea-monitor.sh(+31 lines)send_notification()helper that conditionally callsnotify-sendif availablecheck_project_messages()when unprocessed messages are detectedImplementation
Notification displays for 10 seconds with
dialog-informationicon. Gracefully no-ops ifnotify-sendunavailable.Anti-Spam Throttling
The notification system includes intelligent throttling to prevent spam:
~/.config/aea/.notification_state_<hash>Example behavior:
Ready for extension to macOS/Windows notification systems.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.