feat(desktop): notify on turn completion while unfocused on Windows - #8316
feat(desktop): notify on turn completion while unfocused on Windows#8316Pleko-script wants to merge 6 commits into
Conversation
The renderer detects active-to-completed phase transitions from the existing awareness projection and reports them over one optional bridge method; the Electron main process owns the win32, window-focus, and support gate and shows a silent native toast titled "Agent finished" with the thread title as the body. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a9f0dcd. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces an enabled-by-default Windows desktop notification workflow spanning renderer state tracking, IPC/preload wiring, and Electron native notifications. Its cross-process runtime behavior and product-default impact exceed the scope of an auto-approvable bounded change. You can add or adjust custom eligibility rules. Learn more. |
Cold start hydrates thread shells from the persisted cache before the authoritative snapshot loads, so a thread cached as running that finished while the app was closed read as a fresh completion and toasted. A phase now arms a notification only when observed while its environment shell is live, with arming sticky across active phases so a reconnect that replays running to completed still notifies once. The liveness source pairs the shell list with a reference-stable boolean projection per environment, so snapshot updates that change neither shells nor liveness do not rerun the collector. Also corrects the documented Windows notification settings path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Superseded by #11481 (opt-in thread notifications and sounds for browser/desktop on main). Closing as superseded. |

Agents finish while the user is in another window, and nothing tells them. Issue #780 asked for completion notifications, and the earlier attempts (#976, #1780, #4003, #5821) were closed for being too broad or for tracking completion state that went stale across reseeds.
This is the smallest slice that works, built on the existing awareness foundation. The renderer derives phases from the thread-shell atoms with
resolveThreadAwarenessPhase, the same ladderAgentAwarenessRelayuses for mobile push, and reports a turn that moved from running (or waiting on approval or input) to completed over one new optionalDesktopBridge.notifyAgentTurnCompletedmethod. The Electron main process owns the whole gate (win32, no focused window,Notification.isSupported()) and shows one silent toast with the thread title. No agent output crosses the bridge.What keeps it quiet when it should be:
AgentAwarenessRelaydefers server-side).The liveness source pairs the shell list with a reference-stable boolean projection per environment, so shell updates that change neither shells nor liveness never rerun the collector.
Deliberately out of scope (each is a small follow-up): a settings toggle (Windows per-app notification settings are the off switch for now), macOS and Linux, click-to-focus, sounds, approval and input notifications. One semantic is inherited from the shared phase ladder and matches mobile push today. Interrupted turns with a
completedAtstamp read as completed.Verified with 24 targeted tests via
vp test run(transition detection, liveness arming, source-atom emission stability, duplicate suppression, hydration seeding, the boot transient, per-environment keys, platform, focus and support gating, throw safety), scoped typecheck over shared, contracts, web and desktop, targeted lint, andvp fmt --check. I also exercised the real path on a Windows 11 machine through the dev app with remote debugging. The bridge call returned false while the window was focused and true after minimizing, and this toast appeared:The dev build attributes the toast to "Electron" because dev has no installed Start Menu shortcut. Installed builds carry
com.t3tools.t3code(set inDesktopAppIdentityand the packaging appId), so they show the T3 Code name and icon.Built with Claude Fable 5 on Claude Code, with a Codex (GPT) review pass.
🤖 Generated with Claude Code
Note
Low Risk
Additive optional bridge API and Windows-only notification gating; no auth or sensitive data on the wire, with behavior covered by extensive unit tests.
Overview
Adds Windows-only, unfocused desktop toasts when an agent turn finishes, without sending agent output across the IPC bridge.
The renderer tracks thread awareness phases (same ladder as mobile push via newly exported
resolveThreadAwarenessPhase) and calls an optionaldesktopBridge.notifyAgentTurnCompleted({ threadTitle })when a thread moves from an armed active phase to completed. Arming respects environment live connection state, ignores first-seen completions, skips the session-boot starting phantom, and dedupes via a per-thread phase map.The Electron main process implements
ElectronNotificationwithshouldShowAgentTurnNotificationgating (win32, no focused window,Notification.isSupported()), showing a silent Agent finished toast with the thread title. New IPC channeldesktop:notify-agent-turn-completedis wired through handlers, preload, andDesktopBridgein contracts;main.tsxstarts the subscriber on app boot.Includes targeted unit tests for gating and transition logic plus user docs for Windows notification settings.
Reviewed by Cursor Bugbot for commit c78efca. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Windows desktop notifications for agent turn completion when unfocused
ElectronNotificationservice that shows a silent "Agent finished" notification on win32 only when no window is focused and Electron reports notification support; all other platforms and focused states returnfalsenotifyAgentTurnCompletedIPC channel and exposes it through the preload bridge so the renderer can request a notification with a thread title and receive a boolean resultstartDesktopAgentTurnNotificationsthat tracks thread awareness phases, arms only live-environment threads, deduplicates completions, and skips threads already completed at startupresolveThreadAwarenessPhasefrompackages/shared/src/agentAwareness.tsso the web collector can reuse existing phase resolutionnotifyAgentTurnCompletedare silently skipped.DesktopBridge.notifyAgentTurnCompletedis optional, so non-browser or older desktop environments no-op at startupMacroscope summarized c78efca.