Skip to content

Conversation

Kangyan-Zhou
Copy link
Collaborator

Motivation

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

- Use specific exception (RequestException) instead of bare except
- Calculate failure rate once and reuse to avoid inconsistency
Copy link
Contributor

Summary of Changes

Hello @Kangyan-Zhou, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the CI monitoring system by refining existing analytics and introducing a dedicated tool for identifying flaky jobs. The changes aim to provide a clearer and more precise understanding of CI stability and problematic areas, allowing developers to more effectively address intermittent failures and improve overall CI reliability.

Highlights

  • Improved CI Analyzer Metrics: The existing CI analyzer (ci_analyzer.py) has been updated to provide more accurate statistics. It now filters runs by the 'main' branch, tracks total job runs (excluding cancelled/skipped), and calculates the overall success rate based only on completed runs. The 'Most Frequently Failed Jobs' report now sorts by and displays the failure rate percentage for better insight.
  • New Flaky Job Analyzer: A new script (ci_analyzer_flaky_jobs.py) has been introduced to specifically identify flaky CI jobs. This analyzer groups CI runs by commit SHA to detect jobs that fail and then succeed on a retry for the same commit, providing a detailed report of flakiness percentages and examples.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci-monitor.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several valuable improvements to the CI monitoring scripts. The changes in ci_analyzer.py to filter runs by the main branch, refine the success rate calculation, and sort failing jobs by failure rate are excellent enhancements that make the report more accurate and actionable. The new ci_analyzer_flaky_jobs.py script is a great addition for identifying and tracking flaky tests, which is crucial for CI stability.

My review comments focus on improving the flexibility and maintainability of the new script. I've suggested parameterizing hardcoded values like the repository name and branch, using constants instead of magic numbers and inline lists, and ensuring consistency between the two analyzer scripts. Additionally, there's some code duplication between the two files (e.g., get_recent_runs) that could be refactored into a shared base class or utility module in the future to improve long-term maintainability.

params = {
"per_page": min(per_page, limit - len(all_runs)),
"page": page,
"branch": "main",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding the branch to "main" makes this function less flexible. Consider making it a parameter to get_recent_runs (e.g., branch: str = "main") so the script can be used to analyze other branches without code changes.

def __init__(self, token: str):
self.token = token
self.base_url = "https://api.github.com"
self.repo = "sgl-project/sglang"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The repository is hardcoded. This limits the script's reusability. It would be better to make this configurable, for instance by passing it as an argument to __init__ and adding a corresponding command-line option in main().


while len(all_runs) < limit:
url = f"{self.base_url}/repos/{self.repo}/actions/runs"
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This get_recent_runs implementation fetches runs from all branches, which is inconsistent with the change in ci_analyzer.py that filters for the 'main' branch. To ensure consistent and focused analysis, consider adding a branch filter here as well. You could hardcode 'main' for now or make it a configurable parameter.

Suggested change
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page}
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page, "branch": "main"}

Comment on lines +114 to +119
if job_name in [
"check-changes",
"pr-test-finish",
"pr-test-h20-finish",
"lint",
]:
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This list of ignored jobs is hardcoded inside the method. For better maintainability and readability, it's best practice to define this as a class-level constant. Using a set is also more performant for membership checks than a list.

Suggested change
if job_name in [
"check-changes",
"pr-test-finish",
"pr-test-h20-finish",
"lint",
]:
if job_name in {
"check-changes",
"pr-test-finish",
"pr-test-h20-finish",
"lint",
}:

flaky_stats["flaky_jobs"][job_name]["flaky_count"] += 1

# Store example (limit to 5 per job)
if len(flaky_stats["flaky_jobs"][job_name]["examples"]) < 5:
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The number 5 here is a magic number. It's better to define it as a named constant at the class or module level (e.g., MAX_FLAKY_EXAMPLES = 5). This improves code readability and makes it easier to modify this value in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants