Repository navigation
Stop chat progress signals once the request settles - #337883
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits intoSep 25, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Conversation
ChatAccessibilityService only removed a pending progress signal scheduler when a caller reported the response. Widgets that attach to an in-progress request (e.g. the Agents window new-session flow) never do, so every such session left a scheduler and its 5s signal loop alive. The map was also keyed by URI identity, so equal session URIs never matched. Related to #146841 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A transient tool-confirmation state permanently removes progress signaling when processing later resumes.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Stops leaked chat accessibility progress schedulers when requests finish or models are disposed.
Changes:
- Uses URI-aware scheduler lookup.
- Adds model lifecycle cleanup and regression tests.
| File | Description |
|---|---|
chatAccessibilityService.ts |
Tracks and disposes progress signals. |
chatAccessibilityService.test.ts |
Tests completion, disposal, and URI equality. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
requestInProgress is false while a response waits for a confirmation or elicitation, so keep the pending entry until hasActiveRequest settles and restart the scheduler when processing resumes. Co-authored-by: Copilot <[email protected]>
Reruns cancel the active request right before sending its replacement, so only stop once the model settles as idle. Let ChatWidget pass the model it displays so unregistered models (the Agents window preparation transcript) still clean up on disposal. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Already-idle requests that fail before becoming active can still retain a scheduler indefinitely.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Resolved since last review (1)
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 25, 2026 09:29
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 25, 2026 09:29
Ladislau Szomoru (lszomoru)
approved these changes
Sep 25, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
agents/leak-chat-accessibility-progress-signal
branch
September 25, 2026 09:38
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Sep 27, 2026
* Stop chat progress signals once the request settles ChatAccessibilityService only removed a pending progress signal scheduler when a caller reported the response. Widgets that attach to an in-progress request (e.g. the Agents window new-session flow) never do, so every such session left a scheduler and its 5s signal loop alive. The map was also keyed by URI identity, so equal session URIs never matched. Related to microsoft#146841 Co-authored-by: Copilot <[email protected]> * Pause chat progress signals while a request waits for input requestInProgress is false while a response waits for a confirmation or elicitation, so keep the pending entry until hasActiveRequest settles and restart the scheduler when processing resumes. Co-authored-by: Copilot <[email protected]> * Keep progress signals for reruns and unregistered chat models Reruns cancel the active request right before sending its replacement, so only stop once the model settles as idle. Let ChatWidget pass the model it displays so unregistered models (the Agents window preparation transcript) still clean up on disposal. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> (cherry picked from commit 9e5647a) Adapted for VSCode-UTCS: only the lifecycle import line conflicted, because this fork's service also keeps chat toasts; both import sets are merged. The acceptRequest logic is identical to upstream. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UoeuD6W9qnRA5qYK2dNZvP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related to #146841
Leak
ChatAccessibilityService.acceptRequest()stores anAccessibilityProgressSignalSchedulerin_pendingSignalMap. It was removed only byacceptResponse()ordisposeRequest(). Some callers never report a response. For example, theChatWidget.viewModelsetter callsacceptRequest(uri, true)when it attaches to a request that is already in progress. That happens for every session created from the Agents window new-session composer. Each such session left a scheduler behind, and itsplaySignalLoopsetTimeout chain ran every 5 s forever. The map was also keyed by URI object identity, soacceptResponsewith an equal but different URI instance never removed the entry.Retainer:
ChatAccessibilityService._pendingSignalMap→Map→AccessibilityProgressSignalScheduler(+ the signal loop timer).Fix
ResourceMap.hasActiveRequestsettles as false or the model is disposed. The scheduler pauses whilerequestInProgressis false (tool confirmation or elicitation) and restarts when processing resumes.acceptRequestand thenresendRequest, which synchronously cancels the active request and adds its replacement. So the entry is only removed oncehasActiveRequestis still false after that call (a 0 msRunOnceScheduler).ChatWidgetpasses the model it displays. Models that aren't registered withIChatServicestill clean up when disposed, such as the Agents window preparation transcript (sessions/contrib/chat/browser/chatView.ts).Measurement
Code OSS
--agentsagainst the local mock agent host (--enable-mock-agent). 6 rounds of "new session → send prompt", with live instance counts from heap snapshots after forced GC. Leave-one-out: only this change was reverted.Tests
New
chatAccessibilityService.test.ts. Covers: settling without a reported response, pausing and resuming around a confirmation (true → false → true), a rerun that cancels the active request before its replacement, model disposal (registered and unregistered models), and matching of equal URIs.Known pre-existing issue (out of scope)
On
maintoo, "rerun without" (participant detection) while the original request is still streaming loses the rerun's progress sound. The original request'sChatWidgetchain later callsacceptResponsefor the same session, which deletes the rerun's entry. That stale call also plays "response received" and announces the rerun's partial text. This isn't a leak and this PR doesn't change it, so I'm leaving it for a separate fix.