aws / aws-toolkit-jetbrains

AWS Toolkit for JetBrains - a plugin for interacting with AWS from JetBrains IDEs
https://plugins.jetbrains.com/plugin/11349-aws-toolkit
Apache License 2.0
753 stars 219 forks source link

Codewhisperer seems to steal and block the use of left/right arrow keys and tab indefinitely when impacted by a race condition #4878

Open brandondahler opened 3 weeks ago

brandondahler commented 3 weeks ago

Describe the bug With the Amazon Q plugin enabled, I encounter issues where I lose the ability to use the left arrow key, right arrow key, and the tab key multiple times a day. Restarting IntelliJ clears the issue until it is re-encountered. The triggering event appears to be related to typing fast while the autocomplete suggestions popup box is in the process of appearing.

After the editor has gotten into an invalid state, the editors for all open files and even projects are impacted. Additionally, no more AI-generated auto completions will display. After typing enough new text that would normally trigger an autocomplete, the following text is logged despite there not actually being any visible popup (emphasis mine).

2024-09-13 17:23:58,962 [4248992]   FINE - software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatus - Set current CodeWhisperer invocation sessionId: 764d43d3-254e-4783-b203-beab0ef36d6b
2024-09-13 17:23:58,963 [4248993]   INFO - software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererService - SessionId: 764d43d3-254e-4783-b203-beab0ef36d6b, RequestId: 6b7f9ac2-9bc9-48f7-96a5-5c6b1ec3ea94, Jetbrains IDE: IntelliJ IDEA 2024.1.6, IDE version: IU-241.19072.14, Filename: ApplicationSubmittedProcessorTests.java, Left context of current line: s, Cursor line: 115, Caret offset: 5128, Latency: 669.0, Recommendations: 
None
2024-09-13 17:23:58,964 [4248994]   FINE - software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatus - Ending CodeWhisperer invocation
************
2024-09-13 17:23:58,964 [4248994]   FINE - software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererService - Detect conflicting popup window with CodeWhisperer popup, not showing CodeWhisperer popup
************
2024-09-13 17:23:58,965 [4248995]   FINE - software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererService - Cancelling popup and exiting CodeWhisperer session. RequestId: 6b7f9ac2-9bc9-48f7-96a5-5c6b1ec3ea94
2024-09-13 17:23:59,088 [4249118]   FINE - software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.CodeWhispererTelemetryService - Successfully sent user trigger decision telemetry. RequestId: aa5e4816-e2a6-495b-a4ee-6fd3ca2e0ea6

The enter and backspace keys are not impacted.

To reproduce

  1. Open IntelliJ with plugin enabled
  2. Type normally while ignoring the CodeWhisperer popup and/or suggestions

Expected behavior Popup disappears, normal arrow key and tab key usage is restored

Screenshots N/A

Your Environment

Additional context Based on the symptoms and logs, I believe that there is some mechanism that is causing the editor action handlers set in CodeWhispererPopupManager to get into an invalid state where they are refusing to return the normal actions back to the original handlers.

brandondahler commented 3 weeks ago

I have enabled debug logs under software.aws.toolkits.jetbrains.services.codewhisperer and reproduce this issue on my own machine every day or so, reach out to me on slack if there's any realtime debugging desired related to this issue.