Repository navigation
sessions: improve draft cleanup and restore file references - #351261
Merged
Megan Rogge (meganrogge) merged 1 commit intoNov 30, 2026
Merged
Megan Rogge (meganrogge) merged 1 commit into
Megan Rogge (meganrogge) merged 1 commit into
Conversation
Release unpublished draft bookkeeping after backend disposal and retain inline references while the draft chat model loads. Fixes microsoft#349936 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No actionable review findings remain for the saved-draft reliability and cleanup changes.
No open issues 🎉
What changed in this PR
This PR improves saved-draft reliability in the Agents window, addressing lost inline file references in #349936 and cleaning up discarded Agent Host drafts.
Changes:
- Releases discarded draft identities and cached state after successful backend deletion, while keeping failed deletions hidden and preserving owner-held aliases.
- Preserves restored file references and inline pills during asynchronous chat-model binding.
- Limits layout replacement tracking to visible drafts and adds regression coverage.
No actionable findings remain. The PR reports passing compilation, targeted lint, and 1,384 tests; manual UI testing was not performed.
| File | Description |
|---|---|
src/vs/workbench/contrib/sessions/test/browser/chat/sharedChatInputComposer.test.ts |
Tests reference preservation during model loading and draft restoration. |
src/vs/workbench/contrib/sessions/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts |
Releases remote draft registrations and provider-owned aliases. |
src/vs/workbench/contrib/sessions/providers/remoteAgentHost/browser/cloudSandboxTaskSessionsProvider.ts |
Implements the required unregister hook as a no-op. |
src/vs/workbench/contrib/sessions/providers/agentHost/browser/localAgentHostSessionsProvider.ts |
Unregisters discarded local backend identities. |
src/vs/workbench/contrib/sessions/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Coordinates draft cleanup and filters unpublished events before debouncing. |
src/vs/workbench/contrib/sessions/browser/chat/sharedChatInputComposer.ts |
Preserves restored and projected references during model binding. |
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts |
Adds unregister behavior to the remote connection mock. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests cleanup, failed deletion, early discard, and stale listings. |
src/vs/sessions/contrib/layout/test/browser/baseSessionLayoutController.test.ts |
Tests that hidden drafts do not retain replacement entries. |
src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.ts |
Tracks replacements only for the currently shown outgoing draft. |
src/vs/platform/agentHost/test/browser/agentHostConnectionsService.test.ts |
Tests connection-scoped unregistering and alias retention. |
src/vs/platform/agentHost/common/agentHostConnectionsService.ts |
Declares the backend identity unregister API. |
src/vs/platform/agentHost/browser/agentHostConnectionsService.ts |
Implements unregistering through existing identity-removal logic. |
Review effort: Balanced
Megan Rogge (meganrogge)
enabled auto-merge
November 30, 2026 17:46
Ulugbek Abdullaev (ulugbekna)
approved these changes
Nov 30, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 30, 2026
Megan Rogge (meganrogge)
deleted the
agents/fix-saved-drafts-and-cleanup
branch
November 30, 2026 18:55
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 #349936
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/10952
Validation
PATH="$HOME/.nvm/versions/node/v24.22.3/bin:$PATH" pnpm run compile-clientPATH="$HOME/.nvm/versions/node/v24.22.3/bin:$PATH" ./scripts/test.sh --run src/vs/workbench/contrib/sessions/test/browser/chat/sharedChatInputComposer.test.ts --run src/vs/workbench/contrib/sessions/test/browser/sessionDraftsService.test.ts --run src/vs/workbench/contrib/chat/test/browser/widget/input/editor/chatInlineAttachments.test.ts --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts --run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts --run src/vs/platform/agentHost/test/browser/agentHostConnectionsService.test.ts --run src/vs/sessions/contrib/layout/test/browser/baseSessionLayoutController.test.ts --reporter dotgit diff --cached --checkManual UI testing was not performed.