Skip to content

chatSessions: optimize workspace changes handling for shared repositories#308649

Merged
DonJayamanne merged 3 commits intomainfrom
don/secondary-moth
Apr 9, 2026
Merged

chatSessions: optimize workspace changes handling for shared repositories#308649
DonJayamanne merged 3 commits intomainfrom
don/secondary-moth

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

Fixes #308645

Copilot AI review requested due to automatic review settings April 9, 2026 00:44
@DonJayamanne DonJayamanne self-assigned this Apr 9, 2026
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 addresses performance issues when loading Copilot CLI Sessions in workspaces with many folders by deduplicating/serializing workspace-change computations across sessions that share the same underlying repository + branch context.

Changes:

  • Introduces a repo-scoped cache key (repo path + base branch + branch) so multiple sessions can reuse the same computed workspace changes result.
  • Adds a repo-level sequencer to ensure only one git computation runs per shared repo key at a time.
  • Extends unit tests to cover shared-repo caching behavior and cache invalidation on tracked-folder deletion.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts Adds repo-keyed caching + repo-level sequencing for workspace changes, plus session→repoKey tracking and invalidation.
extensions/copilot/src/extension/chatSessions/vscode-node/test/chatSessionWorkspaceFolderService.spec.ts Adds tests validating shared-repo cache reuse, branch isolation, and invalidation behavior.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

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

Optimizes Copilot CLI chat session “workspace changes” computation by introducing repo-scoped caching/serialization so multiple sessions that reference the same repository/branch/base branch can reuse work and avoid duplicate git operations (addressing #308645).

Changes:

  • Add repo-keyed cache + repo-level sequencer to share/serialize getWorkspaceChanges across sessions with identical repo+baseBranch+branch.
  • Add a negative cache for sessions without repository properties to avoid repeated metadata reads.
  • Extend unit tests to cover cache invalidation, negative caching, and shared-repo serialization behavior.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts Introduces repo-keyed caching/serialization and negative caching for workspace changes.
extensions/copilot/src/extension/chatSessions/vscode-node/test/chatSessionWorkspaceFolderService.spec.ts Adds tests validating repo-level caching behavior, negative caching, and invalidation scenarios.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

@DonJayamanne DonJayamanne marked this pull request as ready for review April 9, 2026 02:14
@DonJayamanne DonJayamanne enabled auto-merge (squash) April 9, 2026 02:14
@DonJayamanne DonJayamanne merged commit e4f6e11 into main Apr 9, 2026
23 checks passed
@DonJayamanne DonJayamanne deleted the don/secondary-moth branch April 9, 2026 03:25
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 9, 2026
joshspicer pushed a commit that referenced this pull request Apr 9, 2026
…ries (#308649)

* chatSessions: optimize workspace changes handling for shared repositories

* Updates

* updates
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 CLI: Loading Sessions is very slow

3 participants