Skip to content

Desktop: Notifications duplicated when multiple windows are open #20371

Closed as not planned

Description

@aryasaatvik

Bug Description

When using the OpenCode Electron desktop app with multiple windows open, notifications are duplicated based on the number of windows. For example, with 3 windows open, a single session completion triggers 3 identical notifications (one per window).

Note: While the same code pattern exists in the Tauri desktop implementation and could potentially be affected, this issue has only been tested and confirmed with the Electron desktop app.

Steps to Reproduce

  1. Open OpenCode Desktop app (Electron version)
  2. Open additional windows (right-click on dock/taskbar icon, or use File > New Window if available)
  3. Start a session in any window and wait for it to complete
  4. Observe that you receive N duplicate notifications (where N = number of open windows)

Expected Behavior

A single notification should be shown regardless of how many windows are open.

Actual Behavior

Each unfocused window independently creates its own browser Notification object, resulting in multiple duplicate notifications.

Technical Analysis

Root Cause:
In packages/app/src/context/notification.tsx, each window independently listens to globalSDK.event.listen() for session events. When a session.idle or session.error event fires, every window calls platform.notify(), which creates a browser Notification in the renderer process:

Electron Desktop (packages/desktop-electron/src/renderer/index.tsx:176-190):

notify: async (title, description, href) => {
  const focused = await window.api.getWindowFocused()
  if (focused) return  // Only prevents notification in focused window
  const notification = new Notification(title, { body: description ??  })
  // Other windows still create duplicate notifications
}

The focus check only skips the focused window - all other unfocused windows still show notifications.

Tauri Desktop (packages/desktop/src/index.tsx:311-336):
The same pattern exists in the Tauri implementation, though this has not been tested.

Potential Solutions

  1. Move notification creation to main process (Recommended):

    • Use the main process Notification API instead of renderer-side browser notifications
    • Ensures single source of truth for notifications
  2. Implement deduplication in renderer:

    • Track recently shown notifications using session ID + timestamp
    • Skip if same notification was shown within last X seconds
  3. Use a single notification window:

    • Designate one window as the "notification owner"
    • Other windows skip notification creation

Environment

  • OpenCode Desktop version: 1.3.9+
  • Platform: Tested on macOS (Electron build)
  • Issue confirmed with Electron desktop build

Activity

  1. removed
    webRelates to opencode on web / desktop
    on May 3, 2026
  2. muzlik-gm commented on Jul 2, 2026

    @muzlik-gm

    still not fixed, how long is it gonna take them to fix this single issue!
    I'm tired of this!
    First we got 5 notifications just for one single Session, and now 4 Concurrent sessions!
    When you prompt in one Session, the other 3 are also prompted!

  3. github-actions commented on Sep 1, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions