Skip to content

Conversation

@osortega
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 20, 2026 23:30
@osortega osortega self-assigned this Jan 20, 2026
Copy link
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 implements functionality to hide the Local session provider option when working in an empty workspace. The goal is to provide a better user experience by not showing Local-related features when there's no workspace context.

Changes:

  • Added an optional isSessionTypeVisible method to the ISessionTypePickerDelegate interface to control session type visibility
  • Implemented logic in the agent sessions welcome page to detect empty workspaces and hide Local provider options accordingly
  • Updated the session target picker to respect visibility settings from the delegate
  • Modified chat input part to hide model picker, mode picker, and option groups when Local session type is hidden

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/browser/chat.ts Added isSessionTypeVisible optional method to ISessionTypePickerDelegate interface
src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts Implemented empty workspace detection and automatic switch to Cloud provider with visibility control delegate
src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.ts Added check to respect delegate's visibility settings for session types
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Added logic to hide model picker, mode picker, and option groups when Local is hidden; introduced HiddenActionViewItem class

Comment on lines +1384 to +1391
// Early exit: if Local session type is hidden via delegate, also hide option groups
// This supports scenarios like empty workspace where Local-related features should be hidden
if (this.options.sessionTypePickerDelegate?.isSessionTypeVisible) {
if (!this.options.sessionTypePickerDelegate.isSessionTypeVisible(AgentSessionProviders.Local)) {
setNoOptions();
return undefined;
}
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here checks if Local session type is hidden, but it doesn't verify if the effectiveSessionType is actually Local. This means option groups will be hidden for ALL session types (including Cloud) when Local is hidden in an empty workspace. The check should only hide option groups when effectiveSessionType equals AgentSessionProviders.Local.

Copilot uses AI. Check for mistakes.
Comment on lines +183 to +186
// If workspace is empty and we're currently on Local, switch to a different provider
const isEmptyWorkspace = this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY;
if (isEmptyWorkspace && this._selectedSessionProvider === AgentSessionProviders.Local) {
this._selectedSessionProvider = AgentSessionProviders.Cloud;
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When switching from Local to Cloud in an empty workspace, there's no guarantee that Cloud provider is available. Cloud is not a built-in provider and must be registered via extension. If Cloud is not available, the code should fall back to the first available non-Local provider, or handle the case where no providers are available gracefully. Consider checking if Cloud is available before setting it, or selecting the first available provider dynamically.

Suggested change
// If workspace is empty and we're currently on Local, switch to a different provider
const isEmptyWorkspace = this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY;
if (isEmptyWorkspace && this._selectedSessionProvider === AgentSessionProviders.Local) {
this._selectedSessionProvider = AgentSessionProviders.Cloud;
// If workspace is empty and we're currently on Local, switch to a different available non-Local provider if possible
const isEmptyWorkspace = this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY;
if (isEmptyWorkspace && this._selectedSessionProvider === AgentSessionProviders.Local) {
const availableProviders = this.agentSessionsService.getAvailableSessionProviders?.() ?? [];
const nonLocalProviders = availableProviders.filter(provider => provider !== AgentSessionProviders.Local);
if (nonLocalProviders.length > 0) {
this._selectedSessionProvider = nonLocalProviders[0];
}

Copilot uses AI. Check for mistakes.
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.

2 participants