Skip to content

[CI] proto: Publish protobuf module to Buf Schema Registry - #48216

Open
ahg-g wants to merge 3 commits into
sgl-project:mainfrom
ahg-g:feat/buf-bsr-proto
Open

ahg-g wants to merge 3 commits into
sgl-project:mainfrom
ahg-g:feat/buf-bsr-proto

Conversation

@ahg-g

@ahg-g ahg-g commented Nov 3, 2026 •

Copy link
Copy Markdown

Motivation

Downstream consumers written in Go, Python, and other languages (such as llm-d/llm-d-router for sglang.api.v1.SglangService) currently have to copy .proto files out of sgl-project/sglang and maintain local protoc pipelines to generate client/message bindings.

Publishing proto/ as buf.build/sgl-project/sglang on the Buf Schema Registry (BSR) lets downstream projects import versioned generated SDKs directly (for example go get buf.build/gen/go/sgl-project/sglang/protocolbuffers/go and buf.build/gen/go/sgl-project/sglang/grpc/go via BSR Managed Mode) without adding language-specific options like option go_package to the .proto sources, while enforcing buf build, buf lint, and buf breaking checks on .proto changes in CI.

Modifications

  • Add proto/buf.yaml (Buf v2) declaring module buf.build/sgl-project/sglang with STANDARD lint rules (excluding the four naming rules that conflict with existing sglang.api.v1, sglang.json.v1, and sglang.runtime.v1 wire contracts) and FILE breaking-change detection.
  • Add proto/README.md, rendered by the BSR as the module documentation: generated SDK usage, version labels, a warning that the SDKs target the gRPC wire format (the HTTP JSON form follows the sglang.json.v1 options, not canonical proto3 JSON), and the schema change process.
  • Add .github/workflows/buf.yml (Buf CLI pinned to 1.75.0):
    • On pull requests touching proto/**: buf build, buf lint, and buf breaking against the PR's base commit. A maintainer can approve an intentional breaking change with the buf skip breaking label, which re-triggers the check.
    • On main pushes, v* release tag pushes, published GitHub releases, and manual dispatch on main: publish proto/ to the BSR, labeled with the commit SHA and the branch or tag name.
    • Before publishing from main, re-run buf breaking against the previous main commit unless the merged PR carries buf skip breaking. The PR check is not a required status check, so this keeps an unapproved breaking change out of the registry.
    • Publishing is opt-in via vars.BSR_PUBLISH_ENABLED, so this can merge before the registry is set up. Once enabled, a missing BUF_TOKEN fails the job instead of silently skipping.

Maintainer setup (after merge)

  1. Create the sgl-project organization on buf.build (buf push --create creates the module, not the organization).
  2. Create a BSR token for a bot or service account in that organization and add it as the BUF_TOKEN repository secret.
  3. Set the BSR_PUBLISH_ENABLED repository variable to true.
  4. Run the "Buf Protobuf" workflow manually on main once for the first publish.
  5. Create the buf skip breaking label.

Accuracy Tests

N/A (protobuf build/CI configuration only; no runtime or model changes).

Speed Tests and Profiling

N/A (protobuf build/CI configuration only).

Checklist


CI States

Latest PR Test (Base): ❌ Run #41719279563
Latest PR Test (Extra): ❌ Run #41719279499
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

Add proto/buf.yaml declaring buf.build/sgl-project/sglang and a GitHub Actions workflow that runs buf build, buf lint, and buf breaking on proto changes and publishes the module to the Buf Schema Registry on main pushes and releases when secrets.BUF_TOKEN is configured.

Signed-off-by: ahg-g <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

ahg-g added 2 commits November 3, 2026 19:59
Re-run the breaking check against the previous main commit before publishing, unless the merged PR carries the 'buf skip breaking' label, since the PR check is not a required status check. Gate publishing on vars.BSR_PUBLISH_ENABLED so a missing BUF_TOKEN fails once publishing is enabled instead of silently skipping. Add proto/README.md, which the BSR renders as the module documentation.

Signed-off-by: ahg-g <[email protected]>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 3, 2026

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant