Skip to content

fix(notifications): remove read macOS notifications from Notification Center by pane thread - #28425

Merged
Jinwoo-H merged 3 commits into
mainfrom
fix/macos-notification-center-removal
Oct 13, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
fix/macos-notification-center-removal

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​173 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​173
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​55 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51

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:

  • Every notification for a terminal pane, both agent completions and terminal bells, is filed under a Notification Center thread named after that pane. A pane's notifications also stack together there.
  • When the pane is read, notifications:dismiss removes the whole thread with Notification.removeGroup.
  • This needs no live Notification object, so it works after main releases the object at five minutes, and after a restart, because the pane key is stable.

Mechanism:

  • New src/main/ipc/macos-notification-center.ts:
    • macosNotificationIdentity gives each notification its macOS thread or identifier.
    • removeReadMacosNotifications runs inside the dismiss handler's per-pane loop. It removes the read pane's thread with Notification.removeGroup, and removes by identifier (Notification.remove) only the native-chat alerts that this read's journal position covers.
  • Native-chat alerts keep the existing rule that only a read covering their journal position retires them. They therefore stay out of the pane thread and get their own identifier (their attention key, announced once). When such a read arrives, the dismiss handler removes them by identifier along with the pane's thread.
  • Other notifications get no identifier. Electron sends a click to the first object it ever showed with a given identifier, and keeps objects in that list after we release them. A reused identifier, such as a repeat bell or a re-sent turn after the five-minute release, would send the click to a dead handler and the notification would do nothing.
  • Windows and Linux are unchanged. Electron can only remove delivered notifications by identifier on macOS. On Windows, id/groupId become 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:

  • One fixed identifier per pane, so a new notification replaces the last. Rejected because of the click-routing problem above.
  • Keeping the object until it is read. Rejected because it still loses everything on restart.
  • 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/groupId identity, 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:

    • agent and bell notifications posted in the pane's thread with no identifier;
    • a notification with no pane posted outside any thread;
    • removing a read pane's thread when no notification object is held (as after the five-minute release or a restart);
    • a native-chat alert surviving a pane read that doesn't cover it and being removed by one that does;
    • no change on win32 and linux.
  • 4 of the 7 fail without the fix.

  • pnpm vitest run src/main/ipc/notifications src/main/notifications: 112 tests pass.

  • pnpm tc:node and pnpm run check:code-quality:changed pass.

  • 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: darwin only, guarded by process.platform. Windows and Linux keep the existing close() path.
  • SSH/remote: pane keys are desktop tab-layout keys and are the same for local, SSH and remote panes.
  • Mobile: phone dismissal is unchanged.
  • Not covered here, and left for a follow-up:
    • A plain shell that rings a bell, with no agent in the pane, is not cleared on view, because only reading an agent sends a dismiss today.
    • A native-chat alert from before a restart is not removed, because its read position is only known in memory.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

… 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]>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e82815b6-1d8a-456d-ab23-40543147ece9
📥 Commits

Reviewing files that changed from the base of the PR and between 3f546c8 and fca538a.

📒 Files selected for processing: 1
  • src/main/ipc/macos-notification-center.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/main/ipc/macos-notification-center.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

Native notification delivery now assigns macOS notification IDs or pane group IDs when applicable. Pane dismissal passes retired announcements to a helper that removes the pane group and eligible notification IDs on macOS. The announcement type is exported for use by the helper. Tests cover identity assignment, dismissal, and Windows and Linux behavior.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to fca53

This change clears a pane's macOS notifications when the pane is read. No concrete merge-blocking risk is evident from the supplied context. Real-app macOS testing was not run, which is normal for this kind of change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed The changes satisfy the coding requirements in #26732. Agent and bell notifications receive stable macOS pane groups. notifications:dismiss calls Notification.removeGroup, so released or pre-resta…
Out of Scope Changes check Passed The changes stay within #26732. Production changes add macOS notification identity, pane-thread removal, and dismissal integration. Test changes mock and verify the new Electron APIs. The changes do n…
Title check Passed The title clearly and concisely describes the main change: removing read macOS notifications by pane thread.
Description check Passed The description covers the required sections, explains the user impact and implementation, links issue #26732, documents testing and platform scope, and records known limitations. The unchecked local …
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5e074ab3-ce21-4a75-880f-e6b0b4aeed65
📥 Commits

Reviewing files that changed from the base of the PR and between 5cdbc7a and 3f546c8.

📒 Files selected for processing: 4
  • src/main/ipc/macos-notification-center.ts
  • src/main/ipc/notifications-macos-removal.test.ts
  • src/main/ipc/notifications.ts
  • src/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.

@Jinwoo-H
Jinwoo-H merged commit 8b0fa15 into main Oct 13, 2026
30 checks passed
brennanb2025 pushed a commit that referenced this pull request Oct 15, 2026
… 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: notifications can't be cleared after 5 minutes or a restart and pile up per pane; use Electron id/groupId and Notification.remove()

1 participant