Skip to content

refactor: streamline session option group selection logic and improve test coverage#308743

Merged
DonJayamanne merged 10 commits intomainfrom
don/tall-nightingale
Apr 10, 2026
Merged

refactor: streamline session option group selection logic and improve test coverage#308743
DonJayamanne merged 10 commits intomainfrom
don/tall-nightingale

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 9, 2026 10:19
@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 refactors Copilot CLI session option-group selection behavior (repo/branch/isolation) to produce more consistent defaults—especially in welcome-view (MRU) scenarios—and expands unit test coverage around these flows. It also starts returning locked option values for existing sessions so the session UI can reflect the resolved/locked selections.

Changes:

  • Auto-select the first MRU repository in welcome view (and fall back to the first item when a previous selection is no longer present).
  • When branch selection is locked (workspace isolation), ignore any previous branch selection and snap back to HEAD; adjust locked branch group items accordingly.
  • For existing sessions, populate ChatSession.options with locked option values derived from the existing-session input-state groups.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts Updates/extends tests to cover new selection/locking behavior for MRU repo + branch groups.
extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts Refines welcome-view repository selection and locked-branch selection behavior.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Adds locked option values to existing session content and removes an unused no-op handler.

Copilot's findings

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Screenshot Changes

Base: 1028f069 Current: 0c80bc19

Changed (2)

agentSessionsViewer/WithBadge/Dark
Before After
before after
agentSessionsViewer/WithBadge/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

Refactors Copilot CLI session dropdown handling to derive selections from ChatSessionInputState (instead of legacy option payloads), while expanding unit coverage for selection/locking behavior in welcome-view and branch/isolation scenarios.

Changes:

  • Add ChatSessionContext.inputState to the proposed sessions provider API and deprecate initialSessionOptions.
  • Centralize extraction of selected folder/branch/isolation from ChatSessionInputState and update session initialization call sites accordingly.
  • Expand tests around option group building, default selections, and lock/reset behavior.
Show a summary per file
File Description
extensions/copilot/src/extension/vscode.proposed.chatSessionsProvider.d.ts Deprecates initialSessionOptions and introduces inputState on ChatSessionContext; clarifies command arg behavior.
extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts Adds helper to read selected options from input state; adjusts default selection and locked-branch behavior; simplifies input-state rebuild path.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Switches request/session init plumbing to pass selections derived from input state; populates options for existing sessions from locked groups.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionInitializer.ts Refactors initializer APIs to take a chat resource + structured init options rather than parsing legacy option entries.
extensions/copilot/src/extension/chatSessions/vscode-node/test/sessionOptionGroupBuilder.spec.ts Adds/updates unit tests for new selection extraction and welcome-view/locking behaviors.
extensions/copilot/src/extension/chatSessions/vscode-node/test/chatSessionInitializer.spec.ts Updates tests to match the initializer API refactor and option-passing changes.
extensions/copilot/package.json Bumps vscodeCommit pointer.

Copilot's findings

  • Files reviewed: 6/7 changed files
  • Comments generated: 2

@DonJayamanne DonJayamanne force-pushed the don/tall-nightingale branch from 333bd69 to 5167b56 Compare April 10, 2026 04:08
roblourens
roblourens previously approved these changes Apr 10, 2026
@DonJayamanne DonJayamanne enabled auto-merge (squash) April 10, 2026 04:34
@DonJayamanne DonJayamanne merged commit dcacca1 into main Apr 10, 2026
26 checks passed
@DonJayamanne DonJayamanne deleted the don/tall-nightingale branch April 10, 2026 04:49
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 10, 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.

3 participants