Skip to content
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

feat(dev): Stop code generation action #5675

Merged
merged 93 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
aaae062
feat(amazonqFeatureDev): enable stop generating button
tverney Sep 4, 2024
c385dfc
feat(amazonqFeatureDev): include stop generation based on token cance…
tverney Sep 6, 2024
e05a87a
fix(amazonqFeatureDev): move work on new task after session is closed
tverney Sep 10, 2024
b013042
refactor(amazonqFeatureDev): include updated rts model
tverney Sep 11, 2024
709c0c5
fix(amazonqFeatureDev): fix merge conflicts
tverney Sep 11, 2024
644dedd
fix(amazonqFeatureDev): include currentCodeGenerationId to track refe…
tverney Sep 12, 2024
ba2db03
refactor(amazonqFeatureDev): use else catch for return statement
tverney Sep 12, 2024
b791a2b
refactor(amazonqFeatureDev): add logic for codeGenerationId
tverney Sep 17, 2024
e1cbe15
fix(amazonqFeatureDev): generate uploadId in fe
tverney Sep 17, 2024
ae9d16b
fix(amazonqFeatureDev): create a new token to stop and iterate in the…
tverney Sep 25, 2024
532e4e4
fix(amazonqFeatureDev): removeu unused const
tverney Sep 25, 2024
d63ceb5
fix(dev): apply fixes based on new eslint rules
tverney Sep 26, 2024
f0bbd9f
fix(amazonqFeatureDev): use shared context from action to check cance…
tverney Sep 26, 2024
e604672
fix(amazonqFeatureDev): require isCancellation to localize in the ins…
tverney Sep 26, 2024
675c623
fix(amazonqFeatureDev): don't share state to prepare code since code …
tverney Oct 2, 2024
2c92f5c
fix(amazonqFeatureDev): allow follow up options after finally only
tverney Oct 3, 2024
394c512
fix(amazonqFeatureDev): disable input placeholder until its done
tverney Oct 3, 2024
0743620
fix(amazonqFeatureDev): disable input
tverney Oct 3, 2024
d16c01f
Merge branch 'master' into feature/stop-progress-status
tverney Oct 8, 2024
08ceb71
Merge branch 'master' into feature/stop-progress-status
tverney Oct 10, 2024
30735e8
telemetry(amazonq): add metrics for stop code generation
kelvin-klchu Oct 8, 2024
047125b
telemetry(amazonq): add metrics for stop code generation
kelvin-klchu Oct 10, 2024
08b85d1
Merge pull request #1 from kelvin-klchu/stop-code-gen-telemetry-updated
tverney Oct 10, 2024
20e5493
fix(dev): merge conflicts and missing commas
tverney Oct 15, 2024
9597f25
fix(dev): update strings
tverney Oct 16, 2024
e9ef770
chore(dev): include changelog
tverney Oct 16, 2024
5e194ae
fix(dev): update tests
tverney Oct 16, 2024
aaa0a5d
fix(dev): fill args in constructor
tverney Oct 16, 2024
8f7fa07
fix(dev): update failing test to assert items that should be equal
tverney Oct 16, 2024
e63536b
fix(dev): validate files and paths on failing test
tverney Oct 16, 2024
326b4a9
refactor(amazonq): move getIndentedCode, cleanup telemetry #5765
ivikash Oct 10, 2024
937fb13
telemetry(amazonq): Add new fields in UserTriggerDecision and UserMod…
andrewyuq Oct 10, 2024
5f38a7c
fix(telemetry): Crash monitoring fixes (#5741)
nkomonen-amazon Oct 10, 2024
2859246
telemetry(messages): maybeShowMinVscodeWarning #5762
justinmk3 Oct 10, 2024
600db42
Release 1.29.0
Oct 10, 2024
2b9c0c0
Update version to snapshot version: 1.30.0-SNAPSHOT
Oct 10, 2024
16c587f
Release 3.28.0
Oct 10, 2024
36c7296
Update version to snapshot version: 3.29.0-SNAPSHOT
Oct 10, 2024
af64f36
feat(dev-mode): always log to aws.dev.logfile at "debug" log-level #5770
justinmk3 Oct 10, 2024
78f3968
build: revert "build: temporarily relax min vscode version" #5771
justinmk3 Oct 11, 2024
fe0ec31
fix(tests): use node:fs when globals are not initialized #5772
Hweinstock Oct 11, 2024
674e80a
build(deps): bump the npm_and_yarn group across 1 directory with 2 up…
dependabot[bot] Oct 11, 2024
b3dbfd1
docs(amazonq): sequence diagram for performance telemetry #5743
jpinkney-aws Oct 11, 2024
62d6c88
refactor(tests): move performance tests to testInteg/perf/ #5735
Hweinstock Oct 14, 2024
b944d5a
fix(test): fix flaky test related to ec2.updateStatus (#5758)
Hweinstock Oct 14, 2024
dbd54c5
test(amazonq): performance test for registerNewFiles (#5727)
Hweinstock Oct 14, 2024
eedbda2
test(amazonq): performance test for hashing file in LSP. (#5720)
Hweinstock Oct 14, 2024
fe4adf7
test(amazonq): implement performance test for downloadExportResultArc…
Hweinstock Oct 14, 2024
3e355ac
deps: bump prettier from 3.3.2 to 3.3.3 (#5781)
dependabot[bot] Oct 15, 2024
9f368da
refactor(q-feature-dev): remove errorName from Error classes #5769
chengoramazon Oct 15, 2024
002d2c4
deps: bump sass-loader from 12.6.0 to 16.0.2 #5784
dependabot[bot] Oct 15, 2024
00a6d29
fix(test): unreliable "AuthUtil CodeWhisperer uses fallback connectio…
nkomonen-amazon Oct 15, 2024
bc52d13
telemetry(amazonq): cwsprChatProgrammingLanguage on insertAtCursor, C…
laileni-aws Oct 15, 2024
360cb28
deps: bump @types/webpack-env from 1.18.1 to 1.18.5 (#5606)
dependabot[bot] Oct 15, 2024
aa92cc4
test(credentials): do not modify developer $HOME #5791
roger-zhangg Oct 16, 2024
59ba5f9
docs(tests): mention performance tests in TESTPLAN.md #5793
Hweinstock Oct 16, 2024
ddfc64b
refactor(fs): use node:fs, drop fs-extra in copyFiles.ts #5761
Hweinstock Oct 16, 2024
7def140
deps: bump @types/readline-sync from 1.4.4 to 1.4.8 (#5795)
dependabot[bot] Oct 16, 2024
2944c4b
deps: bump webpack from 5.94.0 to 5.95.0 (#5794)
dependabot[bot] Oct 16, 2024
b08ef6e
fix(crash): handle sleep/wake appropriately (#5787)
nkomonen-amazon Oct 17, 2024
9d91760
feat(notifications): initial rule engine (#5783)
hayemaxi Oct 17, 2024
a12bef2
test(crash): Crash minor fixes (#5804)
nkomonen-amazon Oct 17, 2024
3c29518
fix(amazonq): display animation for Apply Diff and View Diff buttons …
ivikash Oct 17, 2024
4e51c45
fix(release): changelog item (#5808)
nkomonen-amazon Oct 17, 2024
3b51ec5
Release 1.30.0
Oct 17, 2024
4ca6b1b
Update version to snapshot version: 1.31.0-SNAPSHOT
Oct 17, 2024
9608507
Release 3.29.0
Oct 17, 2024
1391ad5
Update version to snapshot version: 3.30.0-SNAPSHOT
Oct 17, 2024
9a6a097
deps: drop fs-extra #5803
Hweinstock Oct 17, 2024
d7dc67e
deps: more-precise version of `@types/node` #5801
Hweinstock Oct 17, 2024
751d87c
feat(ec2): provide link for customer to view system logs (#5633)
Hweinstock Oct 18, 2024
701792a
test(ec2): ensure that private key is not written to telemetry (#5779)
Hweinstock Oct 18, 2024
7528a62
feat(time): Add Interval class (#5792)
nkomonen-amazon Oct 19, 2024
fe6ea9a
fix(test): flaky test (#5809)
nkomonen-amazon Oct 19, 2024
c733e26
ci: don't output code coverage table in logs (#5813)
hayemaxi Oct 21, 2024
d70bb9e
feat(amazonqFeatureDev): include stop generation based on token cance…
tverney Sep 6, 2024
b99f4db
refactor(amazonqFeatureDev): include updated rts model
tverney Sep 11, 2024
5bfde04
fix(amazonqFeatureDev): include currentCodeGenerationId to track refe…
tverney Sep 12, 2024
14a620a
refactor(amazonqFeatureDev): add logic for codeGenerationId
tverney Sep 17, 2024
12e1376
fix(amazonqFeatureDev): create a new token to stop and iterate in the…
tverney Sep 25, 2024
7b7da92
fix(dev): apply fixes based on new eslint rules
tverney Sep 26, 2024
3cfaf44
fix(amazonqFeatureDev): use shared context from action to check cance…
tverney Sep 26, 2024
1fd35af
fix(amazonqFeatureDev): require isCancellation to localize in the ins…
tverney Sep 26, 2024
597a92d
fix(amazonqFeatureDev): don't share state to prepare code since code …
tverney Oct 2, 2024
f45a4bb
fix(dev): merge conflicts and missing commas
tverney Oct 15, 2024
67d1958
fix(dev): fix merge conflicts
tverney Oct 21, 2024
904b4d6
Merge branch 'master' into feature/stop-progress-status
tverney Oct 21, 2024
14593a9
fix(dev): update messaging for total iterations
tverney Oct 22, 2024
3bafa50
fix(dev): safe check for remainingIterations
tverney Oct 22, 2024
e8dddc1
fix(dev): apply feedback
tverney Oct 23, 2024
e6c1e4f
telemetry(amazonq): use ui_click telemetry for stop code generate but…
kelvin-klchu Oct 23, 2024
509f835
Merge pull request #2 from kelvin-klchu/fix/telemetry
tverney Oct 23, 2024
c7bf2b1
Merge branch 'master' into feature/stop-progress-status
tverney Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Amazon Q /dev: Add stop generation action"
}
3 changes: 2 additions & 1 deletion packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
"AWS.amazonq.featureDev.pillText.generatingCode": "Generating code...",
"AWS.amazonq.featureDev.pillText.requestingChanges": "Requesting changes ...",
"AWS.amazonq.featureDev.pillText.insertCode": "Accept code",
"AWS.amazonq.featureDev.pillText.stoppingCodeGeneration": "Stopping code generation...",
"AWS.amazonq.featureDev.pillText.sendFeedback": "Send feedback",
"AWS.amazonq.featureDev.pillText.selectFiles": "Select files for context",
"AWS.amazonq.featureDev.pillText.retry": "Retry",
Expand All @@ -315,7 +316,7 @@
"AWS.amazonq.featureDev.answer.sessionClosed": "Okay, I've ended this chat session. You can open a new tab to chat or start another workflow.",
"AWS.amazonq.featureDev.answer.newTaskChanges": "What new task would you like to work on?",
"AWS.amazonq.featureDev.placeholder.chatInputDisabled": "Chat input is disabled",
"AWS.amazonq.featureDev.placeholder.additionalImprovements": "Choose an option to proceed",
"AWS.amazonq.featureDev.placeholder.additionalImprovements": "Describe your task or issue in detail",
"AWS.amazonq.featureDev.placeholder.feedback": "Provide feedback or comments",
"AWS.amazonq.featureDev.placeholder.describe": "Describe your task or issue in detail",
"AWS.amazonq.featureDev.placeholder.sessionClosed": "Open a new chat tab to continue"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export class Connector {
this.sendMessageToExtension({
tabID: tabID,
command: 'stop-response',
tabType: 'featuredev',
})
}

Expand Down
22 changes: 11 additions & 11 deletions packages/core/src/amazonq/webview/ui/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ export class Connector {
this.gumbyChatConnector.transform(tabID)
}

onStopChatResponse = (tabID: string): void => {
switch (this.tabsStorage.getTab(tabID)?.type) {
case 'featuredev':
this.featureDevChatConnector.onStopChatResponse(tabID)
break
case 'cwc':
this.cwChatConnector.onStopChatResponse(tabID)
break
}
}

handleMessageReceive = async (message: MessageEvent): Promise<void> => {
if (message.data === undefined) {
return
Expand Down Expand Up @@ -457,17 +468,6 @@ export class Connector {
}
}

onStopChatResponse = (tabID: string): void => {
switch (this.tabsStorage.getTab(tabID)?.type) {
case 'featuredev':
this.featureDevChatConnector.onStopChatResponse(tabID)
break
case 'cwc':
tverney marked this conversation as resolved.
Show resolved Hide resolved
this.cwChatConnector.onStopChatResponse(tabID)
break
}
}

sendFeedback = (tabId: string, feedbackPayload: FeedbackPayload): void | undefined => {
switch (this.tabsStorage.getTab(tabId)?.type) {
case 'featuredev':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class FollowUpInteractionHandler {
if (followUp.prompt !== undefined) {
this.mynahUI.updateStore(tabID, {
loadingChat: true,
cancelButtonWhenLoading: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity does this mean that every single update store will need this? Why isn't the default false and then its true when we want the cancel button (which I assume is the stop button) to show?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself kind of scares me because we need to make sure its propagated everything and that everyone who makes changes to the updateStore knows why it exists

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpinkney-aws Refer to the section on MynahUI https://github.com/aws/mynah-ui/blob/0f47cdf4dcaf2574ec118cdbe7c5cdb9339d4f6d/docs/DATAMODEL.md?plain=1#L38

"In addition to the spinner, if onStopChatResponse is attached globally through MynahUI main class constructor properties (see Constructor properties for details) and cancelButtonWhenLoading is not set to false specifically for that tab it will show the stop generating button too."

You can sync with @dogusata about this specifically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If none of the functionalities are supporting onStopChatResponse why we have it attached to the mynahui instance? If some functions are using it, then this change makes sense. However the defaults can be changed for newly generated tabs. But i don't see any specific difference between giving true to the tabs which will using it or false to tabs which will not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, giving the value during the tab generation is sufficient. Also, until send a new value, the previous value will remain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpinkney-aws do we have a consensus about this specific ? Or do we need sync about it? I'm ok for now with @dogusata, no one its using it, I did safe check in all the places in this PR that we use the store.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just to confirm - state of cancelButtonWhenLoading = false must be passed if onStopChatResponse was specified earlier, otherwise it defaults to true. If onStopChatResponse wasn't passed, then it doesn't matter.

If this is correct then the current implementation is fine IMO.

Copy link
Contributor Author

@tverney tverney Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, that's the behaviour. If onStopChatResponse isn't passed, it defaults to false. Otherwise, need explicitly say false to not show it.

promptInputDisabledState: true,
})
this.mynahUI.addChatItem(tabID, {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/amazonq/webview/ui/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export const createMynahUI = (
mynahUI.updateStore(tabID, {
loadingChat: true,
promptInputDisabledState: true,
cancelButtonWhenLoading: true,
tverney marked this conversation as resolved.
Show resolved Hide resolved
})

if (message && messageId) {
Expand Down Expand Up @@ -307,6 +308,7 @@ export const createMynahUI = (
) {
mynahUI.updateStore(tabID, {
loadingChat: true,
cancelButtonWhenLoading: false,
promptInputDisabledState: true,
})

Expand Down Expand Up @@ -462,6 +464,13 @@ export const createMynahUI = (
onTabRemove: connector.onTabRemove,
onTabChange: connector.onTabChange,
// TODO: update mynah-ui this type doesn't seem correct https://github.com/aws/mynah-ui/blob/3777a39eb534a91fd6b99d6cf421ce78ee5c7526/src/main.ts#L372
onStopChatResponse: (tabID: string) => {
mynahUI.updateStore(tabID, {
loadingChat: false,
promptInputDisabledState: false,
})
connector.onStopChatResponse(tabID)
},
onChatPrompt: (tabID: string, prompt: ChatPrompt, eventId: string | undefined) => {
if ((prompt.prompt ?? '') === '' && (prompt.command ?? '') === '') {
return
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/amazonq/webview/ui/messages/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class MessageController {

this.mynahUI.updateStore(selectedTab.id, {
loadingChat: true,
cancelButtonWhenLoading: false,
promptInputDisabledState: true,
})
this.mynahUI.addChatItem(selectedTab.id, message)
Expand Down Expand Up @@ -107,6 +108,7 @@ export class MessageController {

this.mynahUI.updateStore(newTabID, {
loadingChat: true,
cancelButtonWhenLoading: false,
promptInputDisabledState: true,
})

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/amazonq/webview/ui/messages/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class TextMessageHandler {

this.mynahUI.updateStore(tabID, {
loadingChat: true,
cancelButtonWhenLoading: false,
promptInputDisabledState: true,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class QuickActionHandler {
if (this.tabsStorage.getTab(affectedTabId)?.type !== 'unknown') {
affectedTabId = this.mynahUI.updateStore('', {
loadingChat: true,
cancelButtonWhenLoading: false,
})
}

Expand All @@ -103,6 +104,7 @@ export class QuickActionHandler {
// disable chat prompt
this.mynahUI.updateStore(affectedTabId, {
loadingChat: true,
cancelButtonWhenLoading: false,
})

this.connector.transform(affectedTabId)
Expand Down Expand Up @@ -161,6 +163,7 @@ export class QuickActionHandler {
this.mynahUI.updateStore(affectedTabId, {
loadingChat: true,
promptInputDisabledState: true,
cancelButtonWhenLoading: false,
})

void this.connector.requestGenerativeAIAnswer(affectedTabId, '', {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/amazonq/webview/ui/texts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const uiComponentsTexts = {
save: 'Save',
cancel: 'Cancel',
submit: 'Submit',
stopGenerating: 'Stop generating',
stopGenerating: 'Stop',
copyToClipboard: 'Copied to clipboard',
noMoreTabsTooltip: 'You can only open ten conversation tabs at a time.',
codeSuggestionWithReferenceTitle: 'Some suggestions contain code with references.',
Expand Down
Loading
Loading