Skip to content

fixes #288433#297951

Merged
isidorn merged 2 commits intomainfrom
isidorn/peculiar-gazelle
Feb 26, 2026
Merged

fixes #288433#297951
isidorn merged 2 commits intomainfrom
isidorn/peculiar-gazelle

Conversation

@isidorn
Copy link
Collaborator

@isidorn isidorn commented Feb 26, 2026

cc @meganrogge
fixes #288433

@isidorn isidorn added this to the February 2026 milestone Feb 26, 2026
@isidorn isidorn self-assigned this Feb 26, 2026
Copilot AI review requested due to automatic review settings February 26, 2026 10:40
@isidorn isidorn enabled auto-merge February 26, 2026 10:40
@vs-code-engineering
Copy link

vs-code-engineering bot commented Feb 26, 2026

📬 CODENOTIFY

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

@jrieken

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

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

Adds a new chat editing command for restoring to the most recent checkpoint and wires it into existing chat UX surfaces (tips + accessibility help).

Changes:

  • Add workbench.action.chat.restoreLastCheckpoint action to restore the current editing session back to the last checkpoint.
  • Ensure the “undo changes” tip is dismissed when the new restore command is used.
  • Document the new command in chat accessibility help for edits/agent views.

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/browser/chatTipService.ts Extends the undo-changes tip exclusion list to include the new restore-last-checkpoint command.
src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts Registers a new Action2 command that restores the session to the last checkpoint.
src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts Adds the new command to the “helpful commands” list for accessibility help text.

Comment on lines +610 to +635
precondition: ContextKeyExpr.and(
ChatContextKeys.inChatSession,
ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, true),
ChatContextKeys.lockedToCodingAgent.negate()
)
});
}

async run(accessor: ServicesAccessor, ...args: unknown[]) {
let item = args[0] as ChatTreeItem | undefined;
const chatWidgetService = accessor.get(IChatWidgetService);
const chatService = accessor.get(IChatService);
const widget = (isChatTreeItem(item) && chatWidgetService.getWidgetBySessionResource(item.sessionResource)) || chatWidgetService.lastFocusedWidget;
if (!isResponseVM(item) && !isRequestVM(item)) {
item = widget?.getFocus();
}

const sessionResource = widget?.viewModel?.sessionResource ?? (isChatTreeItem(item) ? item.sessionResource : undefined);
if (!sessionResource) {
return;
}

const chatModel = chatService.getSession(sessionResource);
if (!chatModel?.editingSession) {
return;
}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

workbench.action.chat.restoreLastCheckpoint can become enabled in the chat widget even when there is no active editing session (e.g. Ask mode). In that case run returns early on !chatModel?.editingSession and the command becomes a no-op. Consider tightening the action precondition to only allow Edit/Agent sessions (e.g. require chatModeKind to be Edit/Agent) or provide user feedback when no editing session is available.

Copilot uses AI. Check for mistakes.

const checkpointRequest = chatModel.checkpoint;
if (!checkpointRequest) {
alert(localize('chat.restoreCheckpoint.none', 'There is no checkpoint to restore.'));
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The localization key 'chat.restoreCheckpoint.none' is introduced here but is used for the new “Restore to Last Checkpoint” action. Using a key/name that matches the command (e.g. chat.restoreLastCheckpoint.none) will make the string easier to find and maintain, and avoid confusion with the existing restore-checkpoint command.

Suggested change
alert(localize('chat.restoreCheckpoint.none', 'There is no checkpoint to restore.'));
alert(localize('chat.restoreLastCheckpoint.none', 'There is no checkpoint to restore.'));

Copilot uses AI. Check for mistakes.
Comment on lines +602 to +606
registerAction2(class RestoreLastCheckpoint extends Action2 {
constructor() {
super({
id: 'workbench.action.chat.restoreLastCheckpoint',
title: localize2('chat.restoreLastCheckpoint.label', "Restore to Last Checkpoint"),
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

Class name RestoreLastCheckpoint is inconsistent with the surrounding action classes in this file (e.g. RestoreCheckpointAction, RemoveAction, EditAction). Renaming to RestoreLastCheckpointAction would better match the established naming pattern for Action2 registrations.

Copilot generated this review using guidance from repository custom instructions.
@isidorn isidorn merged commit 86d2f8e into main Feb 26, 2026
20 checks passed
@isidorn isidorn deleted the isidorn/peculiar-gazelle branch February 26, 2026 14:04
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.

Restore checkpoint is not keyboard accessible

3 participants