Skip to content

Notification close button hidden and "Clear All" disabled after progress notification completes #314963

Closed

Description

Summary

After an extension's progress notification finishes (i.e. progress.done() is called internally), the notification that remains visible in the Notification Center exhibits two broken behaviors:

  1. The close (×) button is not shown on the notification row — there is no way to dismiss it individually.
  2. The "Clear All Notifications" button is disabled, and the notifications.clearAll command silently skips the notification.

Steps to Reproduce

  1. Use any extension that creates a ProgressLocation.Notification progress notification and leaves it visible after the operation completes (e.g. extensions like Gradle for Java, Dev Containers, or any extension using vscode.window.withProgress({ location: vscode.ProgressLocation.Notification })).
  2. Wait for the operation to finish (the progress bar completes/disappears).
  3. Open the Notification Center (Ctrl+K Ctrl+Shift+N).
  4. Observe: the notification row has no close (×) button.
  5. Observe: the "Clear All Notifications" toolbar button is greyed out.
  6. Run notifications.clearAll from the Command Palette — the completed-progress notification is not dismissed.

Expected Behavior

Once progress completes (done() is called), the notification should behave like any other standard notification:

  • The close (×) button should appear.
  • "Clear All Notifications" should be enabled and should dismiss it.

Root Cause

INotificationViewItem.hasProgress (in src/vs/workbench/common/notifications.ts) is implemented as:

get hasProgress(): boolean {
    return !!this._progress; // BUG: _progress is never nulled out after done()
}

_progress is a lazily-created object that, once instantiated, is never set back to null, even after progress.done() is called. As a result, hasProgress permanently returns true for any notification that ever had progress.

This getter is used in at least three places that all misbehave:

1. Close button hidden (notificationsViewer.ts):

// Close (unless progress is showing)
if (!notification.hasProgress) {   // ← always false after any progress
    actions.push(NotificationTemplateRenderer.closeNotificationAction);
}

2. "Clear All" disabled (notificationsCenter.ts):

clearAllAction.enabled = this.model.notifications.some(notification => !notification.hasProgress);
// ← if all notifications had progress, enabled is always false

3. clearAll() skips the notification (notificationsCenter.ts):

if (!notification.hasProgress) {   // ← false, so close() is never called
    notification.close();
}

Note: The sticky getter in the same file already handles this correctly:

(this._progress && !this._progress.state.done) // only sticky while progress is running

Proposed Fix

Step 1 — Fix the root cause in src/vs/workbench/common/notifications.ts:

get hasProgress(): boolean {
    return !!this._progress && !this._progress.state.done;
}

Step 2 — Trigger a toolbar re-render when progress completes, in src/vs/workbench/browser/parts/notifications/notificationsViewer.ts:

case NotificationViewItemContentChangeKind.PROGRESS:
    this.renderProgress(notification);
    this.renderActions(notification); // add this: refresh close button visibility
    break;

Without Step 2, even with Step 1 fixed, the close button won't appear in the toolbar until the next full list re-render (e.g. scrolling), because the PROGRESS content change event handler only calls renderProgress() and not renderActions().

Affected Files

  • src/vs/workbench/common/notifications.ts — hasProgress getter (root cause)

  • src/vs/workbench/browser/parts/notifications/notificationsViewer.ts — close button render logic, PROGRESS event handler

  • src/vs/workbench/browser/parts/notifications/notificationsCenter.ts — clearAllAction.enabled, clearAll()

  • VS Code Version: latest main

  • OS: Windows / macOS / Linux (platform-independent)

Activity

  1. added a commit that references this issue on Sep 8, 2026
    8662b4c
  2. added
    unreleased
    on Sep 8, 2026
  3. added this to the 1.138.0 milestone on Sep 8, 2026
  4. added
    insiders-released
    and removed
    unreleased
    on Sep 9, 2026
  5. added a commit that references this issue on Sep 23, 2026
    3f15450
  6. locked and limited conversation to collaborators on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    insiders-released

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions