Skip to content

Commit 611b286

Browse files
committed
revert(toolkit): Q <--> Toolkit auth separation notification
Removes the prompt shown in Toolkit that Amazon Q no longer shares connections with it. Some time has passed, active users should have been informed by now. We are still getting telemetry hits indicating that this is being used though. NOTE: Does not revert or remove any separation logic itself. We continue to have separate sessions and also remove any connections in either extension that are extra or don't match the required scopes for that extension. That logic helps us catch auth edge cases.
1 parent e692467 commit 611b286

File tree

6 files changed

+7
-97
lines changed

6 files changed

+7
-97
lines changed

packages/core/src/auth/auth.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,6 @@ export class Auth implements AuthService, ConnectionManager {
339339
metadata: { connectionState: 'unauthenticated' },
340340
})
341341

342-
// Remove the split session logout prompt, if it exists.
343-
if (!isAmazonQ()) {
344-
await globals.globalState.update('aws.toolkit.separationPromptDismissed', true)
345-
}
346-
347342
try {
348343
;(await tokenProvider.getToken()) ?? (await tokenProvider.createToken())
349344
const storedProfile = await this.store.addProfile(id, profile)
@@ -1136,71 +1131,3 @@ export function hasVendedIamCredentials(isC9?: boolean, isSM?: boolean) {
11361131
isSM ??= isSageMaker()
11371132
return isSM || isC9
11381133
}
1139-
1140-
type LoginCommand = 'aws.toolkit.auth.manageConnections' | 'aws.codecatalyst.manageConnections'
1141-
/**
1142-
* Temporary class that handles notifiting users who were logged out as part of
1143-
* splitting auth sessions between extensions.
1144-
*
1145-
* TODO: Remove after some time.
1146-
*/
1147-
export class SessionSeparationPrompt {
1148-
// Local variable handles per session displays, e.g. we forgot a CodeCatalyst connection AND
1149-
// an Explorer only connection. We only want to display once in this case.
1150-
// However, we don't want to set this at the global state level until a user interacts with the
1151-
// notification in case they miss it the first time.
1152-
#separationPromptDisplayed = false
1153-
1154-
/**
1155-
* Open a prompt for that last used command name (or do nothing if no command name has ever been passed),
1156-
* which is useful to redisplay the prompt after reloads in case a user misses it.
1157-
*/
1158-
public async showAnyPreviousPrompt() {
1159-
const cmd = globals.globalState.tryGet('aws.toolkit.separationPromptCommand', String)
1160-
return cmd ? await this.showForCommand(cmd as LoginCommand) : undefined
1161-
}
1162-
1163-
/**
1164-
* Displays a sign in prompt to the user if they have been logged out of the Toolkit as part of
1165-
* separating auth sessions between extensions. It will executed the passed command for sign in,
1166-
* (e.g. codecatalyst sign in vs explorer)
1167-
*/
1168-
public async showForCommand(cmd: LoginCommand) {
1169-
if (
1170-
this.#separationPromptDisplayed ||
1171-
globals.globalState.get<boolean>('aws.toolkit.separationPromptDismissed')
1172-
) {
1173-
return
1174-
}
1175-
1176-
await globals.globalState.update('aws.toolkit.separationPromptCommand', cmd)
1177-
1178-
await telemetry.toolkit_showNotification.run(async () => {
1179-
telemetry.record({ id: 'sessionSeparation' })
1180-
this.#separationPromptDisplayed = true
1181-
void vscode.window
1182-
.showWarningMessage(
1183-
'Amazon Q and AWS Toolkit no longer share connections. Please sign in again to use AWS Toolkit.',
1184-
'Sign In'
1185-
)
1186-
.then(async (resp) => {
1187-
await telemetry.toolkit_invokeAction.run(async () => {
1188-
telemetry.record({ source: 'sessionSeparationNotification' })
1189-
if (resp === 'Sign In') {
1190-
telemetry.record({ action: 'signIn' })
1191-
await vscode.commands.executeCommand(cmd)
1192-
} else {
1193-
telemetry.record({ action: 'dismiss' })
1194-
}
1195-
1196-
await globals.globalState.update('aws.toolkit.separationPromptDismissed', true)
1197-
})
1198-
})
1199-
})
1200-
}
1201-
1202-
static #instance: SessionSeparationPrompt
1203-
public static get instance() {
1204-
return (this.#instance ??= new SessionSeparationPrompt())
1205-
}
1206-
}

packages/core/src/codecatalyst/activation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { DevEnvActivityStarter } from './devEnv'
2626
import { learnMoreCommand, onboardCommand, reauth } from './explorer'
2727
import { isInDevEnv } from '../shared/vscode/env'
2828
import { hasScopes, scopesCodeWhispererCore, getTelemetryMetadataForConn } from '../auth/connection'
29-
import { SessionSeparationPrompt } from '../auth/auth'
3029
import { telemetry } from '../shared/telemetry/telemetry'
3130
import { asStringifiedStack } from '../shared/telemetry/spans'
3231

@@ -64,7 +63,6 @@ export async function activate(ctx: ExtContext): Promise<void> {
6463
})
6564

6665
await authProvider.secondaryAuth.forgetConnection()
67-
await SessionSeparationPrompt.instance.showForCommand('aws.codecatalyst.manageConnections')
6866
})
6967
},
7068
{ emit: false, functionId: { name: 'activate', class: 'CodeCatalyst' } }

packages/core/src/extensionNode.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ import globals from './shared/extensionGlobals'
4646
import { Experiments, Settings, showSettingsFailedMsg } from './shared/settings'
4747
import { isReleaseVersion } from './shared/vscode/env'
4848
import { AuthStatus, AuthUserState, telemetry } from './shared/telemetry/telemetry'
49-
import { Auth, SessionSeparationPrompt } from './auth/auth'
49+
import { Auth } from './auth/auth'
5050
import { getTelemetryMetadataForConn } from './auth/connection'
5151
import { registerSubmitFeedback } from './feedback/vue/submitFeedback'
5252
import { activateCommon, deactivateCommon } from './extension'
5353
import { learnMoreAmazonQCommand, qExtensionPageCommand, dismissQTree } from './amazonq/explorer/amazonQChildrenNodes'
54-
import { AuthUtil, codeWhispererCoreScopes } from './codewhisperer/util/authUtil'
54+
import { codeWhispererCoreScopes } from './codewhisperer/util/authUtil'
5555
import { installAmazonQExtension } from './codewhisperer/commands/basicCommands'
5656
import { isExtensionInstalled, VSCODE_EXTENSION_ID } from './shared/utilities'
5757
import { ExtensionUse, getAuthFormIdsFromConnection, initializeCredentialsProviderManager } from './auth/utils'
@@ -139,16 +139,8 @@ export async function activate(context: vscode.ExtensionContext) {
139139
conn.scopes
140140
)
141141
await Auth.instance.forgetConnection(conn)
142-
await SessionSeparationPrompt.instance.showForCommand('aws.toolkit.auth.manageConnections')
143142
}
144143
}
145-
146-
// Display last prompt if connections were forgotten in prior sessions
147-
// but the user did not interact or sign in again. Useful in case the user misses it the first time.
148-
await SessionSeparationPrompt.instance.showAnyPreviousPrompt()
149-
150-
// MUST restore CW/Q auth so that we can see if this user is already a Q user.
151-
await AuthUtil.instance.restore()
152144
},
153145
{ emit: false, functionId: { name: 'activate', class: 'ExtensionNodeCore' } }
154146
)

packages/core/src/shared/globalState.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ export type globalKey =
4444
| 'aws.toolkit.amazonq.dismissed'
4545
| 'aws.toolkit.amazonqInstall.dismissed'
4646
| 'aws.amazonq.workspaceIndexToggleOn'
47-
| 'aws.toolkit.separationPromptCommand'
48-
| 'aws.toolkit.separationPromptDismissed'
4947
// Deprecated/legacy names. New keys should start with "aws.".
5048
| '#sessionCreationDates' // Legacy name from `ssoAccessTokenProvider.ts`.
5149
| 'CODECATALYST_RECONNECT'

packages/core/src/test/techdebt.test.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as env from '../shared/vscode/env'
1010
// Checks project config and dependencies, to remind us to remove old things
1111
// when possible.
1212
describe('tech debt', function () {
13+
// @ts-ignore
1314
function fixByDate(date: string, msg: string) {
1415
const now = Date.now()
1516
const cutoffDate = Date.parse(date)
@@ -38,14 +39,4 @@ describe('tech debt', function () {
3839
// This is relevant for the use of `fs.cpSync` in the copyFiles scripts.
3940
assert.ok(semver.lt(minNodejs, '18.0.0'), 'with node18+, we can remove the dependency on @types/node@18')
4041
})
41-
42-
it('remove separate sessions login edge cases', async function () {
43-
// src/auth/auth.ts:SessionSeparationPrompt
44-
// forgetConnection() function and calls
45-
46-
// Monitor telemtry to determine removal or snooze
47-
// toolkit_showNotification.id = sessionSeparation
48-
// auth_modifyConnection.action = deleteProfile OR auth_modifyConnection.source contains CodeCatalyst
49-
fixByDate('2025-06-06', 'Remove the edge case code from the commit that this test is a part of.')
50-
})
5142
})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Removal",
3+
"description": "Auth: No longer inform users that Amazon Q and Toolkit extensions have separate auth sessions."
4+
}

0 commit comments

Comments
 (0)