Repository navigation
Conversation
…ne group notifications:dismiss only closed Notification objects still held in memory, which main releases after five minutes and loses on restart, so older notifications piled up per pane in Notification Center. On macOS, give each native notification an id (UNNotificationRequest identifier) and a per-pane groupId (threadIdentifier), and have dismiss call Notification.remove(ids) and Notification.removeGroup(pane) so delivery no longer depends on a live object. Terminal-bell notifications get a stable pane-scoped id so a repeat replaces the previous one. Positioned structured alerts keep their id but stay out of the pane group, so a pane read that does not cover them still leaves them. Windows/Linux keep the close() path. Refs stablyai#26732 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WuRWooMLGXysyySZsUMNVH
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughOn macOS, native notifications receive IDs and pane group IDs. Terminal-bell notifications without an ID receive a pane-scoped ID. The dismissal handler now requests removal of delivered notifications by ID and pane group after handling active in-memory notifications. Tests cover notification identity, dismissal after the in-memory release period, structured alerts, and Linux behavior. Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity> Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Pane dismissal does not appear to clear unread alerts or notifications in other panes. No actionable merge-blocking risk remains on the supplied evidence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
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 |
|
@Jinwoo-H I noticed #26732 was assigned to you after this PR went up. In case it saves you some time: this already covers points 1–3 of the issue (stable |
|
Thanks for this, @maxmilian. We shipped this approach in #28425, with you credited as co-author. It keeps your per-pane grouping and leaves native-chat alerts out of it. We dropped the fixed bell id, because Electron sends a click to the first notification ever shown with a given id, so a repeat bell after the 5-minute release could do nothing when clicked. Closing this in favour of that. Much appreciated. |
ELI5
On macOS, Orca's notifications could only be cleared while Orca still held them in memory, and it lets go of them after five minutes (and loses them on restart). After that, viewing the pane left old notifications stuck in Notification Center, one per turn. Now each notification has a name and a per-pane group that macOS knows about, so Orca can remove them by name at any time.
What Changed
native-notification-identity.ts(new): on macOS, builds{ id, groupId }for each native notification.id= the existingnotificationId; terminal bells (which had none) get a stableterminal-bell:<paneKey>.groupId=pane:<paneKey>.native-notification-delivery.ts: passes that identity tonew Notification().notifications.ts(notifications:dismiss): after the existing in-memoryclose()loop, callsNotification.remove(ids)for every id it retires andNotification.removeGroup(pane:<paneKey>)for every acknowledged pane. These work by identifier, with no live object, so they still work after the five-minute release or a restart.structuredOrigin) get anidbut nogroupId: they are only retired by a read that covers them (existing subject-retirement rule), and a pane-wideremoveGroupwould otherwise clear them on any pane read.id/groupIdmap to toastTag/Group(length-limited, different replace semantics), so that path keepsclose().Before: notifications older than five minutes, or from before a restart, could not be dismissed; bells piled up one per ring. After: viewing a pane removes all of its plain notifications from Notification Center; a repeated bell replaces the previous one.
Point 4 of the issue (optional "one notification per pane until viewed" setting) is a product call and is not included.
Why
close()needs the liveNotificationobject, whichretainNotificationUntilReleasedrops afterNOTIFICATION_RELEASE_FALLBACK_MS(5 min); the announced-notification registry still knows the ids, but nothing could act on them. Electron 43 (already shipped) exposesid/groupIdand the macOS staticsNotification.remove()/removeGroup()(electron/electron#50097, #51182, backported in #51690), which act onUNUserNotificationCenterdelivered notifications by identifier. Extending the in-memory retention instead would still fail after a restart and keep objects alive indefinitely.Linked Issue
Fixes #26732
Visual Proof
macOS 26 Notification Center, dev build (
Orca Dev), same scenario onmainand on this branch: pane A gets agent turn 1, two terminal bells, agent turn 2; pane B gets one agent notification. Wait past the 5-minute in-memory release, then acknowledge pane A (notifications:dismiss(['<turn-2 id>'], [paneA]), which is what the renderer sends when the pane is viewed). Both runs return{ dismissed: 0 }because the live objects are already released.main): all five still in Notification CenterAfter this PR, before the dismiss (each pane is its own thread, and the second bell replaced the first):
Testing
src/main/ipc/notifications-macos-removal.test.ts(6 cases): id/groupId on dispatch; stable bell id; dismiss after the 5-minute release removes by id and pane group; dismiss in a fresh process (restart) removes by id and group; positioned structured alert stays out of the group; Linux keeps theclose()path. 5 of 6 fail onmain(the Linux guard passes on both), all pass with the fix.vitestoversrc/main/ipc+src/main/notifications: 543 files / 5455 tests pass.pnpm typecheck,pnpm lint,check:code-quality:changedpass.pnpm buildnot run locally.notifications:dispatch/notifications:dismissIPC (driven from the renderer over CDP), waiting the real five minutes. Delivered list (Notification.getHistory()from a separate process) after the dismiss:main: 5 entries, all random-UUID ids with emptygroupId.agent:…:b1(grouppane:<pane B>) is left. Before the dismiss, pane A heldagent:…:a1,terminal-bell:<pane A>(ring 2 had replaced ring 1) andagent:…:a2, all in grouppane:<pane A>.Notification.remove(id)from a different process of the same bundle removes the notification, so removal does not depend on the process that posted it (the restart case). I could not reproduce the restart pile-up itself with the dev build: quitting the dev app removed its delivered notifications in my runs, so that path is covered by the unit test plus this cross-process check.Notificationreference, then dismissed the way the new IPC does:[<random-uuid legacy>, agent:…turn1, agent:…turn2, terminal-bell:<pane>, agent:…other](a second bell with the same id replaced the first)remove(['agent:…turn2']): turn2 goneremoveGroup('pane:<pane>'): only the legacy notification and the other pane's remainAI Disclosure
Implemented with Claude Code (Claude Opus 5.5), including the tests, the macOS Notification Center runs and the Electron probe described above; the diff was reviewed before opening this PR.
Review
AI review summary:
process.platform === 'darwin'in both the identity builder and the removal call; Windows/Linux behaviour is byte-for-byte the old path.notificationIds; structured (journal-positioned) alerts keep their read-boundary semantics by staying out of the pane group.dismissMobileNotificationare untouched; the bell id is native-only.remove()call plus oneremoveGroup()per acknowledged pane per dismiss.Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (lint + typecheck + notification/main vitest pass locally; fullpnpm testandpnpm buildnot run)🤖 Generated with Claude Code
https://claude.ai/code/session_01WuRWooMLGXysyySZsUMNVH