Skip to content

Commit 4b52490

Browse files
committed
merge conflicts resolved
2 parents 21e4885 + 26b311e commit 4b52490

File tree

16 files changed

+2123
-169
lines changed

16 files changed

+2123
-169
lines changed

.changes/3.65.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"date" : "2025-04-10",
3+
"version" : "3.65",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "Fix issue where Amazon Q cannot process chunks from local `@workspace` context"
7+
} ]
8+
}

.changes/3.66.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"date" : "2025-04-11",
3+
"version" : "3.66",
4+
"entries" : [ {
5+
"type" : "feature",
6+
"description" : "The logs emitted by the Agent during user command execution will be accepted and written to `.amazonq/dev/run_command.log` file in the user's local repository."
7+
}, {
8+
"type" : "bugfix",
9+
"description" : "Unit test generation now completes successfully when using the `/test` command "
10+
} ]
11+
}

.changes/next-release/bugfix-00947041-108c-4ef1-bec6-eb749dae7c2f.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
# _3.66_ (2025-04-11)
2+
- **(Feature)** The logs emitted by the Agent during user command execution will be accepted and written to `.amazonq/dev/run_command.log` file in the user's local repository.
3+
- **(Bug Fix)** Unit test generation now completes successfully when using the `/test` command
4+
15
# _3.64_ (2025-04-10)
26
- **(Bug Fix)** Fix issue where IDE freezes when logging into Amazon Q
37

8+
# _3.65_ (2025-04-10)
9+
- **(Bug Fix)** Fix issue where Amazon Q cannot process chunks from local `@workspace` context
10+
411
# _3.63_ (2025-04-08)
512
- **(Feature)** Enterprise users can choose their preferred Amazon Q profile to improve personalization and workflow across different business regions
613
- **(Bug Fix)** Amazon Q /doc: close diff tab and open README file in preview mode after user accept changes

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Toolkit Version
5-
toolkitVersion=3.65-SNAPSHOT
5+
toolkitVersion=3.67-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ class BrowserConnector(
178178
var encryptionManager: JwtEncryptionManager? = null
179179
val result = AmazonQLspService.executeIfRunning(project) { server ->
180180
encryptionManager = this.encryptionManager
181-
server.sendChatPrompt(EncryptedChatParams(encryptionManager!!.encrypt(chatParams), partialResultToken))
181+
182+
encryptionManager?.encrypt(chatParams)?.let { EncryptedChatParams(it, partialResultToken) }?.let { server.sendChatPrompt(it) }
183+
182184
} ?: (CompletableFuture.failedFuture(IllegalStateException("LSP Server not running")))
183185

184186
result.whenComplete {
@@ -187,7 +189,7 @@ class BrowserConnector(
187189
val messageToChat = ChatCommunicationManager.convertToJsonToSendToChat(
188190
node.command,
189191
requestFromUi.params.tabId,
190-
encryptionManager?.decrypt(value) ?: "",
192+
encryptionManager?.decrypt(value).orEmpty(),
191193
isPartialResult = false
192194
)
193195
browser.postChat(messageToChat)

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ class CodeTestChatController(
409409
.build()
410410
return GenerateAssistantResponseRequest.builder()
411411
.conversationState(conversationState)
412+
.profileArn(QRegionProfileManager.getInstance().activeProfile(context.project)?.arn)
412413
.build()
413414
}
414415

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/session/CodeGenerationState.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import software.aws.toolkits.telemetry.MetricResult
3030
import java.util.UUID
3131

3232
private val logger = getLogger<CodeGenerationState>()
33+
private const val RUN_COMMAND_LOG_PATH = ".amazonq/dev/run_command.log"
3334

3435
class CodeGenerationState(
3536
override val tabID: String,
@@ -211,9 +212,23 @@ private suspend fun CodeGenerationState.generateCode(
211212
conversationId = config.conversationId,
212213
)
213214

214-
val newFileInfo = registerNewFiles(newFileContents = codeGenerationStreamResult.new_file_contents)
215-
val deletedFileInfo = registerDeletedFiles(deletedFiles = codeGenerationStreamResult.deleted_files)
215+
val fileContents = codeGenerationStreamResult.new_file_contents.filterKeys { file ->
216+
if (file.endsWith(RUN_COMMAND_LOG_PATH)) {
217+
val contents: String = codeGenerationStreamResult.new_file_contents[file].orEmpty()
218+
val truncatedContents = if (contents.length > 10000000) {
219+
contents.substring(0, 10000000)
220+
} else {
221+
contents
222+
}
223+
logger.info(truncatedContents) { "Run command log: $truncatedContents" }
224+
false
225+
} else {
226+
true
227+
}
228+
}
216229

230+
val newFileInfo = registerNewFiles(newFileContents = fileContents)
231+
val deletedFileInfo = registerDeletedFiles(deletedFiles = codeGenerationStreamResult.deleted_files)
217232
return CodeGenerationResult(
218233
newFiles = newFileInfo,
219234
deletedFiles = deletedFileInfo,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/clients/chat/v1/ChatSessionV1.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class ChatSessionV1(
210210
.build()
211211
return GenerateAssistantResponseRequest.builder()
212212
.conversationState(conversationState)
213+
.profileArn(QRegionProfileManager.getInstance().activeProfile(project)?.arn)
213214
.build()
214215
}
215216

@@ -294,6 +295,8 @@ class ChatSessionV1(
294295
UserIntent.EXPLAIN_CODE_SELECTION -> FollowUpType.ExplainInDetail
295296
UserIntent.UNKNOWN_TO_SDK_VERSION -> FollowUpType.Generated
296297
UserIntent.GENERATE_UNIT_TESTS -> FollowUpType.Generated
298+
UserIntent.GENERATE_CLOUDFORMATION_TEMPLATE -> FollowUpType.Generated
299+
UserIntent.CODE_GENERATION -> FollowUpType.Generated
297300
null -> FollowUpType.Generated
298301
}
299302

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/telemetry/TelemetryHelper.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class TelemetryHelper(private val project: Project, private val sessionStorage:
6464
UserIntent.EXPLAIN_CODE_SELECTION -> CwsprChatUserIntent.ExplainCodeSelection
6565
UserIntent.GENERATE_UNIT_TESTS -> CwsprChatUserIntent.GenerateUnitTests
6666
UserIntent.UNKNOWN_TO_SDK_VERSION -> CwsprChatUserIntent.Unknown
67+
UserIntent.GENERATE_CLOUDFORMATION_TEMPLATE -> CwsprChatUserIntent.Unknown
68+
UserIntent.CODE_GENERATION -> CwsprChatUserIntent.Unknown
6769
}
6870

6971
private fun getTelemetryTriggerType(triggerType: TriggerType): CwsprChatTriggerInteraction = when (triggerType) {

plugins/amazonq/chat/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevTestBase.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ open class FeatureDevTestBase(
6565
internal val otherStatus = "Other"
6666
internal val testTabId = "test-tab-id"
6767
internal val testFilePaths = mapOf(Pair("test.ts", "This is a comment"))
68+
internal val testRunCommandLogPath = ".amazonq/dev/run_command.log"
69+
internal val testLogPath = mapOf(Pair(testRunCommandLogPath, "This is a log"))
6870
internal val testDeletedFiles = listOf("deleted.ts")
6971
internal val testReferences = listOf(CodeReferenceGenerated())
7072
internal val testChecksumSha = "test-sha"

plugins/amazonq/chat/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/session/CodeGenerationStateTest.kt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ class CodeGenerationStateTest : FeatureDevTestBase() {
3939
private lateinit var messenger: MessagePublisher
4040
private val action = SessionStateAction("test-task", userMessage)
4141
private lateinit var featureDevService: FeatureDevService
42+
private lateinit var repoContext: FeatureDevSessionContext
4243

4344
@Before
4445
override fun setup() {
4546
featureDevService = mockk<FeatureDevService>()
4647
every { featureDevService.project } returns projectRule.project
4748
messenger = mock()
48-
val repoContext = mock<FeatureDevSessionContext>()
49+
repoContext = mockk<FeatureDevSessionContext>()
4950
val sessionStateConfig = SessionStateConfig(testConversationId, repoContext, featureDevService)
5051

5152
codeGenerationState =
@@ -103,6 +104,34 @@ class CodeGenerationStateTest : FeatureDevTestBase() {
103104
coVerify(exactly = 1) { featureDevService.exportTaskAssistArchiveResult(testConversationId) }
104105
}
105106

107+
@Test
108+
fun `test generateCode excludes run_command log file`() {
109+
val runCommandLogFileName = "run_command.log"
110+
111+
val archiveFiles = mapOf(
112+
runCommandLogFileName to "newLog",
113+
"other.ts" to "other content"
114+
)
115+
val deletedFiles = emptyList<DeletedFileInfo>()
116+
val references = emptyList<CodeReference>()
117+
118+
every { featureDevService.getTaskAssistCodeGeneration(any(), any()) } returns exampleCompleteGetTaskAssistCodeGenerationResponse
119+
every { featureDevService.startTaskAssistCodeGeneration(any(), any(), any(), any(), any()) } returns exampleStartTaskAssistConversationResponse
120+
coEvery { featureDevService.exportTaskAssistArchiveResult(any()) } returns
121+
CodeGenerationStreamResult(archiveFiles, listOf("deleted.ts"), listOf(CodeReferenceGenerated()))
122+
123+
runTest {
124+
val actual = codeGenerationState.interact(action)
125+
val nextState = actual.nextState as PrepareCodeGenerationState
126+
assertThat(nextState.filePaths).contains(
127+
NewFileZipInfo(runCommandLogFileName, "newLog", rejected = false, changeApplied = false)
128+
)
129+
assertThat(nextState.filePaths).contains(
130+
NewFileZipInfo("other.ts", "other content", rejected = false, changeApplied = false)
131+
)
132+
}
133+
}
134+
106135
@Test(expected = FeatureDevException::class)
107136
fun `test code generation failed`() =
108137
runTest {

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ArtifactHandler.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ class ArtifactHandler(
528528
TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS -> CodeTransformArtifactType.ClientInstructions
529529
TransformationDownloadArtifactType.LOGS -> CodeTransformArtifactType.Logs
530530
TransformationDownloadArtifactType.UNKNOWN_TO_SDK_VERSION -> CodeTransformArtifactType.Unknown
531+
TransformationDownloadArtifactType.GENERATED_CODE -> CodeTransformArtifactType.Unknown
531532
}
532533

533534
companion object {

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,4 +778,5 @@ fun getDownloadedArtifactTextFromType(artifactType: TransformationDownloadArtifa
778778
TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS -> "upgraded code"
779779
TransformationDownloadArtifactType.LOGS -> "build log"
780780
TransformationDownloadArtifactType.UNKNOWN_TO_SDK_VERSION -> "code"
781+
TransformationDownloadArtifactType.GENERATED_CODE -> "code"
781782
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/clients/AmazonQStreamingClient.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class AmazonQStreamingClient(private val project: Project) {
6161
it.exportId(exportId)
6262
it.exportIntent(exportIntent)
6363
it.exportContext(exportContext)
64+
it.profileArn(QRegionProfileManager.getInstance().activeProfile(project)?.arn)
6465
},
6566
ExportResultArchiveResponseHandler.builder().subscriber(
6667
ExportResultArchiveResponseHandler.Visitor.builder()

0 commit comments

Comments
 (0)