-
Notifications
You must be signed in to change notification settings - Fork 747
feat(agentic chat): Agentic coding experience: Amazon Q can now write code and run shell commands on your behalf #7210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Problem
- we want a chat mode where agents are served by the local extension
while the regular "Chat" is served by flare
## Solution
- register mynah ui webview providers depending on lsp/normal
implementation
- temporarily disable the lsp (explain, fix, etc) commands, since they
are also registered in the normal "agent" flow
- redirect agent messages to the correct chat handler on the UI side
- redirect UI messages meant for agents to the extension side
- refactor main.ts so that it can be used by both the regular
implementation and the lsp one ~(I'll open a seperate PR to merge this
into master, since it's going to be a pain to maintain)~
- #7033
- pass in references to mynah handlers so that mynah ref injection can
happen after in flare
- #7046
Depends on ~#7033,
#7046
Related to aws/language-servers#962
---
- 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.
## Problem currently tabs get added to the tabs storage when the onTabAdd handler gets called. In hybrid chat, the onTabAdd handler will never get called, because it first needs to be in the tabsStorage, which doesn't happen because the onTabAdd handler hasn't been called ## Solution in hybrid chat mode just add new tabs directly to the tabs storage --- - 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.
## Problem When switching between different manifests, a newly downloaded version might chronologically be older than all previously downloaded versions, even though it's marked as the latest version in its own manifest. This is why we are getting the EPIPE error when trying out the alpha manifest. The cleanup deletes the language server right after it was downloaded ## Solution In such cases, we skip the cleanup process to preserve this version. Otherwise we will get an EPIPE error. At this point the version that was downloaded shouldn't be delisted, so we don't want to make sure its not removed --- - 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.
## Problem - developer profiles are only synced to our local agents (/dev, /doc, etc). Now that the main chat panel is served by flare we need to update the profile information when it becomes available so that flare is using the correct profile for the request ## Solution - send profile information to flare on the initial request + subsequent changes to the active profile - refresh the webview if the profile changes --- - 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.
## Problem when the flare chat panel refreshes on log in/log out, the message listener never gets disposed of, causing the next webview instantiation to have two message listeners that are forwarding messages to the ui ## Solution dispose of the message listener when the webview gets disposed --- - 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.
Merge master into feature/hybridChat
## Problem local workspace context has been added to flare and its needed for falcon changes ## Solution we don't have `aws.q` settings in vscode so we have to use the language server middleware to send back the settings Once local workspace context is fully working and in the manifest I'll uncomment --- - 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.
## Problem Minor update on WS setup instructions. ## Solution --- - 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.
## Problem If you currently ask Q any questions about cursor position or highlighted text, it lacks the context necessary to answer. This is because in the payload sent to the LSP we send the cursor position as the wrong type: https://github.com/aws/aws-toolkit-vscode/blob/2e8d4c7eb0f0bcbc416d8f6e06ff7e00d57dc6b2/packages/amazonq/src/lsp/chat/messages.ts#L159 whereas [Flare](https://github.com/aws/language-server-runtimes/blob/d9960b5dd6df52c52309f0a7edae64a824da9003/types/chat.ts#L82) is expecting: `cursorState`. ## Solution - Convert the vscode selection to a Flare cursorState. - Add stronger typing by casting the params to `ChatParams` type before modifying to avoid these types of bugs. ## Future Work - This fixes flare being unable to identify cursor position, and mostly fixes highlighted text. However, I was still able to run into situations where the cursor position is correct, but the content is incorrect. ~~This could be fixed by sending the highlighted content to Flare, but~~ still trying to root cause the issue. <img width="1064" alt="image" src="https://github.com/user-attachments/assets/35e6fbc9-5c66-4f9f-8c6e-bf9ec4ab4ef2" /> --- - 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.
When certain settings/configs are changed in the IDE, they need to be propagated to the language server. The settings were the customizationArn, the users opt in preference for telemetry, and some other things. This PR: - Pushes the new customization arn when it is changed. This arn only exists when the user is using the non-default customization, otherwise it is undefined. - A small hack needed to be made to explicitly push this change, since by default we utilized the automatic push to the LS when the users settings file changed (eg opt in telemetry). But because customization is not stored in the users settings, we didn't get that for free. See the command `aws.amazonq.updateCustomizations` which was made to handle this edge case. Which eventually **explicitly** uses the language server message `DidChangeConfigurationNotification` - Pushes the opt out telemetry setting to the language server - Since this setting is stored in the vscode settings json, the push to language server mechanism comes for free under the `DidChangeConfigurationNotification` message. - The Q Auth Profile ARN is a separate config that needed to be handled by a different handler (different from customization), so the function `pushConfigUpdate()` was created to route the correct config to the correct handler in the LS - This uses the message `updateConfigurationRequestType` which is different from `DidChangeConfigurationNotification` that the other configs use. This results in a different code path being hit, which is expected. Some helpful notes: - `getAmazonQRelatedWorkspaceConfigs()` (triggered through `DidChangeConfigurationNotification`) is the language server side code that parses the config sent by the client/ide. So the client/ide must match the shape expected by the LS. This is an example why `optOutTelemetry` did not work out of the box, and needed some changes to be consumable by the LS. --- - 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. --------- Signed-off-by: nkomonen-amazon <[email protected]> Co-authored-by: Josh Pinkney <[email protected]>
## Problem agentic chat should have a pair programming card that appears at the top of chat ## Solution implement it with the following behaviors: 1. If the pair programming card was dismissed in a previous session, never show it again 2. Continue showing the pair programming card in new basic chat tabs until you click the "X" to dismiss it. Once the "X" is pressed it will never be shown for future tabs in the current chat-client session or future sessions 3. If you have multiple basic chat tabs open and click X on one of them it only closes the programmer mode card for that single tab depends on: aws/language-servers#1023 --- - 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.
## PROBLEM: When installing the LSP for Q we get a message that says `"Installing 'Amazon Q' language server"`, but they want it to be slightly different (`"Updating Amazon Q plugin"`). The issue is the base class for the lsp installer class has a generic message that is not easy to customize. ## SOLUTION: Allow an override downloading message to be defined in each specific LspInstaller implementation. This message is then routed in to the LspResolver (the thing that downloads the Lsp), and the message is displayed here. This override message will show when the download is happening. Everyone is happy. --- - 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. Signed-off-by: nkomonen-amazon <[email protected]>
## Problem Same problem as #7172 ## Solution - listen to logLevel change events, and forward them to LSP. - pass initial logLevel to the LSP as well. - This requires mapping the local levels to the Flare Levels. This is done with the following: ``` export const lspLogLevelMapping: Map<vscode.LogLevel, LspLogLevel> = new Map([ [vscode.LogLevel.Error, 'error'], [vscode.LogLevel.Warning, 'warn'], [vscode.LogLevel.Info, 'info'], [vscode.LogLevel.Debug, 'log'], [vscode.LogLevel.Trace, 'debug'], [vscode.LogLevel.Off, 'error'], // TODO: once the language server supports a no-log setting, we can map to that. ]) ``` ## Notes - Because of this mapping, it means that to enabled 'debug' logs in Flare, we set to 'trace' in VSC which can be confusing for contributors. --- - 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.
## Problem the extension name doesn't match what flare expects: https://github.com/aws/language-servers/blob/main/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts#L50 ## Solution update it --- - 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.
## Problem set default to empty string instead of undefined for workspaceIndexCacheDirPath ## Solution --- - 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.
) ## Problem Some users were having invalid bearer token exceptions when making chat requests through agentic chat. This highlights an issue in how we sync the token. Originally, we thought this was because of a race condition. We check the token every 10 seconds for changes, and if its expired, refresh it and send it to the language server. However, that still leaves a 10 second gap where the language server could use an expired token before we update it. However, we add a buffer of one minute to our `isExpired` check here: https://github.com/aws/aws-toolkit-vscode/blob/db673c9b74b36591bb5642b3da7d4bc7ae2afaf4/packages/core/src/auth/sso/model.ts#L160 Therefore, this causes the token to expire a minute early, meaning there is a full minute, where our checks should detect the expired token and refresh it both locally and on the language server. However, they don't because the checks aren't actually being made. This is because of how we handle token refresh errors. Note the following behavior: - if refresh throws a recoverable error, we throw it. See [here](https://github.com/aws/aws-toolkit-vscode/blob/6dbb21e50e539c5973586714295e3ce066b030ef/packages/core/src/auth/auth.ts#L856-L878). - if refresh throws a non-recoverable error we invalidate the connection. see [here](https://github.com/aws/aws-toolkit-vscode/blob/6dbb21e50e539c5973586714295e3ce066b030ef/packages/core/src/auth/auth.ts#L893-L948). The current `refreshConnection` logic doesn't work with this because we continuously try to refresh until it throws an error. However, based on the behavior above, we do want to retry on refresh errors since that means the error is recoverable! Additionally, we don't want to retry when token refreshes result in an invalid connection because those are nonrecoverable errors. ## Solution - Refactor our token refreshes to log errors thrown and continue to retry (since these are implicitly recoverable errors). - Avoid refreshing when the connection state is invalid (since this implies an unrecoverable error). ## Notes - Flare auth can't come soon enough. This behavior is not obvious to a consumer, and leads to bugs like this. - debugged w/ @nkomonen-amazon --- - 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.
## Problem using the generate tests right click command won't work because a new tab never gets created, causing a "no more tabs available" warning ## Solution If we're using the right click -> generate tests command AND there isn't a /test tab open then create a new tab --- - 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.
## Problem - Explain issue from security scan hasn't been hooked up when moving to flare ## Solution - use sendToPrompt from flare to automatically submit an "explain message". This message contains a prompt that gets shown to the user and an escaped prompt that gets sent to the backend - text/formatting for uiMessage and contextMessage were taken from codewhisperer chat --- - 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.
#7193) ## Problem: Legal requires us to log the attribution notice when downloading the language server. We do not currently do this. ## Solution: - What our message looks like: `lsp: Installing 'AmazonQ' Language Server v0.1.0-alpha.100 to /Users/nkomonen/Library/Caches/aws/toolkits/language-servers/AmazonQ/0.1.0-alpha.100 (Attribution notice can be found at https://dhi0h88q3j9q6.cloudfront.net/6a0c7aa8-8b63-43a7-b14b-ee7594a29c9d/THIRD_PARTY_LICENSES)` - This log message is in the generic part of our LSP downloader, and will show for all LSPs downloaded. The link to the attribution notice is already part of the manifest, so we grab it from there. --- - 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. Signed-off-by: nkomonen-amazon <[email protected]>
## Problem - we don't need workspace indexing on extension side anymore, the `isVectorIndexEnabled` setting controls if we build vector index used for @workspace feature, since now chat is moving to language server, the extension side workspace lsp should be only responsible for building BM25 index for inline, and not responsible for vector indexing for chat. ## Solution - stop vector indexing on extension - next step is to tie workspace index setting to language server workspace indexing, will be in next PR --- - 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.
## Problem `aws.amazonq.generateUnitTests` is not sending any events to /review ## Solution publish a chat message event to the /review tab to start I forgot to include these changes in #7195 --- - 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.
Reverts previous PR #7118 --- - 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. Signed-off-by: nkomonen-amazon <[email protected]>
## Problem With aws/language-servers#1201 we can now use userSetting to control vector indexing ## Solution --- - 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.
## Problem Chat results are never getting added to the reference tracker ## Solution If code references are available, add them to the reference tracker --- - 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.
## Problem In [this PR](https://github.com/aws/language-servers/pull/1172/files#diff-3ef0f209f2cb39ae2f8b1c622f885a33cbf797f1882dfb4b22fb4cb17bcf901aR381) they're going to add a config setting for indicating we're in agentic mode ## Solution always enable it so we see the agentic UI --- - 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.
## Problem a tab id isn't getting created when you call `status bar` -> `full project scan with /review` causing the command to fail with "you cannot open more then 10 tabs" ## Solution create a new tab if tabId is undefined. This can only happen when agent commands are triggered via a command, since they don't know the tabId ahead of time --- - 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.
## Problem We're currently adding the reference log on partial responses and on complete responses, causing duplicate messages ## Solution on flare side we're combining all code references into the final response, so we just need to emit once --- - 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.
|
Add changelog for the agentic chat release --- - 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.
jpinkney-aws
approved these changes
May 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Amazon Q is unable to write code and run shell commands on the customer's behalf
Solution
Merge feature/hybridChat branch which introduces Agentic coding experience
feature/xbranches will not be squash-merged at release time.