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

Added LLM-based issue summarizer. #1927

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

trm109
Copy link

@trm109 trm109 commented Aug 19, 2024

Issue #, if available:
N/A
Description of changes:
Added a GitHub Action that will summarize issues via:

  • /summarize
    • Will summarize the issue in which the command is being called
  • /summarize 123
    • Will summarize issue number 123
  • /summarize bob dotfiles 123
    • Will summarize issue number 123 of the repository: bob/dotfiles

Example Output:

/summarize awslabs amazon-eks-ami 1751

Here's a summary of the GitHub Issue reply chain:

Issue: Startup is significantly slower on the AL2023 AMI compared to the AL2 AMI for Amazon EKS.

Key points:

  1. The issue creator (stijndehaes) noticed that startup time increased from about 40 seconds on AL2 to over 100 seconds on AL2023.

  2. Analysis using systemd-analyze showed that nodeadm components were in the critical path, with nodeadm-config.service and nodeadm-run.service taking significant time.

  3. Investigations revealed that getting the kubelet version was a major bottleneck, taking about 13 seconds.

  4. Enabling EBS fast-restore improved startup time to around 50 seconds, but it was still slower than AL2.

  5. Experiments were conducted to optimize the startup process:

  • Caching the kubelet version in an environment variable reduced nodeadm-config.service time from 21s to 5.12s.
  • Disabling update-motd.service further improved startup time.
  1. Despite optimizations, AL2023 startup remained slower than AL2 (about 40s vs. 22s).

Conclusions/Proposed Solutions:

  1. A pull request was created to disable update-motd.service for performance improvement.
  2. Caching the kubelet version during build time was suggested to avoid slow executable access during startup.
  3. The team is considering various optimizations to reduce startup time, including changing how the kubelet version is obtained and stored.

The issue remains open, with ongoing discussions about further optimizations to bring AL2023 startup time closer to that of AL2.

The bot utilizes AWS Bedrock to trigger a InvokeModelCommand to Claude 3.5 Sonnet. In order to achieve this, a few things will have to be configured on a AWS Account:

  • An OIDC Identity Provider for GitHub
  • (An IAM Role with access to Bedrock)[https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html]
    • This role must have a trust policy allowing the GitHub OIDC Identity Provider to sts:AssumeRoleWithWebIdentity

⚠️ This Repository must also provide the ARN of this role in Secrets as BEDROCK_ACTION_ROLE_ARN

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

  • Tested on forked repository.
  • Tested on awslabs/amazon-eks-ami, awslabs/aws-shell, hashicorp/packer and verified robustness of summarization.
  • Tested auth (confirmed that only owner/members can invoke command)

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

- name: Summarize issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODEL_ID : "anthropic.claude-3-5-sonnet-20240620-v1:0"
Copy link
Member

Choose a reason for hiding this comment

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

If this is going to be hard-coded, it can just go in your Action js script

Copy link
Author

@trm109 trm109 Aug 21, 2024

Choose a reason for hiding this comment

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

True, will migrate in next revision. Originally the idea was to be able to hot-swap models if needed, but I've noticed the inputs vary too much from model to model to be feasible.


console.log("Prompting LLM with:\n" + JSON.stringify(modelInput));

try {
Copy link
Member

Choose a reason for hiding this comment

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

  1. too much going on in a single try/catch
  2. if you just catch the error, log it, and rethrow -- you don't need the try/catch

Copy link
Author

Choose a reason for hiding this comment

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

Good catch, revising in next revision.

Comment on lines 63 to 69
messages[0].content.push({
type: "text",
text: `
Human: ${prompt}
Assistant:
`
});
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you move this into the declaration of messages above?

Comment on lines 38 to 49
let commentLog = "Comment Log:\n";

commentLog += `${issue.user.login} created the issue:\n "${issue.body}"\n`

for (const comment of comments) {
if(
(comment.user.login != "github-actions[bot]") &&
(!comment.body.startsWith("/"))
){
commentLog += `${comment.user.login} says:\n"${comment.body}"\n`
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Building the string like this is a bit clunky, maybe try something like:

const commentLog = comments.filter(c => c.user.login != "github-actions[bot]")
    .map(c => `${c.user.login} says: ...`)
    .join('\n');

Comment on lines +11 to +17
const authorized = ["OWNER", "MEMBER"].includes(payload.comment.author_association);
// Ensure that invoker is either a Owner or member of awslabs / amazon-eks-ami
if (!authorized) {
console.log(`Comment author is not authorized: ${author}`);
return;
}
console.log(`Comment author is authorized: ${author}`);
Copy link
Member

Choose a reason for hiding this comment

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

We need to extend the existing bot vs reimplementing the authz here

console.log(`Comment author is authorized: ${author}`);

// Split the command into parts
const parts = process.env.COMMENT_BODY.trim().split(' ');
Copy link
Member

Choose a reason for hiding this comment

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

What if the comment has more than just the command in it? what if it has multiple commands?

Copy link
Author

Choose a reason for hiding this comment

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

Currently, it requires that you only type a single command. Working on moving the summarizer over to the existing bot.

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.

3 participants