Skip to content

Limit Copilot CLI startup session listing#322026

Open
ben-dlwlrma wants to merge 2 commits into
microsoft:mainfrom
ben-dlwlrma:fix-copilot-cli-session-listing
Open

Limit Copilot CLI startup session listing#322026
ben-dlwlrma wants to merge 2 commits into
microsoft:mainfrom
ben-dlwlrma:fix-copilot-cli-session-listing

Conversation

@ben-dlwlrma

Copy link
Copy Markdown

Related to #319710 and #321901.

This limits the initial Copilot CLI session list refresh to a bounded metadata request and skips eager label resolution for that startup list. The full session title path remains available for explicit session resolution, while startup no longer needs to load full session histories for every persisted CLI session.

Validation run in the standalone Copilot Chat checkout before porting this minimal diff into vscode:

  • npm exec -- vitest --run --pool=forks src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts src/extension/chatSessions/vscode-node/test/copilotCLIChatSessions.spec.ts src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts
  • npm run typecheck -- --pretty false
  • npm run lint -- --max-warnings=0 on the touched Copilot Chat files
  • git diff --check
  • npm run compile

The vscode fork checkout used for this PR is sparse and only contains the touched extensions/copilot paths, so I did not rerun the full vscode repository test suite there. Account-backed E2E for an existing Copilot CLI session store is also not included in this draft.

Copilot AI review requested due to automatic review settings June 19, 2026 00:38
@ben-dlwlrma

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 optimizes Copilot CLI chat session listing at startup by requesting only bounded session metadata and avoiding eager session-label resolution, reducing the amount of per-session history loading performed during initial refresh.

Changes:

  • Add IListCopilotCLISessionsOptions to ICopilotCLISessionService.getAllSessions(...), supporting metadataLimit and resolveLabels.
  • Update both the startup session refresh path and the legacy session item provider path to use metadataLimit: 20 and resolveLabels: false.
  • Extend unit tests to validate metadata limit propagation and that disabling label resolution avoids full session loads.

Reviewed changes

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

Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/test/copilotCLIChatSessions.spec.ts Updates VS Code-side tests to assert bounded startup refresh and bounded legacy item-provider refresh.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Bounds the legacy session item provider refresh by requesting limited metadata and skipping label resolution.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Bounds the startup session list refresh to limited metadata and skips eager label resolution.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/testHelpers.ts Updates mock SDK session manager to accept (and ignore) a metadataLimit option.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts Adds coverage for passing metadataLimit to the SDK and for skipping full session loads when label resolution is disabled.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts Implements bounded metadata listing and optional label resolution skipping; de-dupes in-flight getAllSessions work by options key.

@ben-dlwlrma ben-dlwlrma marked this pull request as ready for review June 19, 2026 00:47
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