Skip to content

Conversation

@karanA-aws
Copy link
Contributor

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

Problem

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

Solution

The output generated by the Agent during user command execution will be captured and written to the user's logs. This ensures that:

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

  • 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.
  • 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 22:39
@karanA-aws karanA-aws force-pushed the master branch 2 times, most recently from 9806f89 to ecd3fde Compare March 24, 2025 16:34
@karanA-aws karanA-aws force-pushed the master branch 2 times, most recently from 7ebe0e9 to e2a0738 Compare March 25, 2025 00:46
@karanA-aws karanA-aws requested a review from neilk-aws March 25, 2025 00:48
@karanA-aws karanA-aws force-pushed the master branch 14 times, most recently from d0d5e37 to 67f02d8 Compare March 26, 2025 01:13
@karanA-aws karanA-aws force-pushed the master branch 6 times, most recently from 292e569 to 57bfbf5 Compare March 26, 2025 17:28
@karanA-aws karanA-aws force-pushed the master branch 5 times, most recently from 2b18918 to cd3ac96 Compare March 27, 2025 19:54
@karanA-aws karanA-aws requested a review from jpinkney-aws March 27, 2025 22:46
@karanA-aws karanA-aws force-pushed the master branch 4 times, most recently from 0bc6aad to dabd1b9 Compare March 28, 2025 17:29
file.zipFilePath === RunCommandLogFileName
)
if (logFileInfo) {
getLogger().info(`sessionState: Run Command logs, ${logFileInfo.fileContent}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the typical value of logFileInfo.fileContent ? is it potentially all of the contents of a big text file, or is it guaranteed to be just a small bit of text (e.g a filename or something like that)?

full text files should not be printed to the logs.

consider using truncate() to avoid printing excessively long text.

export function truncate(s: string, n: number, suffix?: string): string {

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 intent of the feature is to display the logs of the commands executed by the Agent to the User. Therefore the length of the logFileInfo.fileContent can be large which will be reflective of the logs generated if the user would've ran the code in their execution environment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then it should be truncated to avoid edge cases where the logs are very large. Writing MB or GB to the log file isn't ever going to be useful to anyone, and is likely to cause problems instead.

Please always consider edge-cases when writing code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Truncating to limit the content length in revision.

@karanA-aws karanA-aws requested a review from justinmk3 April 1, 2025 22:08
@karanA-aws karanA-aws force-pushed the master branch 2 times, most recently from 8daee2b to 0f2a444 Compare April 2, 2025 18:15
@justinmk3 justinmk3 changed the title feat(amazonq): skip registering run command log file feat(amazonq): get logs generated by the Agent Apr 2, 2025
@justinmk3 justinmk3 merged commit bb5c10a into aws:master Apr 2, 2025
30 of 31 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.

5 participants