Skip to content

less dependency on activeSession for pickers - #320627

Merged
Benjamin Christopher Simmonds (benibenj) merged 2 commits into
mainfrom
benibenj/scattered-wallaby
Jun 9, 2026
Merged

Benjamin Christopher Simmonds (benibenj) merged 2 commits into
mainfrom
benibenj/scattered-wallaby

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Copilot Generated Description: Reduce reliance on activeSession by introducing observable session management for various pickers, allowing for more flexible session handling.

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 reduces reliance on the global ISessionsManagementService.activeSession by introducing a scoped, observable session context (ISessionInputContext) and threading that session observable through picker constructors (mode/model/permission/isolation/branch, etc.). This enables toolbars/pickers hosted in different chat input instances to reliably operate on the correct session (rather than whichever session is currently “active” in the window).

Changes:

  • Introduces ISessionInputContext as a scoped service that publishes the session observable the hosting chat input should act upon.
  • Updates Copilot and Agent Host picker implementations (and their contributions) to accept an IObservable<IActiveSession | undefined> instead of self-resolving activeSession.
  • Reworks the sessions model picker wiring so it can be constructed with the correct scoped session context from NewChatInputWidget.
Show a summary per file
File Description
src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/isolationPicker.test.ts Updates unit test to pass a session observable into IsolationPicker.
src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/claudePermissionModePicker.test.ts Updates unit test to pass a session observable into ClaudePermissionModePicker.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/permissionPicker.ts Makes CopilotPermissionPickerDelegate depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/modePicker.ts Makes ModePicker depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker.contribution.ts Uses scoped instantiation to obtain ISessionInputContext.session and threads it into picker construction on mobile.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/isolationPicker.ts Makes IsolationPicker depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.ts Updates action view item factories to use ISessionInputContext and pass session observables into pickers/delegates.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/claudePermissionModePicker.ts Makes ClaudePermissionModePicker depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/branchPicker.ts Makes BranchPicker depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostClaudePermissionModePicker.test.ts Updates unit test to pass a session observable into AgentHostClaudePermissionModePicker.
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHost/agentHostPermissionPickerDelegate.test.ts Updates unit test to pass a session observable into AgentHostPermissionPickerDelegate.
src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatInputConfigPicker.ts Makes the mobile combined config picker use a passed session observable via ISessionInputContext.
src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileAgentHostModePicker.ts Updates mobile mode picker subclass to pass the session observable into its base class.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.ts Threads ISessionInputContext.session into multiple picker factories and removes reliance on a stored instantiation service.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerDelegate.ts Makes delegate depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostPermissionPickerActionItem.ts Threads the session observable through to delegate creation and active-config resolution logic.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostModePicker.ts Makes the shared agent host enum pickers depend on a passed session observable instead of the global active session service.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostClaudePermissionModePicker.ts Updates picker to pass the session observable into the new base constructor signature.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.ts Uses ISessionInputContext to construct ModePicker and route selections against the correct session.
src/vs/sessions/contrib/chat/browser/sessionTypePicker.ts Makes SessionTypePicker render/refresh based on a provided session observable.
src/vs/sessions/contrib/chat/browser/sessionInputContext.ts Adds ISessionInputContext service (global fallback + per-widget scoped implementation).
src/vs/sessions/contrib/chat/browser/newChatWidget.ts Threads a session observable into NewChatInputWidget and adjusts history-key behavior for the new-session composer.
src/vs/sessions/contrib/chat/browser/newChatInSessionWidget.ts Threads a session observable into NewChatInputWidget and adjusts history-key behavior for new-chat-in-session.
src/vs/sessions/contrib/chat/browser/newChatInput.ts Creates a scoped instantiation service for toolbars (incl. ISessionInputContext) and wires the model picker via actionViewItemProvider.
src/vs/sessions/contrib/chat/browser/modelPicker.ts Makes ModelPicker depend on a passed session observable and removes the prior workbench contribution-based action view item registration.
src/vs/sessions/contrib/chat/browser/mobile/mobileSessionTypePicker.ts Updates mobile session type picker subclass to accept and forward a session observable.

Copilot's findings

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

@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit e52aaf5 into main Jun 9, 2026
25 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/scattered-wallaby branch June 9, 2026 21:12
@vs-code-engineering vs-code-engineering Bot added this to the 1.125.0 milestone Jun 9, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants