Skip to content

feat(copilotcli): Perf impromvent by lazy loading chat session items#311817

Merged
DonJayamanne merged 4 commits intomainfrom
don/estimated-cougar
Apr 23, 2026
Merged

feat(copilotcli): Perf impromvent by lazy loading chat session items#311817
DonJayamanne merged 4 commits intomainfrom
don/estimated-cougar

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

Co-authored-by: Copilot copilot@github.com

Fixes #309466

Copilot AI review requested due to automatic review settings April 22, 2026 02:00
@DonJayamanne DonJayamanne self-assigned this Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

⚠️ API Proposal Version Change Detected

The following proposed API files have version changes: vscode.proposed.chatSessionsProvider.d.ts

API proposal version changes should only be used when maintaining compatibility is not possible. Consider keeping the version as is and maintaining backward compatibility.

Any version changes must be adopted by the consuming extensions before the next insiders for the extension to work.


If the version change is required, comment /api-proposal-change-required to unblock this check and acknowledge that you will update any critical consuming extensions (Copilot Chat).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Screenshot Changes

Base: 92c0a0f6 Current: 465382f8

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
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

This PR introduces lazy resolution of chat session item details so expensive fields (notably git diff–derived changes) are only computed when a session item becomes visible, reducing startup/UI stalls when many sessions exist.

Changes:

  • Adds a proposed API hook to lazily resolve ChatSessionItem details (resolveChatSessionItem) and wires it through ext host ↔ main thread plumbing.
  • Updates the Agents/Sessions UI to trigger lazy resolution when rendering visible items.
  • Implements lazy-loading in Copilot CLI session providers, guarded by a new advanced setting, and adds a lightweight “has cached changes” check in the worktree service.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts Proposed API: adds resolveChatSessionItem hook (provider + controller) and bumps proposal version.
src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts Updates mock service to implement the new resolveSessionItem API.
src/vs/workbench/contrib/chat/common/chatSessionsService.ts Extends IChatSessionsService / controller contracts to support item resolution.
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts Implements resolveSessionItem in the workbench chat sessions service.
src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts Triggers lazy resolve when items render in the session list UI.
src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts Adjusts controller registration to the new signature.
src/vs/workbench/api/common/extHostChatSessions.ts Adds $resolveChatSessionItem and bridges deprecated provider resolve hook via controller surface.
src/vs/workbench/api/common/extHost.protocol.ts Ext host protocol changes: supportsResolve param + resolve RPC.
src/vs/workbench/api/browser/mainThreadChatSessions.ts Main thread controller: adds resolve RPC invocation + per-resource resolve cache.
extensions/copilot/src/platform/configuration/common/configurationService.ts Adds advanced setting key for lazy-loading session items.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Defers building changes eagerly; adds resolve hook to fill in changes lazily.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Same lazy-change strategy for controller-based CLI sessions.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts Adds hasWorktreeChanges to detect cached changes quickly.
extensions/copilot/src/extension/chatSessions/common/chatSessionWorktreeService.ts Extends interface with hasWorktreeChanges.
extensions/copilot/package.nls.json Adds localized description for the new lazy-load setting.
extensions/copilot/package.json Contributes the new advanced setting to VS Code configuration.

Copilot's findings

  • Files reviewed: 15/16 changed files
  • Comments generated: 3

Comment thread src/vs/workbench/api/browser/mainThreadChatSessions.ts Outdated
Comment thread extensions/copilot/package.nls.json Outdated
Comment thread src/vs/workbench/api/browser/mainThreadChatSessions.ts
Comment thread src/vs/workbench/contrib/chat/common/chatSessionsService.ts Outdated
Comment thread src/vs/workbench/contrib/chat/common/chatSessionsService.ts Outdated
Comment thread src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts Outdated
Copy link
Copy Markdown
Contributor Author

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

address the code review comments

Copy link
Copy Markdown
Contributor Author

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

@copilot address the review comentsm

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

@copilot address the review comentsm

Renamed the NLS key from github.copilot.config.lazyLoadSessionItem.enabled to github.copilot.config.cli.lazyLoadSessionItem.enabled in c03da85a, updating both package.nls.json and the markdownDescription reference in package.json. All other review comments were addressed in prior commits (renames + tests in 65ca61b7).

@DonJayamanne DonJayamanne force-pushed the don/estimated-cougar branch 3 times, most recently from 52e59d7 to 8885c14 Compare April 22, 2026 23:17
Co-authored-by: Copilot <copilot@github.com>
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.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:446

  • originalRef for workspace changes no longer falls back to repositoryProperties.baseCommit when mergeBaseCommit is unavailable. That can make diff URIs point at HEAD and show incorrect/unstable comparisons. Consider restoring the previous fallback (mergeBaseCommit ?? baseCommit ?? 'HEAD') so workspace diffs remain anchored even when merge-base computation fails or hasn't been recorded yet.
				const originalRef = repositoryProperties?.mergeBaseCommit ?? 'HEAD';

  • Files reviewed: 8/8 changed files
  • Comments generated: 4

Comment thread extensions/copilot/package.nls.json Outdated
DonJayamanne and others added 3 commits April 23, 2026 09:42
…lotCLIChatSessions.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
@DonJayamanne DonJayamanne marked this pull request as ready for review April 23, 2026 00:13
@DonJayamanne DonJayamanne enabled auto-merge (squash) April 23, 2026 00:13
@DonJayamanne DonJayamanne merged commit 8c4616c into main Apr 23, 2026
26 checks passed
@DonJayamanne DonJayamanne deleted the don/estimated-cougar branch April 23, 2026 00:16
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 23, 2026
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.

Copilot Chat: ChatSessionWorkspaceFolderService polling loop freezes VS Code when large numbers of chat sessions have accumulated

4 participants