From 7db09d155cdb28926417ad3018f5f460e8e2897f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 21:14:10 +0000 Subject: [PATCH 1/2] Initial plan From ee4edc1335d573aad07d0db864a1375cbbd7e9ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 21:35:00 +0000 Subject: [PATCH 2/2] Show sign-in dialog when delegating to session targets while unauthenticated When a user tries to delegate to Copilot CLI, Cloud, or other session targets while not signed in, trigger the sign-in/setup dialog instead of letting the request fail with a non-actionable error. The sign-in check is added to three entry points: - SubmitAction.handleDelegation() for the session target picker - CreateRemoteAgentJobAction.run() for the "Continue in..." dropdown - CreateRemoteAgentJobFromEditorAction.run() for the editor context menu This matches the existing Local session behavior where the setup dialog is shown when the user's entitlement is Unknown and anonymous access is not enabled. Fixes microsoft#296117 Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/12f524df-1f4f-414c-b3bc-5ce531b1b112 Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com> --- .../browser/actions/chatContinueInAction.ts | 19 +++++++++++++++++++ .../browser/actions/chatExecuteActions.ts | 13 ++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts b/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts index 1f5732b9cd628..2f6f56c84e2de 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts @@ -45,6 +45,7 @@ import { IWorkspaceContextService } from '../../../../../platform/workspace/comm import { IAgentSessionsService } from '../agentSessions/agentSessionsService.js'; import { IChatWidget, IChatWidgetService, isIChatViewViewContext } from '../chat.js'; import { ctxHasEditorModification } from '../chatEditing/chatEditingEditorContextKeys.js'; +import { ChatEntitlement, IChatEntitlementService } from '../../../../services/chat/common/chatEntitlementService.js'; import { CHAT_SETUP_ACTION_ID } from './chatActions.js'; import { PromptFileVariableKind, toPromptFileVariableEntry } from '../../common/attachments/chatVariableEntries.js'; @@ -391,6 +392,15 @@ export class CreateRemoteAgentJobAction { const agentSessionsService = accessor.get(IAgentSessionsService); const chatSessionsService = accessor.get(IChatSessionsService); const fileService = accessor.get(IFileService); + const chatEntitlementService = accessor.get(IChatEntitlementService); + + // If the user is not signed in, trigger the sign-in/setup flow before continuing + if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) { + const setupSucceeded = await commandService.executeCommand(CHAT_SETUP_ACTION_ID); + if (!setupSucceeded) { + return; + } + } const remoteJobCreatingKey = ChatContextKeys.remoteJobCreating.bindTo(contextKeyService); @@ -532,6 +542,15 @@ class CreateRemoteAgentJobFromEditorAction { const editorService = accessor.get(IEditorService); const activeEditor = editorService.activeTextEditorControl; const commandService = accessor.get(ICommandService); + const chatEntitlementService = accessor.get(IChatEntitlementService); + + // If the user is not signed in, trigger the sign-in/setup flow before continuing + if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) { + const setupSucceeded = await commandService.executeCommand(CHAT_SETUP_ACTION_ID); + if (!setupSucceeded) { + return; + } + } if (!activeEditor) { return; diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts index a35750ecd16a6..1d35a267a7d61 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts @@ -36,7 +36,8 @@ import { IChatWidget, IChatWidgetService } from '../chat.js'; import { getAgentSessionProvider, AgentSessionProviders } from '../agentSessions/agentSessions.js'; import { getEditingSessionContext } from '../chatEditing/chatEditingActions.js'; import { ctxHasEditorModification, ctxHasRequestInProgress, ctxIsGlobalEditingSession } from '../chatEditing/chatEditingEditorContextKeys.js'; -import { ACTION_ID_NEW_CHAT, CHAT_CATEGORY, clearChatSessionPreservingType, handleCurrentEditingSession, handleModeSwitch } from './chatActions.js'; +import { ChatEntitlement, IChatEntitlementService } from '../../../../services/chat/common/chatEntitlementService.js'; +import { ACTION_ID_NEW_CHAT, CHAT_CATEGORY, CHAT_SETUP_ACTION_ID, clearChatSessionPreservingType, handleCurrentEditingSession, handleModeSwitch } from './chatActions.js'; import { CreateRemoteAgentJobAction } from './chatContinueInAction.js'; import { CTX_HOVER_MODE } from '../../../inlineChat/common/inlineChat.js'; @@ -161,6 +162,16 @@ abstract class SubmitAction extends Action2 { private async handleDelegation(accessor: ServicesAccessor, widget: IChatWidget, delegationTarget: Exclude): Promise { const chatSessionsService = accessor.get(IChatSessionsService); + const chatEntitlementService = accessor.get(IChatEntitlementService); + const commandService = accessor.get(ICommandService); + + // If the user is not signed in, trigger the sign-in/setup flow before delegating + if (chatEntitlementService.entitlement === ChatEntitlement.Unknown && !chatEntitlementService.anonymous) { + const setupSucceeded = await commandService.executeCommand(CHAT_SETUP_ACTION_ID); + if (!setupSucceeded) { + return; + } + } // Find the contribution for the delegation target const contributions = chatSessionsService.getAllChatSessionContributions();