Repository navigation
less dependency on activeSession for pickers - #320627
Merged
Benjamin Christopher Simmonds (benibenj) merged 2 commits intoJun 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
ISessionInputContextas 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-resolvingactiveSession. - 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
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jun 9, 2026
Benjamin Christopher Simmonds (benibenj)
merged commit Jun 9, 2026
e52aaf5
into
main
25 checks passed
Benjamin Christopher Simmonds (benibenj)
deleted the
benibenj/scattered-wallaby
branch
June 9, 2026 21:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copilot Generated Description:Reduce reliance on activeSession by introducing observable session management for various pickers, allowing for more flexible session handling.