Repository navigation
[Perf] Release discarded draft session state - #348922
Merged
Merged
Conversation
Clean up canvas ownership, weakly retain approval observables, and release host identities after removal notification delivery while preserving accepted sessions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the upstream resource-URI mapper test harness alongside draft-removal notification coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Removal cleanup discards aliases that are not restored on backend re-publication, leaving existing cloud-task URIs without backend routing.
1 open issue
What changed in this PR
Addresses #347907 by releasing state retained by discarded or replaced new-session drafts in the Agents window, while preserving accepted and reused session identities.
Changes:
- Connects draft lifecycle events to canvas-owner cleanup and closes inputs before presentation changes.
- Weakly caches approval observables so unused entries can be collected.
- Defers host identity cleanup until removal notifications are delivered, with regression tests for retention and lifecycle behavior.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionApprovalModel.test.ts |
Tests observable identity preservation and garbage collection. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts |
Tests removal delivery across multiple list controllers. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.ts |
Replaces strong approval caching with weak references. |
src/vs/workbench/contrib/canvases/electron-browser/canvasService.ts |
Starts input closure before removing presentations. |
src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasService.test.ts |
Tests draft cleanup, dismissal reset, and reused identities. |
src/vs/sessions/contrib/canvases/electron-browser/sessionCanvasService.ts |
Removes canvas owners when drafts are discarded or replaced. |
src/vs/platform/agentHost/test/browser/agentHostConnectionsService.test.ts |
Tests connection-scoped cleanup and re-registration. |
src/vs/platform/agentHost/browser/agentHostConnectionsService.ts |
Adds deferred cleanup of removed backend mappings and aliases. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
…tten by Copilot) Keep catalog aliases bound until their owner releases them, avoid restoring removed canonical mappings, and provide the draft-discard event in the canvas working-set test harness. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
|
No demo for |
roblourens
marked this pull request as ready for review
November 17, 2026 20:35
roblourens
enabled auto-merge
November 17, 2026 20:35
Benjamin Christopher Simmonds (benibenj)
approved these changes
Nov 17, 2026
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Ulugbek Abdullaev (@ulugbekna)Matched files:
Joaquín Ruales (@jruales)Matched files:
|
Ben Villalobos (benvillalobos)
approved these changes
Nov 17, 2026
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.

Fixes #347907.
Release state retained after new-session drafts are discarded or replaced:
Preserves accepted/reused session identity and leaves the existing PR-review-state repair unchanged.
Focused regression cases exercise repeated draft creation/removal, forced-GC approval collection, canvas close/dismissal behavior, opaque backend identities, alias survival through unpublication/republication, and multiple session-list consumers. Claude Opus 5.5 reviewed the change in two initial rounds and a focused follow-up; the notification-ordering and alias-lifetime findings are fixed, with no remaining findings. A shared canvas working-set test mock now supplies the draft-discard event used by the real service.
Completed local checks:
The reported Linux/mock-CAPI composer-return scenario and whole-application forced-GC heap slope were not rerun; these checks establish the individual retention mechanisms rather than a measured application-wide heap improvement.
(Written by Copilot)