Add bot-bump-kernel-version-to-sglang workflow#12794
Conversation
This workflow automatically syncs sgl-kernel version from sgl-kernel/pyproject.toml to SGLang files: - python/pyproject.toml - python/sglang/srt/entrypoints/engine.py - docker/Dockerfile The workflow runs daily and can be manually triggered. It detects version mismatches and creates PRs to sync them.
Summary of ChangesHello @alisonshao, 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 implements a new automated workflow designed to maintain strict version consistency for the Highlights
Ignored Files
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new GitHub workflow to automatically synchronize the sgl-kernel version across various files in the repository. The changes include new Python scripts for checking and bumping the version, a shell script for automating commits and pull requests, and documentation for the new workflow. The implementation is solid, and my feedback focuses on improving the robustness and maintainability of the new scripts.
|
|
||
| ### What it does | ||
|
|
||
| 1. Reads the kernel version from `sgl-kernel/pyproject.toml` (line 11) |
There was a problem hiding this comment.
The hardcoded line number (line 11) is brittle and may become outdated if sgl-kernel/pyproject.toml is modified. It's better to describe the location of the version more generally to avoid future confusion. For example, you could refer to the project.version field under the [project] table.
| 1. Reads the kernel version from `sgl-kernel/pyproject.toml` (line 11) | |
| 1. Reads the kernel version from the `project.version` field in `sgl-kernel/pyproject.toml` |
| def get_kernel_version_from_source() -> str: | ||
| """Extract version from sgl-kernel/pyproject.toml""" | ||
| pyproject_path = Path("sgl-kernel/pyproject.toml") | ||
|
|
||
| if not pyproject_path.exists(): | ||
| print(f"Error: {pyproject_path} not found") | ||
| sys.exit(1) | ||
|
|
||
| with open(pyproject_path, "rb") as f: | ||
| data = tomllib.load(f) | ||
|
|
||
| version = data.get("project", {}).get("version") | ||
| if not version: | ||
| print("Error: Could not find version in sgl-kernel/pyproject.toml") | ||
| sys.exit(1) | ||
|
|
||
| return version |
There was a problem hiding this comment.
This function get_kernel_version_from_source is identical to the one in scripts/release/check_kernel_version_to_sglang.py. There's also other duplicated logic between these two files, such as hardcoded file paths and the file reading/error handling pattern. To improve maintainability and reduce redundancy, consider refactoring the shared logic into a common utility module (e.g., version_utils.py). This would centralize the logic and make future updates easier.
| @@ -0,0 +1,81 @@ | |||
| #!/bin/bash | |||
| set -e | |||
There was a problem hiding this comment.
For better script robustness, it's a good practice to use set -euo pipefail.
e: exits immediately if a command exits with a non-zero status. (Already present)u: treats unset variables as an error and exits immediately.o pipefail: causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero status.
This helps catch common errors and makes the script more reliable.
| set -e | |
| set -euo pipefail |
- Change workflow to manual trigger only (remove daily schedule) - Remove README_KERNEL_TO_SGLANG.md
|
@alisonshao can you fix the lint error in https://github.com/sgl-project/sglang/actions/runs/19149275539/job/54734996190?pr=12794? |
This workflow automatically syncs sgl-kernel version from sgl-kernel/pyproject.toml to SGLang files:
The workflow runs daily and can be manually triggered. It detects version mismatches and creates PRs to sync them.
Summary
This PR adds a new automated workflow
bot-bump-kernel-version-to-sglangthat syncs the sgl-kernel version fromsgl-kernel/pyproject.tomlto SGLang files.Changes
.github/workflows/bot-bump-kernel-version-to-sglang.ymlcheck_kernel_version_to_sglang.py- Checks version consistencybump_kernel_version_to_sglang.py- Updates version in SGLang filescommit_and_pr_kernel_to_sglang.sh- Creates PR with changesWorkflow Behavior
The workflow:
sgl-kernel/pyproject.toml(line 11)python/pyproject.toml(dependency)python/sglang/srt/entrypoints/engine.py(version check)docker/Dockerfile(build arg)Triggers
Test Plan