Add OS notifications for turn completions#1780
Add OS notifications for turn completions#1780malekelkssas wants to merge 2 commits intopingdotgg:mainfrom
Conversation
- New setting to enable/disable notifications when turns finish - Tracker detects thread state transitions (running → idle/error/stopped) - Notifications only show when tab is unfocused; fallback to in-app toast when focused - Handles permission requests and restricted contexts gracefully
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@cursor review |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (OS browser notifications for turn completions) with ~190 lines of new logic, including state tracking and browser API integration. While the feature is gated behind a setting that defaults to off and is well-structured, new features introducing new user-facing behavior warrant human review regardless of how self-contained they are. You can customize Macroscope's approvability policy. Learn more. |
- Update the tracker to replace running threads with those from the current snapshot, ensuring accurate state representation. - Integrate notification permission request into settings panel for turn completion notifications. - Adjust settings restoration to include the new turn completion notification option.
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 08b67ff. Configure here.
| (id) => useStore.getState().threads.find((t) => t.id === id), | ||
| (id) => useStore.getState().projects.find((p) => p.id === id), | ||
| ) | ||
| : []; |
There was a problem hiding this comment.
Tracker state becomes stale when notifications are disabled
Low Severity
When notificationsEnabledRef.current is false, extractTurnCompletions is entirely skipped. This function has a critical side effect: it maintains the runningThreadIds module-level tracker by adding IDs on "running" events and removing them on completion events. Skipping it when notifications are disabled means stale "running" entries accumulate and are never cleaned up. If a thread was tracked as "running" before notifications were toggled off, and the thread completes during the disabled period, its ID stays in the set. When notifications are re-enabled, any subsequent non-running session-set for that thread could trigger a spurious completion notification. The tracker update logic needs to run unconditionally, independent of whether notifications are shown.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 08b67ff. Configure here.


What Changed
Added system-level (OS) notifications that fire when a turn finishes and the
user is not actively focused on the app. Includes a toggle in Settings → General.
enableTurnCompletionNotificationsclient setting (off by default)Why
When running long agent tasks, users often switch to another app (terminal, IDE,
browser tab) while waiting. There was no way to know the turn finished without
manually checking back. This adds an ambient signal through the OS notification
system so the user gets notified wherever they are — same as any other desktop
notification on their system (Linux, macOS, Windows).
UI Change
Notification setting
video record for the notification trigger
Screencast_._.webm
Checklist
Note
Medium Risk
Adds new client setting and hooks notification logic into the root orchestration event pipeline; behavior depends on browser Notification permissions/focus detection and could introduce noisy or missed notifications if tracking is wrong.
Overview
Adds opt-in OS-level notifications when an orchestration turn completes, driven by a new
enableTurnCompletionNotificationsclient setting (default off).Introduces
turnCompletionNotifier.tsto track running threads from snapshots andthread.session-setevents, request notification permission, and emit browserNotifications only when the page isn’t actively focused (with graceful fallback).Wires the notifier into
__root.tsx’s event-batch processing to detect running→non-running transitions and either show an OS notification or fall back to an in-app toast; also adds a Settings toggle (with reset support) that prompts for permission when enabled.Reviewed by Cursor Bugbot for commit 08b67ff. Configure here.
Note
Add OS notifications for thread turn completions
enableTurnCompletionNotificationsboolean to settings.ts (defaultfalse) and a toggle in the General Settings panel that requests browser Notification permission on enable.Macroscope summarized 08b67ff.