aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.53k stars 454 forks source link

Amazon Q: (Windows) running powershell every 2 seconds #6134

Open nistSean opened 13 hours ago

nistSean commented 13 hours ago

Problem

When the Amazon Q extension is enabled, there is a PowerShell command being executed continuously.

**********************
Windows PowerShell transcript start
Start time: 20241203145229
Username: xxxx\xxxxx
RunAs User: xxxx\xxxxx
Configuration Name: 
Machine: xxxxxxxxx (Microsoft Windows NT 10.0.22631.0)
Host Application: powershell.exe -NoProfile -NoLogo -InputFormat Text -NoExit -ExecutionPolicy Unrestricted -Command -
Process ID: 6868
PSVersion: 5.1.22621.4391
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.4391
BuildVersion: 10.0.22621.4391
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
**********************
Windows PowerShell transcript start
Start time: 20241203145229
Username: xxxx\xxxxx
RunAs User: xxxx\xxxxx
Configuration Name: 
Machine: xxxxxxxxxxx (Microsoft Windows NT 10.0.22631.0)
Host Application: powershell.exe -NoProfile -NoLogo -InputFormat Text -NoExit -ExecutionPolicy Unrestricted -Command -
Process ID: 6868
PSVersion: 5.1.22621.4391
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.4391
BuildVersion: 10.0.22621.4391
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
PS>CommandInvocation(Out-String): "Out-String"
>> ParameterBinding(Out-String): name="InputObject"; value="Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported.""
Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported."
At C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.psm1:4 char:5
+     [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException
Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported."
At C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.psm1:4 char:5
+     [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException
PS>$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage

AllocatedBaseSize CurrentUsage
----------------- ------------
             9728            4

**********************
Windows PowerShell transcript start
Start time: 20241203145230
Username: xxxx\xxxxx
RunAs User: xxxx\xxxxx
Configuration Name: 
Machine: xxxxxxxxx (Microsoft Windows NT 10.0.22631.0)
Host Application: powershell.exe -NoProfile -NoLogo -InputFormat Text -NoExit -ExecutionPolicy Unrestricted -Command -
Process ID: 6868
PSVersion: 5.1.22621.4391
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.4391
BuildVersion: 10.0.22621.4391
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
PS>CommandInvocation(Out-String): "Out-String"
>> ParameterBinding(Out-String): name="InputObject"; value="Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported.""
Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported."
At C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.psm1:4 char:5
+     [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException
Exception calling "ReadLine" with "2" argument(s): "Specified method is not supported."
At C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.psm1:4 char:5
+     [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException
PS>exit
**********************
Windows PowerShell transcript end
End time: 20241203145230
**********************

Steps to reproduce the issue

  1. Go to Visual Studio
  2. Enable the Amazon Q extension
  3. Check powershell logs.

Expected behavior

Don't do this.

System details (run AWS: About and/or Amazon Q: About)

nistSean commented 13 hours ago

This started for me 11/19/24 likely after updating VS Code and/or VS Code extensions.

justinmk3 commented 11 hours ago

This started for me 11/19/24

For reference, Amazon Q 1.36.0 was released on 11/14.

AWS Toolkit version: 2.18.7

Is that version correct? Latest is AWS Toolkit 3.35.0.

If you uninstall AWS Toolkit, does the problem still occur? This will help narrow down the issue.

justinmk3 commented 10 hours ago

Steps to reproduce the issue

  1. Go to Visual Studio
  2. Enable the Amazon Q extension
  3. Check powershell logs.

Can you give more specific details about where to find "powershell logs"? Is this a OS-global logs (Windows EventLog)? Exact steps about how to find these logs will help.

I've searched:

  1. the code in this repo,
  2. the code in node_modules used to build this project, and
  3. the final webpack'd extension/dist/src/extensionNode.js

and did not find anything like (case-insensitive) out-string, ExecutionPolicy.*Unrestricted, etc.

Our dev-dependencies (non-production) use readline-sync but that is not shipped as part of the production build.

Powershell supports aliases, so it's possible there is some pwsh command invocation using a different "spelling" than what is reported in your logs. It's also possible that something is indirectly triggering a powershell script on your system?