Repository navigation
fix(notifications): remove read macOS notifications from Notification Center by pane thread - #28425
Conversation
… Center by pane thread Orca could only take a delivered notification out of Notification Center while main still held its Notification object, which it releases after five minutes and loses on restart. Older notifications for a pane then stayed forever. On macOS each pane notification now goes in a thread named after its pane, and reading the pane removes that thread. A native-chat alert has its own identifier instead, and is removed only by a read that covers it. Windows and Linux are unchanged. Fixes #26732 Co-authored-by: Max Hsu <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
…p; only structured alerts by id Only alerts posted with an identifier are removed by id, so renderer-rebuilt ids no longer reach Notification.remove. Drops the extra pane-key accumulator, the try/catch wrapper and redundant tests.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5e074ab3-ce21-4a75-880f-e6b0b4aeed65
📒 Files selected for processing: 4
src/main/ipc/macos-notification-center.tssrc/main/ipc/notifications-macos-removal.test.tssrc/main/ipc/notifications.tssrc/main/notifications/announced-notification-registry.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
… Center by pane thread (#28425) * fix(notifications): remove read macOS notifications from Notification Center by pane thread Orca could only take a delivered notification out of Notification Center while main still held its Notification object, which it releases after five minutes and loses on restart. Older notifications for a pane then stayed forever. On macOS each pane notification now goes in a thread named after its pane, and reading the pane removes that thread. A native-chat alert has its own identifier instead, and is removed only by a read that covers it. Windows and Linux are unchanged. Fixes #26732 Co-authored-by: Max Hsu <[email protected]> * refactor(notifications): remove by pane thread inside the dismiss loop; only structured alerts by id Only alerts posted with an identifier are removed by id, so renderer-rebuilt ids no longer reach Notification.remove. Drops the extra pane-key accumulator, the try/catch wrapper and redundant tests. * docs(notifications): place the macOS removal rationale on the removal function --------- Co-authored-by: Max Hsu <[email protected]> (cherry picked from commit 8b0fa15)
ELI5
On macOS, Orca notifications piled up in Notification Center. Viewing a pane removed its notifications only if they were less than five minutes old and Orca had not restarted. Now viewing a pane removes all of that pane's notifications, however old.
What Changed
Before: after finishing several turns, a pane left one notification per turn in Notification Center. Viewing the pane removed only those from the last five minutes of the current session. The rest stayed until the user cleared them by hand, and "Clear All" also removed notifications the user had not read yet.
After: on macOS:
notifications:dismissremoves the whole thread withNotification.removeGroup.Notificationobject, so it works after main releases the object at five minutes, and after a restart, because the pane key is stable.Mechanism:
src/main/ipc/macos-notification-center.ts:macosNotificationIdentitygives each notification its macOS thread or identifier.removeReadMacosNotificationsruns inside the dismiss handler's per-pane loop. It removes the read pane's thread withNotification.removeGroup, and removes by identifier (Notification.remove) only the native-chat alerts that this read's journal position covers.id/groupIdbecome toast Tag/Group, which have their own length and replace rules.Why
The in-memory
close()path cannot be extended to old notifications: the object is gone after release or restart. Notification Center can remove notifications by thread with no object at all.Alternatives considered:
removeAll. Rejected because it would clear notifications the user has not read yet, including from other Orca builds that share the bundle id.Builds on #26833 by @maxmilian: the darwin-only
id/groupIdidentity, the per-pane thread, and keeping structured alerts out of it.Linked Issue
Fixes #26732
Visual Proof
N/A. This changes nothing in Orca's UI, and Notification Center only tracks notifications from a signed build, so a dev build cannot show the before and after. @maxmilian's macOS 26 before/after in #26833, with a real five-minute wait, exercises the same removal path.
Testing
New
src/main/ipc/notifications-macos-removal.test.ts(7 tests) covers:4 of the 7 fail without the fix.
pnpm vitest run src/main/ipc/notifications src/main/notifications: 112 tests pass.pnpm tc:nodeandpnpm run check:code-quality:changedpass.Not run in the real app: it needs a signed macOS build and would post real notifications.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
process.platform. Windows and Linux keep the existingclose()path.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)