Skip to content

Conversation

@roblourens
Copy link
Member

@roblourens roblourens commented Nov 23, 2025

For #277318

Copilot AI review requested due to automatic review settings November 23, 2025 02:31
@roblourens roblourens enabled auto-merge (squash) November 23, 2025 02:31
@roblourens roblourens self-assigned this Nov 23, 2025
@vs-code-engineering
Copy link

📬 CODENOTIFY

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

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/agentSessions/chatCloseNotification.ts

@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 23, 2025
Copilot finished reviewing on behalf of roblourens November 23, 2025 02:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a notification to inform users when they close a chat session that has an active request in progress. The notification tells users the chat will continue running in the background and provides a button to open the Agent Sessions view where they can monitor it.

Key Changes

  • Created a new notification function that shows an info message with a "Don't Show Again" option and an "Open Agent Sessions" button
  • Added logic in ChatViewPane to detect when a model with an active request is being disposed
  • Added logic in ChatEditorInput to show the notification when the editor input is disposed with an active request
  • Removed unused Emitter import and onWillDispose event from ChatEditorModel (no longer needed)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/chat/browser/agentSessions/chatCloseNotification.ts New file implementing the notification function with proper localization and "Don't Show Again" functionality
src/vs/workbench/contrib/chat/browser/chatViewPane.ts Added check for active requests before disposing model and imports notification function
src/vs/workbench/contrib/chat/browser/chatEditorInput.ts Added dispose override to check for active requests, removed unused Emitter import and onWillDispose event from ChatEditorModel

Comment on lines +152 to +153
// Check if we're disposing a model with an active request
if (this.modelRef.value?.object.requestInProgress.get()) {
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification is shown before checking if a new model will be assigned. When updateModel is called with a modelRef parameter, the code disposes the old model and immediately assigns a new one. The notification should only be shown when actually closing/disposing a chat session, not when switching between sessions. Consider checking if !modelRef or moving the check after confirming there's no replacement model.

Suggested change
// Check if we're disposing a model with an active request
if (this.modelRef.value?.object.requestInProgress.get()) {
// Only show the notification if we're disposing a model with an active request and not replacing it
if (!modelRef && this.modelRef.value?.object.requestInProgress.get()) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point?

{
label: nls.localize('chat.openAgentSessions', "Open Agent Sessions"),
run: async () => {
await viewsService.openView(AGENT_SESSIONS_VIEW_ID, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to wait here or can fire & forget?

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this: once the agent sessions view is merged with the Chat view, there is no real support for "opening" a view that shows all sessions unless we force the Chat view into the empty state.

This might need another form of UI, like a quick pick to allow to quickly glance over all sessions. Something we do not have yet. Or alternatively, something in the Chat view to bring up a picker (e.g. over the chat session title).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants