Skip to content

Commit b649dbd

Browse files
aws-toolkit-automationtomcat323Will-ShaoHuactlai95jpinkney-aws
authored
Merge master into feature/flare-inline (#7299)
## Automatic merge failed - Resolve conflicts and push to this PR branch. - **Do not squash-merge** this PR. Use the "Create a merge commit" option to do a regular merge. ## Command line hint To perform the merge from the command line, you could do something like the following (where "origin" is the name of the remote in your local git repo): ``` git stash git fetch --all git checkout origin/feature/flare-inline git merge origin/master git commit git push origin HEAD:refs/heads/autoMerge/feature/flare-inline ``` --------- Signed-off-by: nkomonen-amazon <[email protected]> Co-authored-by: aws-toolkit-automation <> Co-authored-by: Tom Zu <[email protected]> Co-authored-by: Will Lo <[email protected]> Co-authored-by: Tai Lai <[email protected]> Co-authored-by: Josh Pinkney <[email protected]> Co-authored-by: Nikolas Komonen <[email protected]> Co-authored-by: Adam Khamis <[email protected]> Co-authored-by: Na Yue <[email protected]> Co-authored-by: Laxman Reddy <[email protected]> Co-authored-by: Jiatong Li <[email protected]> Co-authored-by: Avi Alpert <[email protected]> Co-authored-by: Brad Skaggs <[email protected]> Co-authored-by: Zoe Lin <[email protected]> Co-authored-by: chungjac <[email protected]> Co-authored-by: Lei Gao <[email protected]> Co-authored-by: hkobew <[email protected]>
1 parent 7bb3dac commit b649dbd

File tree

10 files changed

+44
-47
lines changed

10 files changed

+44
-47
lines changed

package-lock.json

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
4242
},
4343
"devDependencies": {
44-
"@aws-toolkits/telemetry": "^1.0.318",
44+
"@aws-toolkits/telemetry": "^1.0.319",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Support chat in AL2 aarch64"
4+
}

packages/amazonq/src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
maybeShowMinVscodeWarning,
3434
Experiments,
3535
isSageMaker,
36-
isAmazonInternalOs,
36+
isAmazonLinux2,
3737
} from 'aws-core-vscode/shared'
3838
import { ExtStartUpSources } from 'aws-core-vscode/telemetry'
3939
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
@@ -123,7 +123,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
123123
await activateCodeWhisperer(extContext as ExtContext)
124124
if (
125125
(Experiments.instance.get('amazonqLSP', true) || Auth.instance.isInternalAmazonUser()) &&
126-
(!isAmazonInternalOs() || (await hasGlibcPatch()))
126+
(!isAmazonLinux2() || hasGlibcPatch())
127127
) {
128128
// start the Amazon Q LSP for internal users first
129129
// for AL2, start LSP if glibc patch is found

packages/amazonq/src/lsp/chat/activation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
2525
type: 'profile',
2626
profileArn: AuthUtil.instance.regionProfileManager.activeRegionProfile?.arn,
2727
})
28+
// We need to push the cached customization on startup explicitly
29+
await pushConfigUpdate(languageClient, {
30+
type: 'customization',
31+
customization: getSelectedCustomization(),
32+
})
2833

2934
const provider = new AmazonQChatViewProvider(mynahUIPath)
3035

packages/amazonq/src/lsp/client.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ import {
3636
getLogger,
3737
undefinedIfEmpty,
3838
getOptOutPreference,
39-
isAmazonInternalOs,
40-
fs,
39+
isAmazonLinux2,
4140
getClientId,
4241
extensionVersion,
4342
} from 'aws-core-vscode/shared'
@@ -55,8 +54,11 @@ import { InlineChatTutorialAnnotation } from '../app/inline/tutorials/inlineChat
5554
const localize = nls.loadMessageBundle()
5655
const logger = getLogger('amazonqLsp.lspClient')
5756

58-
export async function hasGlibcPatch(): Promise<boolean> {
59-
return await fs.exists('/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2')
57+
export const glibcLinker: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_LINKER || ''
58+
export const glibcPath: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_PATH || ''
59+
60+
export function hasGlibcPatch(): boolean {
61+
return glibcLinker.length > 0 && glibcPath.length > 0
6062
}
6163

6264
export async function startLanguageServer(
@@ -81,13 +83,8 @@ export async function startLanguageServer(
8183
const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`)
8284
let executable: string[] = []
8385
// apply the GLIBC 2.28 path to node js runtime binary
84-
if (isAmazonInternalOs() && (await hasGlibcPatch())) {
85-
executable = [
86-
'/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2',
87-
'--library-path',
88-
'/opt/vsc-sysroot/lib64',
89-
resourcePaths.node,
90-
]
86+
if (isAmazonLinux2() && hasGlibcPatch()) {
87+
executable = [glibcLinker, '--library-path', glibcPath, resourcePaths.node]
9188
getLogger('amazonqLsp').info(`Patched node runtime with GLIBC to ${executable}`)
9289
} else {
9390
executable = [resourcePaths.node]
@@ -380,6 +377,8 @@ function getConfigSection(section: ConfigSection) {
380377
includeSuggestionsWithCodeReferences:
381378
CodeWhispererSettings.instance.isSuggestionsWithCodeReferencesEnabled(),
382379
shareCodeWhispererContentWithAWS: !CodeWhispererSettings.instance.isOptoutEnabled(),
380+
includeImportsWithSuggestions: CodeWhispererSettings.instance.isImportRecommendationEnabled(),
381+
sendUserWrittenCodeMetrics: true,
383382
},
384383
]
385384
case 'aws.logLevel':

packages/core/src/shared/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export * from './extensionUtilities'
1818
export * from './extensionStartup'
1919
export { RegionProvider } from './regions/regionProvider'
2020
export { Commands } from './vscode/commands2'
21-
export { getMachineId, getServiceEnvVarConfig, isAmazonInternalOs } from './vscode/env'
21+
export { getMachineId, getServiceEnvVarConfig, isAmazonLinux2 } from './vscode/env'
2222
export { getLogger } from './logger/logger'
2323
export { activateExtension, openUrl } from './utilities/vsCodeUtils'
2424
export { waitUntil, sleep, Timeout } from './utilities/timeoutUtils'

packages/core/src/shared/telemetry/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
isAutomation,
1616
isRemoteWorkspace,
1717
isCloudDesktop,
18-
isAmazonInternalOs,
18+
isAmazonLinux2,
1919
} from '../vscode/env'
2020
import { addTypeName } from '../utilities/typeConstructors'
2121
import globals, { isWeb } from '../extensionGlobals'
@@ -290,7 +290,7 @@ export async function getComputeEnvType(): Promise<EnvType> {
290290
} else if (isSageMaker()) {
291291
return web ? 'sagemaker-web' : 'sagemaker'
292292
} else if (isRemoteWorkspace()) {
293-
if (isAmazonInternalOs()) {
293+
if (isAmazonLinux2()) {
294294
if (await isCloudDesktop()) {
295295
return 'cloudDesktop-amzn'
296296
}

packages/core/src/shared/vscode/env.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,21 @@ export function isRemoteWorkspace(): boolean {
125125
}
126126

127127
/**
128-
* There is Amazon Linux 2, but additionally an Amazon Linux 2 Internal.
129-
* The internal version is for Amazon employees only. And this version can
130-
* be used by either EC2 OR CloudDesktop. It is not exclusive to either.
128+
* There is Amazon Linux 2.
131129
*
132-
* Use {@link isCloudDesktop()} to know if we are specifically using it.
130+
* Use {@link isCloudDesktop()} to know if we are specifically using internal Amazon Linux 2.
133131
*
134-
* Example: `5.10.220-188.869.amzn2int.x86_64`
132+
* Example: `5.10.220-188.869.amzn2int.x86_64` or `5.10.236-227.928.amzn2.x86_64` (Cloud Dev Machine)
135133
*/
136-
export function isAmazonInternalOs() {
137-
return os.release().includes('amzn2int') && process.platform === 'linux'
134+
export function isAmazonLinux2() {
135+
return (os.release().includes('.amzn2int.') || os.release().includes('.amzn2.')) && process.platform === 'linux'
138136
}
139137

140138
/**
141139
* Returns true if we are in an internal Amazon Cloud Desktop
142140
*/
143141
export async function isCloudDesktop() {
144-
if (!isAmazonInternalOs()) {
142+
if (!isAmazonLinux2()) {
145143
return false
146144
}
147145

packages/core/src/test/shared/vscode/env.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
import assert from 'assert'
77
import path from 'path'
8-
import {
9-
isCloudDesktop,
10-
getEnvVars,
11-
getServiceEnvVarConfig,
12-
isAmazonInternalOs as isAmazonInternalOS,
13-
isBeta,
14-
} from '../../../shared/vscode/env'
8+
import { isCloudDesktop, getEnvVars, getServiceEnvVarConfig, isAmazonLinux2, isBeta } from '../../../shared/vscode/env'
159
import { ChildProcess } from '../../../shared/utilities/processUtils'
1610
import * as sinon from 'sinon'
1711
import os from 'os'
@@ -103,13 +97,16 @@ describe('env', function () {
10397
assert.strictEqual(isBeta(), expected)
10498
})
10599

106-
it('isAmazonInternalOS', function () {
100+
it('isAmazonLinux2', function () {
107101
sandbox.stub(process, 'platform').value('linux')
108102
const versionStub = stubOsVersion('5.10.220-188.869.amzn2int.x86_64')
109-
assert.strictEqual(isAmazonInternalOS(), true)
103+
assert.strictEqual(isAmazonLinux2(), true)
104+
105+
versionStub.returns('5.10.236-227.928.amzn2.x86_64')
106+
assert.strictEqual(isAmazonLinux2(), true)
110107

111108
versionStub.returns('5.10.220-188.869.NOT_INTERNAL.x86_64')
112-
assert.strictEqual(isAmazonInternalOS(), false)
109+
assert.strictEqual(isAmazonLinux2(), false)
113110
})
114111

115112
it('isCloudDesktop', async function () {

0 commit comments

Comments
 (0)