Skip to content

Fix notification Accessible View close listener lifetime - #338383

Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
dmitrivMS:agents/fix-issue-293200-notification-accessible-view-69
Sep 28, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
dmitrivMS:agents/fix-issue-293200-notification-accessible-view-69

Conversation

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Refs #293200

Addresses only the unchecked notificationAccessibleView.ts:69 direct event subscription (notification-accessible-view-69, queue ID47).

Change

Opening a notification in Accessible View subscribed to the notification's close event, but closing Accessible View left that listener attached until the notification itself was dismissed. Repeatedly reopening a surviving notification accumulated listeners.

Return this subscription from the provider's onOpen hook and register it in Accessible View's existing per-show disposable store. The optional onOpen return contract is documented. Each showing owns exactly its subscription, including same-provider re-shows and providers copied/restored through accessibility help.

Validation

  • Added notification lifetime tests and a real Accessible View show/re-show/help test. The final lifecycle test fails on the original baseline with callback totals [1,3,5,8,11], versus expected [1,2,2,3,3]; the candidate passes.
  • 25 focused notification/Accessible View tests pass.
  • Client typecheck, ESLint on all five changed files, and diff whitespace checks pass.
  • Actual Windows Code OSS, isolated synthetic notifications, one warmup plus 20 further open/Escape-close cycles, actual model-owned close-emitter listener counts after forced GC:
State Baseline Candidate
Before 3 3
Closed after 21 cycles 24 3
Open before help 25 4
In help 25 3
Restored after help 25 4
Closed after help 25 3
  • Matched live notification behavior: keyboard opening, severity/source, next/previous, verbosity re-show, help/focus restoration, closing the current notification after help, and surviving-notification update/reopening.
  • Two independent read-only reviews (gpt-6-astra, claude-opus-5.5, default effort) found a help/re-show regression in an initial onDispose-only approach. The revised per-show fix addresses it; both reviewers completed follow-up with no remaining significant/new bugs.

Scope and limits

The matched adjacent runtime pair used exception pause/resume instrumentation. An independent no-debug candidate run also retained only the original three listeners when closed. Some earlier attempts and later baseline launches timed out on initial Accessible View opening; those remain unexplained and are not counted as passes or attributed to automation. Original successful and unsuccessful raw results are preserved in the local task evidence.

Historical notification analogues for #207638, #191705, #249426, and #221497/#221521 were exercised. Physical screen-reader/macOS/Linux behavior, the original Chat/inline-completion scenarios, and streaming Chat cursor behavior remain unverified. A second owned-window focus attempt did not cause an observed document focus transition, so the original #268338 Alt+Tab case is explicitly unverified. The nonstreaming candidate notification cursor retained its column after Escape/Alt+F2.

This is a bounded listener-lifetime fix, not a universal leak-freedom or performance claim. It does not close the umbrella issue or change other checkbox owners. Open leak-labelled PRs and current main were rechecked for duplicate ownership fixes before publication.

Refs microsoft#293200 (notification-accessible-view-69).

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 28, 2026 13:20
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Sep 28, 2026

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The bounded lifecycle fix is correct and covered across replacement, hide, and accessibility-help restoration paths.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes notification Accessible View listener accumulation by tying close subscriptions to each view showing.

Changes:

  • Allows onOpen to return per-show disposable resources.
  • Disposes notification close listeners on hide, replacement, and help transitions.
  • Adds notification and Accessible View lifecycle tests.
File Description
src/​vs/​platform/​accessibility/​browser/​accessibleView.ts Documents and types the disposable onOpen contract.
src/​vs/​workbench/​contrib/​accessibility/​browser/​accessibleView.ts Registers onOpen resources in the per-show store.
src/​vs/​workbench/​browser/​parts/​notifications/​notificationAccessibleView.ts Moves close subscription ownership into onOpen.
src/​vs/​workbench/​contrib/​accessibility/​test/​browser/​accessibleView.test.ts Tests re-show and help restoration lifecycles.
src/​vs/​workbench/​test/​browser/​notificationAccessibleView.test.ts Tests notification close-listener disposal.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues label Sep 28, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) marked this pull request as ready for review September 28, 2026 17:09
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/workbench/browser/parts/notifications/notificationAccessibleView.ts

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 65e0116 into microsoft:main Sep 28, 2026
55 of 56 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.141.0 milestone Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants