GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — desktop: notification counter on Ubuntu dock increments every turn and never clears · Issue #51400 · anomalyco/opencode

desktop: notification counter on Ubuntu dock increments every turn and never clears #51400

New issue
Copy link
New issue
Copy link
Open
Open
desktop: notification counter on Ubuntu dock increments every turn and never clears#51400
Copy link
Assignees
Hona

Description

@thomasvdv
thomasvdv
opened on Sep 25, 2026
Issue body actions

Description

On Ubuntu/GNOME, the numeric notification counter on the OpenCode dock (taskbar) icon increments on every completed turn and never goes back down, even after the notifications are read or cleared in the app.

The desktop renderer creates a web notification per turn and never closes it. On Linux, Electron maps each new Notification() to an org.freedesktop.Notifications.Notify call with replaces_id = 0 and no transient hint, so GNOME's notification daemon appends a new entry to the app's list for every notification. Ubuntu Dock's badge is the length of exactly that list (NotificationsMonitor.getAppNotificationsCount(appId), consumed by UnityIndicator._updateNotificationsCount() in appIconIndicators.js), so the counter only ever grows while the app runs and resets only when every notification is removed (Clear-all, or the app quitting and its D-Bus name vanishing).

Environment

  • opencode version: 2.0.16 (packaged desktop app, Electron 44.4.3)
  • OS: Ubuntu 26.04.1 LTS, GNOME Shell 50.1, Wayland
  • Terminal: n/a (desktop app)
  • Install/channel: release .deb, installed to /opt/OpenCode
  • Active plugins: none

Steps to reproduce

  1. Ubuntu with the default Ubuntu Dock (show-icons-notifications-counter is on by default)
  2. Leave Settings → General → Notifications → Agent on (the default)
  3. Switch away from the OpenCode window and let a few turns complete in any session
  4. The counter on the OpenCode dock icon increments by one per completed turn
  5. Open the session and mark it viewed in-app — the OS counter does not decrease

Expected behavior

The dock indicator should reflect the app's actual unread/attention state, and reading a session or clearing notifications should bring it back down.

Actual behavior

The counter is monotonically increasing while the app runs. GNOME caps and expires entries per app (MAX_NOTIFICATIONS_PER_SOURCE = 10 in messageTray.js), so under a burst it plateaus rather than growing forever — it still never comes back down until the app quits or every notification is dismissed.

Additional context

Measured on the affected machine by reading the dock badge through the GNOME accessibility tree and the notification daemon's state:

Action OpenCode dock counter
baseline 7
send 3 notifications shaped exactly like the app's (desktop-entry=ai.opencode.desktop, sender-pid=<electron browser pid>) 10
close those 3 5
send 12 in a burst 10 (plateau)
close all 0

Two control probes pin the cause:

  • Sending the same payload without desktop-entry/sender-pid app attribution does not move the OpenCode badge (the notifications land under a different source), so the badge is fed by the app-attributed entries.
  • Passing the daemon-returned id back as replaces_id replaced instead of appending (5 calls left 1 entry, counter stayed at 1). Passing a g_quark of a string tag did not replace (3 calls returned 3 distinct ids) — which is what Electron's libnotify path does when options.tag is set, so a JS tag alone will not fix this on GNOME.

Code path:

  • packages/desktop/src/renderer/index.tsx — platform.notify():
    const notification = new Notification(title, { body: description ?? "", icon: "..." })
    notification.onclick = () => { ...; notification.close() }
    No tag, and close() is only ever reached by clicking the notification.
  • packages/app/src/context/notification.tsx — handleSessionIdle() and handleSessionError() call platform.notify(...) when settings.notifications.agent() / .errors() are on. These are the per-turn calls.
  • Electron on Linux (shell/browser/notifications/linux/libnotify_notification.cc) sends the D-Bus Notify with replaces_id = options.tag as a g_quark (0 when empty); GNOME's org.gnome.Shell.Notifications daemon creates a brand-new entry per call and returns a fresh id each time.

Suggested fixes (any one stops the growth):

  • Renderer keeps the last notification handle per session and calls close() on a previous one before showing the next, and/or when the session is marked viewed.
  • Make completion notifications replace their predecessor — the only reliable form on GNOME is passing the daemon-returned id back as replaces_id, which needs an explicit Electron/main-process path rather than a JS tag.
  • Set the transient hint on Linux so GNOME destroys the entry when the banner is hidden (note: it then no longer persists in GNOME's notification list either).

Workarounds (until fixed):

  • Settings → General → Notifications → Agent: off
  • gsettings set org.gnome.shell.extensions.dash-to-dock show-icons-notifications-counter false
  • Clear notifications in the GNOME panel, or quit the app, to reset the counter

Activity

  1. github-actions
    assigned
    Hona
    on Sep 25, 2026
  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    Thanks for the detailed write-up and the D-Bus measurements. I couldn't reproduce this here because it needs the desktop app running in a real GNOME session with Ubuntu Dock, and this sandbox has neither, so a maintainer with that setup will need to confirm it.

    On the latest dev (86ce19d), the desktop notification code (packages/desktop/src/renderer/platform/notifications.ts) still opens a new notification for each event with no tag, transient hint or replace handling. It only closes a notification when you click it, and viewing a session doesn't close it. That matches the cause you described.

    Until then, your workarounds still apply: turn off Agent notifications, turn off the dock counter with gsettings, or clear notifications in the GNOME panel.

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

Metadata

Metadata

Assignees

  • @Hona
    Hona

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.