Skip to content

Commit cf3f30b

Browse files
authored
feat(feature dev): Remove planning phase in favor for new code gen agent (#5534)
## Problem Us (QSDA) team is launching a new code generation agent. We have conducted experiments wIth the new code generation agent, we observed: - Removing planning phase produces higher quality code - Removing planning phase has general better user experience and remove the inconsistency of code gen & plan gen We have discussed with product that the rollout of new code generation agent should also include planning phase removal as a whole, without an A/B testing mechanism nor backward compatible implementation. The endpoint for plan generation will still exist to support older toolkit versions. We plan to release the new code generation agent experience in the week of September 9th. Please squash merge this pull request, thank you! ## Solution - Removed planning phase & refine plan in a typical /dev flow. - Modified customer facing copies.
1 parent b85c223 commit cf3f30b

File tree

14 files changed

+105
-650
lines changed

14 files changed

+105
-650
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Removal",
3+
"description": "Amazon Q Feature dev: Remove approach generation flow"
4+
}

packages/amazonq/test/unit/amazonqFeatureDev/session/session.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ describe('session', () => {
6161

6262
const uploadID = '789'
6363
const tabID = '123'
64-
const testApproach = 'test-approach'
6564
const workspaceFolders = [controllerSetup.workspaceFolder] as CurrentWsFolders
6665
workspaceFolderUriFsPath = controllerSetup.workspaceFolder.uri.fsPath
6766
uri = generateVirtualMemoryUri(uploadID, notRejectedFileName)
@@ -76,7 +75,6 @@ describe('session', () => {
7675

7776
const codeGenState = new CodeGenState(
7877
testConfig,
79-
testApproach,
8078
[
8179
{
8280
zipFilePath: notRejectedFileName,

packages/core/package.nls.json

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,8 @@
272272
"AWS.amazonq.featureDev.error.prepareRepoFailedError": "Sorry, I ran into an issue while trying to upload your code. Please try again.",
273273
"AWS.amazonq.featureDev.error.promptRefusalException": "I'm sorry, I can't generate code for your request. Please make sure your message and code files comply with the <a href=\"https://aws.amazon.com/machine-learning/responsible-ai/policy/\">AWS Responsible AI Policy.</a>",
274274
"AWS.amazonq.featureDev.error.zipFileError": "The zip file is corrupted",
275-
"AWS.amazonq.featureDev.error.planIterationLimitError": "Sorry, you've reached the quota for number of iterations on an implementation plan. You can generate code for this task or discuss a new plan. For more information on quotas, see the <a href=\"https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/software-dev.html#quotas\">Amazon Q Developer documentation</a>.",
276275
"AWS.amazonq.featureDev.error.codeIterationLimitError": "Sorry, you've reached the quota for number of iterations on code generation. You can insert this code in your files or discuss a new plan. For more information on quotas, see the <a href=\"https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/software-dev.html#quotas\" target=\"_blank\">Amazon Q Developer documentation.</a>",
277276
"AWS.amazonq.featureDev.error.tabIdNotFoundError": "I'm sorry, I'm having technical difficulties at the moment. Please try again.",
278-
"AWS.amazonq.featureDev.error.approachPhase.denyListedError": "I'm sorry, I'm having trouble generating a plan. Please try again.",
279-
"AWS.amazonq.featureDev.error.approachPhase.default": "I'm sorry, I ran into an issue while trying to approach the problem. Please try again.",
280277
"AWS.amazonq.featureDev.error.codeGen.denyListedError": "I'm sorry, I'm having trouble generating your code and can't continue at the moment. Please try again later, and share feedback to help me improve.",
281278
"AWS.amazonq.featureDev.error.codeGen.default": "I'm sorry, I ran into an issue while trying to generate your code. Please try again.",
282279
"AWS.amazonq.featureDev.error.codeGen.timeout": "Code generation did not finish within the expected time",
@@ -287,35 +284,34 @@
287284
"AWS.amazonq.featureDev.error.technicalDifficulties": "I'm sorry, I'm having technical difficulties and can't continue at the moment. Please try again later, and share feedback to help me improve.",
288285
"AWS.amazonq.featureDev.error.throttling": "I'm sorry, I'm experiencing high demand at the moment and can't generate your code. This attempt won't count toward usage limits. Please try again.",
289286
"AWS.amazonq.featureDev.error.submitFeedback": "'submitFeedback' command was called programmatically, but its not registered.",
290-
"AWS.amazonq.featureDev.error.approachNewTab": "There has been a problem generating an approach. Please open a conversation in a new tab",
291-
"AWS.amazonq.featureDev.pillText.awaitMessage": "This may take a few minutes. I will send a notification when it's complete if you navigate away from this panel, but please keep the tab open.",
287+
"AWS.amazonq.featureDev.pillText.awaitMessage": "Okay, I'll generate code for that.\n\nThis might take a few minutes. You can navigate away from this chat, but please keep this tab open. I'll notify you when I'm done.",
288+
"AWS.amazonq.featureDev.pillText.awaitMessageRetry": "Okay, I'll generate new code.\n\nThis might take a few minutes. You can navigate away from this chat, but please keep this tab open. I'll notify you when I'm done.",
292289
"AWS.amazonq.featureDev.pillText.modifyDefaultSourceFolder": "Choose another folder in your workspace",
293-
"AWS.amazonq.featureDev.pillText.newPlan": "Discuss a new plan",
294-
"AWS.amazonq.featureDev.pillText.newTask": "Work on new task",
290+
"AWS.amazonq.featureDev.pillText.newTask": "Yes, I have another task",
295291
"AWS.amazonq.featureDev.pillText.generateCode": "Generate code",
292+
"AWS.amazonq.featureDev.pillText.uploadingCode": "Uploading code ...",
293+
"AWS.amazonq.featureDev.pillText.contextGatheringCompleted": "Gathering context...",
296294
"AWS.amazonq.featureDev.pillText.generatingCode": "Generating code ...",
297-
"AWS.amazonq.featureDev.pillText.generatingPlan": "Generating plan ...",
298295
"AWS.amazonq.featureDev.pillText.requestingChanges": "Requesting changes ...",
299296
"AWS.amazonq.featureDev.pillText.insertCode": "Insert code",
300297
"AWS.amazonq.featureDev.pillText.sendFeedback": "Send feedback",
301298
"AWS.amazonq.featureDev.pillText.selectFiles": "Select files for context",
302299
"AWS.amazonq.featureDev.pillText.retry": "Retry",
303300
"AWS.amazonq.featureDev.pillText.writeNewPrompt": "Write a new prompt",
304301
"AWS.amazonq.featureDev.pillText.reauthenticate": "Follow instructions to re-authenticate ...",
305-
"AWS.amazonq.featureDev.pillText.closeSession": "Close session",
302+
"AWS.amazonq.featureDev.pillText.closeSession": "No, thanks",
306303
"AWS.amazonq.featureDev.pillText.selectOption": "Select an option above to proceed",
307304
"AWS.amazonq.featureDev.pillText.unableGenerateChanges": "Unable to generate any file changes",
308305
"AWS.amazonq.featureDev.pillText.provideFeedback": "Provide feedback to regenerate",
309306
"AWS.amazonq.featureDev.answer.generateSuggestion": "Would you like to generate a suggestion for this? You’ll review a file diff before inserting into your project.",
310-
"AWS.amazonq.featureDev.answer.howPlanCanBeImproved": "How can this plan be improved?",
311307
"AWS.amazonq.featureDev.answer.qGeneratedCode": "The Amazon Q Developer Agent for software development has generated code for you to review",
312-
"AWS.amazonq.featureDev.answer.howCodeCanBeImproved": "How can the code be improved?",
313-
"AWS.amazonq.featureDev.answer.approachCreation": "Ok, let me create a plan. This may take a few minutes.",
314-
"AWS.amazonq.featureDev.answer.updateCode": "Code has been updated. Would you like to work on another task?",
315-
"AWS.amazonq.featureDev.answer.sessionClosed": "Your session is now closed.",
316-
"AWS.amazonq.featureDev.answer.newTaskChanges": "What change would you like to make?",
308+
"AWS.amazonq.featureDev.answer.howCodeCanBeImproved": "How can I improve the code for your use case?",
309+
"AWS.amazonq.featureDev.answer.updateCode": "Okay, I updated your code files. Would you like to work on another task?",
310+
"AWS.amazonq.featureDev.answer.sessionClosed": "Okay, I've ended this chat session. You can open a new tab to chat or start another workflow.",
311+
"AWS.amazonq.featureDev.answer.newTaskChanges": "What new task would you like to work on?",
317312
"AWS.amazonq.featureDev.placeholder.chatInputDisabled": "Chat input is disabled",
318313
"AWS.amazonq.featureDev.placeholder.additionalImprovements": "Provide input on additional improvements",
319314
"AWS.amazonq.featureDev.placeholder.feedback": "Feedback, comments ...",
320-
"AWS.amazonq.featureDev.placeholder.describe": "Describe your task or issue in as much detail as possible"
315+
"AWS.amazonq.featureDev.placeholder.describe": "Describe your task or issue in as much detail as possible",
316+
"AWS.amazonq.featureDev.placeholder.sessionClosed": "Open a new chat tab to continue"
321317
}

packages/core/src/amazonq/webview/ui/followUps/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class FollowUpGenerator {
4444
switch (tabType) {
4545
case 'featuredev':
4646
return {
47-
text: 'Would you like to follow up with',
47+
text: 'Ask a follow up question',
4848
options: [
4949
{
5050
pillText: 'What are some examples of tasks?',

packages/core/src/amazonq/webview/ui/tabs/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export const TabTypeDataMap: Record<TabType, TabTypeData> = {
2626
placeholder: 'Describe your task or issue in as much detail as possible',
2727
welcome: `Hi, I'm the Amazon Q Developer Agent for software development.
2828
29-
I can generate code to implement new functionality across your workspace. We'll start by discussing an implementation plan, and then we can review and regenerate code based on your feedback.
29+
I can generate code to implement new functionality across your workspace. To get started, describe the task you're trying to accomplish, and I'll generate code. If you want to make changes, you can provide feedback and I'll regenerate code.
3030
31-
To get started, describe the task you are trying to accomplish.`,
31+
What would you like to work on?`,
3232
},
3333
gumby: {
3434
title: 'Q - Code Transformation',

packages/core/src/amazonqFeatureDev/client/featureDev.ts

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@ import {
1818
CodeIterationLimitError,
1919
ContentLengthError,
2020
MonthlyConversationLimitError,
21-
PlanIterationLimitError,
2221
UnknownApiError,
2322
} from '../errors'
24-
import {
25-
ToolkitError,
26-
isAwsError,
27-
isCodeWhispererStreamingServiceException,
28-
getHttpStatusCode,
29-
} from '../../shared/errors'
23+
import { ToolkitError, isAwsError } from '../../shared/errors'
3024
import { getCodewhispererConfig } from '../../codewhisperer/client/codewhisperer'
31-
import { LLMResponseType } from '../types'
3225
import { createCodeWhispererChatStreamingClient } from '../../shared/clients/codewhispererChatClient'
3326
import { getClientId, getOptOutPreference, getOperatingSystem } from '../../shared/telemetry/util'
3427
import { extensionVersion } from '../../shared/vscode/env'
@@ -55,15 +48,6 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie
5548
)) as FeatureDevProxyClient
5649
}
5750

58-
const streamResponseErrors: Record<string, number> = {
59-
ValidationException: 400,
60-
AccessDeniedException: 403,
61-
ResourceNotFoundException: 404,
62-
ConflictException: 409,
63-
ThrottlingException: 429,
64-
InternalServerException: 500,
65-
}
66-
6751
export class FeatureDevClient {
6852
public async getClient() {
6953
// Should not be stored for the whole session.
@@ -132,77 +116,6 @@ export class FeatureDevClient {
132116
throw new UnknownApiError(e instanceof Error ? e.message : 'Unknown error', 'CreateUploadUrl')
133117
}
134118
}
135-
public async generatePlan(
136-
conversationId: string,
137-
uploadId: string,
138-
userMessage: string
139-
): Promise<
140-
{ responseType: 'EMPTY'; approach?: string } | { responseType: 'VALID' | 'INVALID_STATE'; approach: string }
141-
> {
142-
try {
143-
const streamingClient = await createCodeWhispererChatStreamingClient()
144-
const params = {
145-
workspaceState: {
146-
programmingLanguage: { languageName: 'javascript' },
147-
uploadId,
148-
},
149-
conversationState: {
150-
currentMessage: { userInputMessage: { content: userMessage } },
151-
chatTriggerType: 'MANUAL',
152-
conversationId,
153-
},
154-
}
155-
getLogger().debug(`Executing generateTaskAssistPlan with %O`, params)
156-
const response = await streamingClient.generateTaskAssistPlan(params)
157-
getLogger().debug(`${featureName}: Generated plan: %O`, {
158-
requestId: response.$metadata.requestId,
159-
})
160-
let responseType: LLMResponseType = 'EMPTY'
161-
if (!response.planningResponseStream) {
162-
return { responseType }
163-
}
164-
165-
const assistantResponse: string[] = []
166-
for await (const responseItem of response.planningResponseStream) {
167-
if (responseItem.error !== undefined) {
168-
throw responseItem.error
169-
} else if (responseItem.invalidStateEvent !== undefined) {
170-
getLogger().debug('Received Invalid State Event: %O', responseItem.invalidStateEvent)
171-
assistantResponse.splice(0)
172-
assistantResponse.push(responseItem.invalidStateEvent.message ?? '')
173-
responseType = 'INVALID_STATE'
174-
break
175-
} else if (responseItem.assistantResponseEvent !== undefined) {
176-
responseType = 'VALID'
177-
assistantResponse.push(responseItem.assistantResponseEvent.content ?? '')
178-
}
179-
}
180-
return { responseType, approach: assistantResponse.join('') }
181-
} catch (e) {
182-
if (isCodeWhispererStreamingServiceException(e)) {
183-
getLogger().error(
184-
`${featureName}: failed to execute planning: ${e.message} RequestId: ${
185-
e.$metadata.requestId ?? 'unknown'
186-
}`
187-
)
188-
if (
189-
(e.name === 'ThrottlingException' &&
190-
e.message.includes('limit for number of iterations on an implementation plan')) ||
191-
e.name === 'ServiceQuotaExceededException'
192-
) {
193-
throw new PlanIterationLimitError()
194-
}
195-
throw new ApiError(
196-
e.message,
197-
'GeneratePlan',
198-
e.name,
199-
getHttpStatusCode(e) ?? streamResponseErrors[e.name] ?? 500
200-
)
201-
}
202-
203-
throw new UnknownApiError(e instanceof Error ? e.message : 'Unknown error', 'GeneratePlan')
204-
}
205-
}
206119

207120
public async startCodeGeneration(conversationId: string, uploadId: string, message: string) {
208121
try {

0 commit comments

Comments
 (0)