Skip to content

fix: dedupe Windows notification quick replies (#3467) - #3469

Closed
jeanfbrito wants to merge 1 commit into
devfrom
cursor/windows-notification-reply-dedup-e485
Closed

fix: dedupe Windows notification quick replies (#3467)#3469
jeanfbrito wants to merge 1 commit into
devfrom
cursor/windows-notification-reply-dedup-e485

Conversation

@jeanfbrito

@jeanfbrito jeanfbrito commented Aug 24, 2026

Copy link
Copy Markdown
Member

Closes #3467

What

Windows notification quick-reply was sending the message twice on 4.16.0 / dev. This forward-ports the fix from #3420 (b62b165 on hotfix/4.15.6) onto dev with the same semantics.

Thanks to @Moku151 for reporting the 4.16.0 regression in #3467 and for opening #3468. That PR correctly identified the missing forward-port; this PR is Jean’s own port of #3420 rather than a merge of #3468 (third-party forward-port of the same code).

Why

The 4.15.6 hotfix landed the repliedNotifications Set guard, but it was not forward-ported to dev, so 4.16.0 shipped without it. Electron 42 on Windows can emit reply twice for one toast (WinRT + COM activation paths).

How

Same semantics as #3420:

  • Guard NOTIFICATIONS_NOTIFICATION_REPLIED with a per-notification repliedNotifications Set
  • Re-arm (delete the id) on show
  • Never clear on close — the duplicate can arrive after dismiss; clearing there reopens the race (ignore CodeRabbit advice to clear on close)
  • Regression specs in src/notifications/main/setup.main.spec.ts: duplicate reply dispatches once; later show then reply is accepted; close does not re-arm
  • AGENTS.md: documents the reply-dedup constraint (and that a future handleActivation path must use the same Set) plus the hotfix → dev forward-port rule

Out of scope: CORE-2571, SUP-1097, and the broader Action Center / handleActivation work in #3464.

Testing

yarn test --testPathPattern='src/notifications/main/setup.main.spec'

8 passed (including the three new reply-dedup cases).

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Prevented duplicate notification reply events from being processed.
    • Reply handling now resets when a notification is shown again, while closing a notification does not re-enable duplicate replies.
  • Tests

    • Added coverage for repeated replies, notification re-display, and close behavior.

Electron 42 can dispatch a single Windows toast inline reply more than
once (WinRT and COM activation paths). Guard NOTIFICATIONS_NOTIFICATION_REPLIED
with a per-notification replied set, re-armed on each show. Deliberately
not cleared on close: the duplicate can arrive after dismiss.

Forward-ports #3420 (b62b165) from hotfix/4.15.6 to fix #3467 on the
4.16.0 / dev line. Documents the constraint in AGENTS.md so a future
handleActivation path keeps the same Set.

Co-authored-by: Jean Brito <jeanfbrito@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f9b48172-460a-4bc5-a19c-d87758d3ad2d

📥 Commits

Reviewing files that changed from the base of the PR and between 150b36c and d1ec293.

📒 Files selected for processing (3)
  • AGENTS.md
  • src/notifications/main.ts
  • src/notifications/main/setup.main.spec.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: check (ubuntu-latest)
  • GitHub Check: check (macos-latest)
  • GitHub Check: check (windows-latest)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: TypeScript strict mode.

  • Redux actions follow FSA (Flux Standard Action) shape.
  • No unnecessary comments — self-documenting code through clear naming.
  • Verify work with the narrowest meaningful checks first, then broader checks
    when risk or shared behavior justifies it.
    Prefer optional chaining and fallbacks for platform-specific APIs:

Files:

  • src/notifications/main.ts
  • src/notifications/main/setup.main.spec.ts
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: - File naming: camelCase for files, PascalCase for components.

  • Avoid subjective descriptors ("smart", "excellent", "dumb").
  • Never invent metrics — no estimated time spent, no speculated user counts.
    Only include numbers from actual logs, error messages, or documented
    sources.

Files:

  • src/notifications/main.ts
  • AGENTS.md
  • src/notifications/main/setup.main.spec.ts
AGENTS.md

📄 CodeRabbit inference engine (CLAUDE.md)

AGENTS.md: AGENTS.md is the canonical project guide, imported
above.

Files:

  • AGENTS.md
{AGENTS.md,CLAUDE.md}

📄 CodeRabbit inference engine (CLAUDE.md)

{AGENTS.md,CLAUDE.md}: Route by content, not by request phrasing: shared project guidance,
conventions, or memory ("add this to CLAUDE.md", # memory notes, /init
output) belongs in AGENTS.md — do NOT append it here even if the request
names this file. Claude-only mechanics (skill/hook behavior, Claude-specific
config that no other agent uses) stay below this line, in this file.

Files:

  • AGENTS.md
**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

  • Renderer specs use *.spec.ts / *.spec.tsx.

Files:

  • src/notifications/main/setup.main.spec.ts
**/*.main.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

  • Main-process specs use *.main.spec.ts.

Files:

  • src/notifications/main/setup.main.spec.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: RocketChat/Rocket.Chat.Electron

Timestamp: 2026-08-24T02:58:56.120Z
Learning: - Never commit or push without explicit user permission — "fix this" does NOT
  mean "commit it".
Learnt from: CR
Repo: RocketChat/Rocket.Chat.Electron

Timestamp: 2026-08-24T02:58:56.120Z
Learning: - Never commit directly to `master`, `dev`, or `release/X.Y.x` — create a
  branch, test, open a PR.
🔇 Additional comments (3)
AGENTS.md (1)

39-41: LGTM!

Also applies to: 140-148

src/notifications/main.ts (1)

51-51: LGTM!

Also applies to: 82-84, 132-137

src/notifications/main/setup.main.spec.ts (1)

237-299: LGTM!


Walkthrough

The notification process now deduplicates reply events per notification. Showing a notification re-arms reply handling, while closing it does not. Tests cover duplicate replies and both lifecycle behaviors. Hotfix guidance now requires immediate or same-change forward-porting to dev.

Changes

Notification reply deduplication

Layer / File(s) Summary
Reply event guard
src/notifications/main.ts, AGENTS.md
A repliedNotifications set suppresses duplicate reply events. The notification ID is removed on show and retained on close.
Reply guard validation
src/notifications/main/setup.main.spec.ts
Tests verify one dispatch for duplicate replies, re-arming after show, and suppression after close.

Hotfix forward-port guidance

Layer / File(s) Summary
Forward-port instruction
AGENTS.md
Hotfix changes must be cherry-picked to dev in the same change or immediately after.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d1ec2

This change prevents duplicate Windows notification replies while preserving re-arming behavior for later notifications. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested labels: type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the Windows notification quick-reply deduplication fix and identifies the related issue.
Linked Issues check ✅ Passed The changes satisfy #3467 by deduplicating reply events, re-arming on show, retaining the guard after close, and adding regression tests.
Out of Scope Changes check ✅ Passed The code, tests, and AGENTS.md guidance directly support the linked issue and stated deduplication objective.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/notifications/main.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

src/notifications/main/setup.main.spec.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

Warning

Errors were encountered while retrieving linked issues.

Errors (2)
  • CORE-2571: Request failed with status code 401
  • SUP-1097: Request failed with status code 401

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.

@jeanfbrito
jeanfbrito marked this pull request as ready for review August 24, 2026 02:58
@Moku151

Moku151 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Thanks for crediting me. Just out of curiosity, could you clarify why a separate
PR was preferred over adding the additional test and documentation to #3468?
I’d like to understand the preferred contribution workflow.

@jeanfbrito

jeanfbrito commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Thanks for crediting me. Just out of curiosity, could you clarify why a separate PR was preferred over adding the additional test and documentation to #3468? I’d like to understand the preferred contribution workflow.

It was my mistake, I saw your PR in the night and asked the bot to review it and do the fixes needed. He then understood that were to create a new PR. Already fixed, your colaboration will stay forever with us. Thank you very much @Moku151 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: notification quick reply is sent twice again in 4.16.0

2 participants