Skip to content

- remember draft state in new chat#298983

Merged
sandy081 merged 2 commits intomainfrom
sandy081/basic-stoat
Mar 3, 2026
Merged

- remember draft state in new chat#298983
sandy081 merged 2 commits intomainfrom
sandy081/basic-stoat

Conversation

@sandy081
Copy link
Member

@sandy081 sandy081 commented Mar 3, 2026

  • move changes action to title

- move changes action to title
Copilot AI review requested due to automatic review settings March 3, 2026 15:32
@sandy081 sandy081 enabled auto-merge (squash) March 3, 2026 15:32
@sandy081 sandy081 self-assigned this Mar 3, 2026
@vs-code-engineering vs-code-engineering bot added this to the March 2026 milestone Mar 3, 2026
benibenj
benibenj previously approved these changes Mar 3, 2026
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 updates the Agent Sessions window UX by persisting the New Chat “draft” (including target/mode/repo selection) across reloads and by surfacing the active session’s changes summary in the title bar.

Changes:

  • Persist/restore New Chat draft state (input, attachments, target, isolation mode, branch, repo/folder) via workspace storage.
  • Add a changes (+/-) summary next to the repo label in the sessions title bar.
  • Refactor the Changes view titlebar action plumbing (removing the custom action view item / menu contribution).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.ts Computes and renders insertions/deletions summary in the title bar pill.
src/vs/sessions/contrib/sessions/browser/media/sessionsTitleBarWidget.css Styles the added changes summary (+/-) in the command center title widget.
src/vs/sessions/contrib/chat/browser/sessionTargetPicker.ts Adds preferred/programmatic isolation mode APIs to support draft restore.
src/vs/sessions/contrib/chat/browser/newChatViewPane.ts Implements draft-state tracking, persistence, and restore; adjusts send flow to use async/await.
src/vs/sessions/contrib/chat/browser/branchPicker.ts Adds preferred branch support so draft restore can influence initial branch selection.
src/vs/sessions/contrib/changesView/browser/changesViewActions.ts Removes the titlebar menu contribution/custom view item, leaving only the action registration + context key binding.

Comment on lines +987 to +1002
try {
await this.sessionsManagementService.sendRequestForNewSession(
session.resource,
options?.openNewAfterSend ? { openNewSessionView: true } : undefined
);
this._newSessionListener.clear();
this._contextAttachments.clear();
}, e => {
} catch (e) {
this.logService.error('Failed to send request:', e);
}).finally(() => {
this._sending = false;
this._editor.updateOptions({ readOnly: false });
this._updateSendButtonState();
this._updateInputLoadingState();
});
}


this._sending = false;
this._editor.updateOptions({ readOnly: false });
this._updateSendButtonState();
this._updateInputLoadingState();
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

After sendRequestForNewSession completes, sessionsManagementService disposes its internal _newSession (see SessionsManagementService.sendRequestForNewSession sets _newSession.value = undefined). This widget still keeps the same INewSession instance in its own MutableDisposable, so it can end up holding/disposing an already-disposed session later (and potentially acting on a disposed object). Clear/leak the widget’s _newSession reference after a successful send (as the previous code did) to avoid double-dispose and stale state.

Copilot uses AI. Check for mistakes.
@@ -34,12 +25,6 @@ const openChangesViewActionOptions: IAction2Options = {
title: localize2('openChangesView', "Changes"),
icon: Codicon.diffMultiple,
f1: false,
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

OpenChangesViewAction is still registered but it’s no longer contributed to any menu and has f1: false, so it becomes effectively unreachable from the UI. Either re-add a menu contribution (e.g. Menus.TitleBarSessionMenu or the new title bar widget) and gating when clause, or make it discoverable via the Command Palette (f1: true).

Suggested change
f1: false,
f1: true,

Copilot uses AI. Check for mistakes.
Comment on lines 169 to +186
const separator1 = $('span.agent-sessions-titlebar-separator');
separator1.textContent = '\u00B7';
centerGroup.appendChild(separator1);

const repoEl = $('span.agent-sessions-titlebar-repo');
repoEl.textContent = repoLabel;
centerGroup.appendChild(repoEl);
}

// Changes summary shown next to the repo
if (changesSummary) {
const separator2 = $('span.agent-sessions-titlebar-separator');
separator2.textContent = '\u00B7';
centerGroup.appendChild(separator2);

const changesEl = $('span.agent-sessions-titlebar-changes');

const addedEl = $('span.agent-sessions-titlebar-changes-added');
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The title bar now renders a changes summary, but it’s purely informational and doesn’t provide a way to open the Changes view. Since the existing OpenChangesViewAction menu entry was removed, this can leave users without a title bar affordance to navigate to changes. Consider wiring a click/keyboard handler on the changes summary to open the Changes view (or keep a menu action) so the summary is actionable.

Copilot uses AI. Check for mistakes.
@sandy081 sandy081 merged commit 1b92648 into main Mar 3, 2026
20 checks passed
@sandy081 sandy081 deleted the sandy081/basic-stoat branch March 3, 2026 15:58
mrleemurray pushed a commit that referenced this pull request Mar 3, 2026
- move changes action to 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