Skip to content

Conversation

@karanA-aws
Copy link
Contributor

@karanA-aws karanA-aws commented Mar 21, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Problem:
Users currently cannot access logs generated by the Agent when it executes user commands during code generation.

Solution:
The logs emitted by the Agent during user command execution will be accepted and written to the logs in the user's local repository. This ensures that:

  • Command execution logs are persisted locally
  • Users can access the logs directly from their repository

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karanA-aws karanA-aws requested review from a team as code owners March 21, 2025 03:20
@karanA-aws karanA-aws changed the title feat(/dev): skip registering run command log file feat(amazonq): skip registering run command log file Mar 21, 2025
@karanA-aws karanA-aws closed this Mar 21, 2025
@karanA-aws karanA-aws reopened this Mar 21, 2025
@karanA-aws karanA-aws force-pushed the main branch 2 times, most recently from 983f9b1 to 4fbd7bf Compare March 24, 2025 16:54
@karanA-aws karanA-aws force-pushed the main branch 2 times, most recently from 8ac0a97 to dffd769 Compare March 25, 2025 00:34
@karanA-aws karanA-aws requested a review from neilk-aws March 25, 2025 00:50
@karanA-aws karanA-aws force-pushed the main branch 2 times, most recently from 961d59d to aca090b Compare March 27, 2025 22:36
@karanA-aws karanA-aws force-pushed the main branch 3 times, most recently from 26185ba to 3e05b4e Compare March 28, 2025 00:04
val mutableNewFileContents = codeGenerationStreamResult.new_file_contents.toMutableMap()
val keysToRemove = mutableListOf<String>()
for (file in mutableNewFileContents.keys) {
if (file.endsWith(".amazonq/dev/run_command.log")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this path OS specific?

Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The path is a placeholder value and won't interact with filesystem.
Using const. Thanks.

Comment on lines 214 to 225
val mutableNewFileContents = codeGenerationStreamResult.new_file_contents.toMutableMap()
val keysToRemove = mutableListOf<String>()
for (file in mutableNewFileContents.keys) {
if (file.endsWith(".amazonq/dev/run_command.log")) {
val contents: String = mutableNewFileContents[file].orEmpty()
logger.info(contents) { "Run command log: $contents" }
keysToRemove.add(file)
}
}
keysToRemove.forEach { key -> mutableNewFileContents.remove(key) }

val newFileInfo = registerNewFiles(newFileContents = mutableNewFileContents)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
val mutableNewFileContents = codeGenerationStreamResult.new_file_contents.toMutableMap()
val keysToRemove = mutableListOf<String>()
for (file in mutableNewFileContents.keys) {
if (file.endsWith(".amazonq/dev/run_command.log")) {
val contents: String = mutableNewFileContents[file].orEmpty()
logger.info(contents) { "Run command log: $contents" }
keysToRemove.add(file)
}
}
keysToRemove.forEach { key -> mutableNewFileContents.remove(key) }
val newFileInfo = registerNewFiles(newFileContents = mutableNewFileContents)
val fileContents = codeGenerationStreamResult.new_file_contents.filterKeys { file ->
if (file.endsWith(".amazonq/dev/run_command.log")) {
val contents: String = mutableNewFileContents[file].orEmpty()
logger.info(contents) { "Run command log: $contents" }
true
} else {
false
}
}
val newFileInfo = registerNewFiles(newFileContents = fileContents)

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@karanA-aws karanA-aws force-pushed the main branch 3 times, most recently from 0866120 to 0155aea Compare April 4, 2025 03:32
@karanA-aws karanA-aws dismissed neilk-aws’s stale review April 4, 2025 16:53

Updated as suggested.

@karanA-aws karanA-aws reopened this Apr 10, 2025
@karanA-aws karanA-aws enabled auto-merge (squash) April 10, 2025 20:35
@karanA-aws karanA-aws merged commit 4cf050a into aws:main Apr 11, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants