You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(amazonq): isAmazonLinux2() function incorrectly identifies regular Linux/Ubuntu in web/container env as AL2 (#8073)
## Problem
PR: #7270 introduced a bug
where the `isAmazonLinux2()` function incorrectly identifies regular
Linux/Ubuntu systems in web/container environments as Amazon Linux 2.
This happens because:
1. The function checks `os.release()` for `.amzn2.` or `.amzn2int.`
patterns
2. In containerized environments (like VS Code web/remote),
`os.release()` returns the __host's kernel version__, not the
container's OS
3. If the host is Amazon Linux 2 but the container is Ubuntu/Linux, the
function incorrectly returns `true`
4. This prevents Amazon Q LSP from starting because it thinks it's on
AL2 without the required GLIBC patch
## Solution
- __Skip AL2 detection for web environments__ - Returns `false`
immediately since web mode runs in a browser
- __Check `/etc/os-release` first__ - In containerized environments,
this file contains the actual container OS, not the host OS
- __Trust container OS over kernel version__ - If `/etc/os-release`
shows it's not AL2 (e.g., Ubuntu), return `false` regardless of kernel
version
- __Fall back to kernel check only when necessary__ - Only use
`os.release()` if we can't read `/etc/os-release` or if it confirms AL2
- Prioritized container OS detection over kernel version detection
- Maintained backward compatibility for actual AL2 systems
- Added comprehensive test coverage for the new scenarios
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@@ -217,9 +293,9 @@ export function getExtRuntimeContext(): {
217
293
extensionHost: ExtensionHostLocation
218
294
}{
219
295
constextensionHost=
220
-
// taken from https://github.com/microsoft/vscode/blob/7c9e4bb23992c63f20cd86bbe7a52a3aa4bed89d/extensions/github-authentication/src/githubServer.ts#L121 to help determine which auth flows
221
-
// should be used
222
-
typeofnavigator==='undefined'
296
+
// Check if we're in a Node.js environment (desktop/remote) vs web worker
297
+
// Updated to be compatible with Node.js v22 which includes navigator global
0 commit comments