Skip to content

Agents - add open file/open changes actions#311648

Merged
lszomoru merged 1 commit intomainfrom
lszomoru/useful-finch
Apr 21, 2026
Merged

Agents - add open file/open changes actions#311648
lszomoru merged 1 commit intomainfrom
lszomoru/useful-finch

Conversation

@lszomoru
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 21, 2026 10:14
@lszomoru lszomoru enabled auto-merge (squash) April 21, 2026 10:14
@lszomoru lszomoru self-assigned this Apr 21, 2026
@lszomoru lszomoru added this to the 1.118.0 milestone Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 1f3b8645 Current: a2a0e494

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
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 “Open File” / “Open Changes” actions intended to improve navigation from the Agents/Sessions changes UI, and adjusts command ordering in the Copilot menu contribution.

Changes:

  • Register new Open File and Open Changes actions for session change entries.
  • Implement editor-opening logic for selected change resources.
  • Reorder github.copilot.sessions.discardChanges within the per-change toolbar menu.
Show a summary per file
File Description
src/vs/sessions/contrib/changes/browser/changesViewActions.ts Adds new Actions (OpenFileAction, OpenChangesAction) and wires them into a chat editing session changes menu.
extensions/copilot/package.json Adjusts group ordering for github.copilot.sessions.discardChanges under chat/input/editing/sessionChangeToolbar.

Copilot's findings

Comments suppressed due to low confidence (3)

src/vs/sessions/contrib/changes/browser/changesViewActions.ts:230

  • OpenFileAction.run currently opens the raw resource URIs. In this view, the selection URI can be GitDiffChange.uri (working-tree path) even when the change represents a deletion, where the file may not exist. Consider looking up the matching change (as OpenChangesAction does) and opening change.modifiedUri ?? change.uri ?? change.originalUri (and specifically originalUri for deletions) so the command works for added/deleted files too.
	async run(accessor: ServicesAccessor, _sessionResource: URI, _ref: string, ...resources: URI[]): Promise<void> {
		const editorService = accessor.get(IEditorService);
		await Promise.all(resources.map(resource => editorService.openEditor({ resource })));
	}

src/vs/sessions/contrib/changes/browser/changesViewActions.ts:257

  • The change lookup in OpenChangesAction uses isEqual(change.modifiedUri ?? change.originalUri, resource), but for IChatSessionFileChange2 the selectable URI is typically change.uri (workspace path) while originalUri/modifiedUri are often git: URIs with refs (see toIChatSessionFileChange2). This means the action won’t find a matching change for many entries. Match on fsPath (or include change.uri in the comparison) similar to other session-change matching code.
		for (const resource of resources) {
			const change = changes?.find(change =>
				isEqual(change.modifiedUri ?? change.originalUri, resource));

src/vs/sessions/contrib/changes/browser/changesViewActions.ts:265

  • OpenChangesAction always calls editorService.openEditor({ original: { resource: change.originalUri }, modified: { resource: change.modifiedUri } }) even though originalUri or modifiedUri can be undefined for added/deleted changes (and for IChatSessionFileChange2 they’re optional). This can end up opening an unintended untitled editor or failing to open the diff. Handle the add/delete cases explicitly (open single editor when one side is missing) or reuse the existing open logic from ChangesViewPane._openFileItem/openChanges().
			await editorService.openEditor({
				original: { resource: change.originalUri },
				modified: { resource: change.modifiedUri },
			});
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment on lines +213 to +218
menu: {
id: MenuId.ChatEditingSessionChangesToolbar,
group: 'navigation',
order: 1,
when: IsSessionsWindowContext,
alt: {
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

OpenFileAction is contributed to MenuId.ChatEditingSessionChangesToolbar (session-level toolbar), but its run expects arguments shaped like ChangesViewActionRunner provides (sessionResource, discardRef, ...selected URIs). The session changes toolbar is invoked with args [sessionResource, metadata] (no selected resources), so this action will effectively be a no-op there. This looks like it should be contributed to MenuId.ChatEditingSessionChangeToolbar (per-change row toolbar) instead, consistent with the related chat/input/editing/sessionChangeToolbar menu contribution in extensions/copilot/package.json.

This issue also appears in the following locations of the same file:

  • line 227
  • line 254
  • line 262

Copilot uses AI. Check for mistakes.
Comment on lines 5682 to 5686
{
"command": "github.copilot.sessions.discardChanges",
"when": "chatSessionType == copilotcli && isSessionsWindow && sessions.hasGitRepository && sessions.changesVersionMode == branchChanges",
"group": "navigation@1"
"group": "navigation@2"
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

This menu contribution change reorders github.copilot.sessions.discardChanges within chat/input/editing/sessionChangeToolbar (per-change toolbar). However, the new core actions in this PR are currently contributed to MenuId.ChatEditingSessionChangesToolbar (session-level toolbar) instead of MenuId.ChatEditingSessionChangeToolbar, so the intended ordering change may not take effect as expected. Either move the new actions to the ...sessionChangeToolbar menu or revert/adjust this group change accordingly.

See below for a potential fix:

					"when": "chatSessionType == copilotcli && isSessionsWindow && sessions.hasGitRepository && sessions.changesVersionMode == branchChanges"

Copilot uses AI. Check for mistakes.
@lszomoru lszomoru merged commit 38df135 into main Apr 21, 2026
30 checks passed
@lszomoru lszomoru deleted the lszomoru/useful-finch branch April 21, 2026 10:36
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.

3 participants