From 1f5d21107020ad2daf946a2a39716f76bbc6ad21 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:31:40 -0800 Subject: [PATCH 01/24] ci: resolve the sglang ref and the CI image from release-lock.json A release branch carries release-lock.json naming the sglang commit and the CI image tag the release was frozen with. Both resolve steps in _run-ci.yml and resolve-ci-image in pr-test.yml now read it when no explicit input or PR-body directive names a value, before falling back to the moving defaults. The dispatch defaults of ci_sglang_pr / ci_sglang_repo / ci_image_tag become empty so the lockfile can apply on a release branch; on main the same defaults are re-applied after the lock check. --- .github/workflows/_run-ci.yml | 18 ++++++++++++++++++ .github/workflows/pr-test.yml | 29 +++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_run-ci.yml b/.github/workflows/_run-ci.yml index 5769afa1b..4e66ea792 100644 --- a/.github/workflows/_run-ci.yml +++ b/.github/workflows/_run-ci.yml @@ -142,6 +142,15 @@ jobs: PR_SGLANG_REPO=$(echo "$PR_BODY" | grep -m1 -oP '^ci-sglang-repo:\s+\K\S+' || true) [ -z "$SGLANG_REPO" ] && [ -n "$PR_SGLANG_REPO" ] && SGLANG_REPO="$PR_SGLANG_REPO" fi + # A release branch carries release-lock.json (written by + # release-branch-cut.yml) naming the sglang commit the release was + # frozen with. Explicit overrides above still win; the moving branch + # head is only the last resort. Repo and commit apply as a pair. + if [ -z "$SGLANG_PR" ] && [ -f release-lock.json ]; then + SGLANG_PR=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_commit'])") + SGLANG_REPO=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_repo'])") + echo "release-lock.json present: sglang=${SGLANG_REPO}@${SGLANG_PR}" + fi [ -z "$SGLANG_PR" ] && SGLANG_PR="$DEFAULT_SGLANG_REF" [ -z "$SGLANG_REPO" ] && SGLANG_REPO="$DEFAULT_SGLANG_REPO" resolve_fetch_ref() { @@ -251,6 +260,15 @@ jobs: PR_SGLANG_REPO=$(echo "$PR_BODY" | grep -m1 -oP '^ci-sglang-repo:\s+\K\S+' || true) [ -z "$SGLANG_REPO" ] && [ -n "$PR_SGLANG_REPO" ] && SGLANG_REPO="$PR_SGLANG_REPO" fi + # A release branch carries release-lock.json (written by + # release-branch-cut.yml) naming the sglang commit the release was + # frozen with. Explicit overrides above still win; the moving branch + # head is only the last resort. Repo and commit apply as a pair. + if [ -z "$SGLANG_PR" ] && [ -f release-lock.json ]; then + SGLANG_PR=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_commit'])") + SGLANG_REPO=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_repo'])") + echo "release-lock.json present: sglang=${SGLANG_REPO}@${SGLANG_PR}" + fi [ -z "$SGLANG_PR" ] && SGLANG_PR="$DEFAULT_SGLANG_REF" [ -z "$SGLANG_REPO" ] && SGLANG_REPO="$DEFAULT_SGLANG_REPO" resolve_fetch_ref() { diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index ef84f3128..67c9236be 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -27,21 +27,23 @@ on: - cron: '30 16 * * *' workflow_dispatch: inputs: + # Empty defaults: on a release branch the values come from its + # release-lock.json; anywhere else the old defaults still apply. ci_sglang_pr: - description: 'SGLang branch/commit (default: sglang-miles)' + description: 'SGLang branch/commit (empty: release-lock.json if present, else sglang-miles)' required: false type: string - default: 'sglang-miles' + default: '' ci_sglang_repo: - description: 'SGLang repository owner/name (default: sgl-project/sglang)' + description: 'SGLang repository owner/name (empty: release-lock.json if present, else sgl-project/sglang)' required: false type: string - default: 'sgl-project/sglang' + default: '' ci_image_tag: - description: 'miles-diffusion Docker image tag (default: latest)' + description: 'miles-diffusion Docker image tag (empty: release-lock.json if present, else latest)' required: false type: string - default: 'latest' + default: '' continue_on_error: description: 'Keep running a suite after a test fails, as nightly does' required: false @@ -237,6 +239,15 @@ jobs: outputs: container_image: ${{ steps.resolve.outputs.container_image }} steps: + # Only the lockfile is needed: a release branch pins its CI image there. + - name: Checkout release lockfile + uses: actions/checkout@v4 + with: + ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} + sparse-checkout: release-lock.json + sparse-checkout-cone-mode: false + persist-credentials: false + - name: Resolve CI image id: resolve shell: bash @@ -253,6 +264,12 @@ jobs: PR_CI_IMAGE_TAG=$(echo "$PR_BODY" | grep -m1 -oP '^ci-image-tag:\s+\K\S+' || true) [ -z "$CI_IMAGE_TAG" ] && [ -n "$PR_CI_IMAGE_TAG" ] && CI_IMAGE_TAG="$PR_CI_IMAGE_TAG" fi + # Release branches freeze their CI image in release-lock.json; `latest` + # moves on every main push touching docker files and is the last resort. + if [ -z "$CI_IMAGE_TAG" ] && [ -f release-lock.json ]; then + CI_IMAGE_TAG=$(python3 -c "import json; print(json.load(open('release-lock.json'))['ci_image_tag'])") + echo "release-lock.json present: image tag ${CI_IMAGE_TAG}" + fi [ -z "$CI_IMAGE_TAG" ] && CI_IMAGE_TAG="latest" if [[ ! "$CI_IMAGE_TAG" =~ ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$ ]]; then echo "::error::ci-image-tag must be a Docker tag, not a full image name: $CI_IMAGE_TAG" From 41b60b510707cacbd157af136834d1e9e4662232 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:32:24 -0800 Subject: [PATCH 02/24] ci: let release-branch-cut call pr-test.yml on an exact commit pr-test.yml gains a workflow_call trigger (ref, image_tag, nightly, continue_on_error) and _run-ci.yml a ref input, so release CI tests the commit the release-ci status is stamped on, inside the frozen release image, instead of github.sha (the main tip the cut was dispatched on). The caller is always a workflow_dispatch, which the called run inherits, so every job keeps its trusted full-scope path. --- .github/workflows/_run-ci.yml | 15 ++++++++--- .github/workflows/pr-test.yml | 49 +++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/.github/workflows/_run-ci.yml b/.github/workflows/_run-ci.yml index 4e66ea792..ac3d4ecaa 100644 --- a/.github/workflows/_run-ci.yml +++ b/.github/workflows/_run-ci.yml @@ -42,6 +42,11 @@ on: required: false default: false description: 'Upload tests/ci/fixtures/e2e_standards/ as a build artifact for the author to review and commit (record-e2e-standards.yml)' + ref: + type: string + required: false + default: '' + description: 'Exact commit to test (release CI). Empty: the PR merge ref, else github.sha.' env: # Unless you know the consequences, change this together with docker/Dockerfile's @@ -80,7 +85,7 @@ jobs: working-directory: ${{ github.workspace }} env: PYTHONPATH: ${{ github.workspace }} - GITHUB_COMMIT_NAME: ${{ github.sha }}_${{ github.event.pull_request.number || 'non-pr' }} + GITHUB_COMMIT_NAME: ${{ inputs.ref || github.sha }}_${{ github.event.pull_request.number || 'non-pr' }} WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }} # Gated models (e.g. stabilityai/stable-diffusion-3.5-medium for the SD3 # e2e) need an HF token with repo access; unset for public-model tests. @@ -90,7 +95,9 @@ jobs: uses: actions/checkout@v4 with: # Review-triggered callers otherwise check out the default branch. - ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} + # Release CI passes the exact commit; github.sha would be the main tip + # the cut workflow was dispatched on. + ref: ${{ inputs.ref || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha) }} - name: Cleanup Ray processes shell: bash @@ -226,7 +233,9 @@ jobs: - name: Checkout miles-diffusion uses: actions/checkout@v4 with: - ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} + # Release CI passes the exact commit; github.sha would be the main tip + # the cut workflow was dispatched on. + ref: ${{ inputs.ref || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha) }} - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 67c9236be..ba7a17235 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -16,6 +16,11 @@ name: PR Test # miles main's cron (catches drift in floating deps: sglang main tip, # image `latest`, HF snapshots), and `--continue-on-error` so one failing # test does not hide the rest of its suite. +# * `workflow_call` from release-branch-cut.yml: tests an exact commit inside +# a frozen image. The caller is always a workflow_dispatch, and the called +# run inherits that event name, so every job below takes the trusted, +# full-scope manual-dispatch path; `inputs.ref` / `inputs.image_tag` only +# redirect what is checked out and which image the suites run in. on: pull_request: @@ -49,6 +54,26 @@ on: required: false type: boolean default: false + workflow_call: + inputs: + ref: + description: 'Exact commit to test (e.g. the release branch tip the lockfile was committed on).' + required: true + type: string + image_tag: + description: 'miles-diffusion Docker image tag to run the GPU suites in (the frozen release-vX.Y.Z-ci tag).' + required: true + type: string + nightly: + description: 'Also admit nightly-only tests: release CI takes the nightly scope.' + required: false + type: boolean + default: true + continue_on_error: + description: 'Keep running a GPU suite after a test fails (the CPU suites run pytest -x regardless).' + required: false + type: boolean + default: true permissions: contents: read @@ -243,7 +268,7 @@ jobs: - name: Checkout release lockfile uses: actions/checkout@v4 with: - ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }} + ref: ${{ inputs.ref || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha) }} sparse-checkout: release-lock.json sparse-checkout-cone-mode: false persist-credentials: false @@ -253,7 +278,9 @@ jobs: shell: bash env: PR_BODY: ${{ github.event.pull_request.body || '' }} - INPUT_CI_IMAGE_TAG: ${{ github.event.inputs.ci_image_tag || '' }} + # In a workflow_call chain github.event.inputs are the caller's, so the + # frozen release tag arrives as inputs.image_tag. + INPUT_CI_IMAGE_TAG: ${{ inputs.image_tag || github.event.inputs.ci_image_tag || '' }} DOCKER_BUILT: ${{ needs.docker-build.result == 'success' }} PR_NUMBER: ${{ github.event.pull_request.number || '' }} run: | @@ -285,12 +312,13 @@ jobs: if: needs.ci-gate.outputs.authorized == 'true' uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} cpu_runner: true execute_command: >- python tests/ci/run_suite.py --hw cpu --suite stage-a-cpu --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || needs.ci-gate.outputs.docs_only == 'true' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit @@ -302,12 +330,13 @@ jobs: if: needs.ci-gate.outputs.authorized == 'true' && needs.stage-a-cpu.result == 'success' uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} cpu_runner: true execute_command: >- python tests/ci/run_suite.py --hw cpu --suite stage-b-cpu --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || needs.ci-gate.outputs.docs_only == 'true' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit @@ -326,6 +355,7 @@ jobs: ((github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') || (github.event.pull_request)) uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} # Suite names match the runner split: 3gpu (GPUs 0-2) + 5gpu (GPUs 3-7). runs_on: '["h200", "3gpu"]' container_image: ${{ needs.resolve-ci-image.outputs.container_image }} @@ -333,7 +363,7 @@ jobs: python tests/ci/run_suite.py --hw cuda --suite stage-b-3-gpu-h200 --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit @@ -349,13 +379,14 @@ jobs: ((github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') || (github.event.pull_request)) uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} runs_on: '["h200", "5gpu"]' container_image: ${{ needs.resolve-ci-image.outputs.container_image }} execute_command: >- python tests/ci/run_suite.py --hw cuda --suite stage-b-5-gpu-h200 --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit @@ -383,13 +414,14 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'skip-ci-stage-c'))) uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} runs_on: '["h200", "3gpu"]' container_image: ${{ needs.resolve-ci-image.outputs.container_image }} execute_command: >- python tests/ci/run_suite.py --hw cuda --suite stage-c-3-gpu-h200 --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit @@ -405,12 +437,13 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'skip-ci-stage-c'))) uses: ./.github/workflows/_run-ci.yml with: + ref: ${{ inputs.ref || '' }} runs_on: '["h200", "5gpu"]' container_image: ${{ needs.resolve-ci-image.outputs.container_image }} execute_command: >- python tests/ci/run_suite.py --hw cuda --suite stage-c-5-gpu-h200 --labels ${{ join(github.event.pull_request.labels.*.name, ' ') }} ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-ci-image') || contains(github.event.pull_request.labels.*.name, 'run-ci-all')) && '--match-all-labels' || '' }} - ${{ github.event_name == 'schedule' && '--nightly' || '' }} + ${{ (github.event_name == 'schedule' || inputs.nightly) && '--nightly' || '' }} ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} secrets: inherit From 8b852cccbedfdd0912b9736591ec893d88c5c2c1 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:35:49 -0800 Subject: [PATCH 03/24] ci(release): add the version bump, image pick and lockfile scripts bump_version.py rewrites the single version= assignment in setup.py (ported from miles). pick_ci_image.py chooses the newest dev-cu129-sglang-main- tag and proves it was pushed by the newest successful docker-build.yml run on main, so the cut can diff that run's image layers against the cut point. write_release_lock.py writes release-lock.json with miles_diffusion's inputs: the sglang commit, the frozen CI image tag and digest, the base image tag and digest, and the FA3 wheels fingerprint as an audit record. --- .github/scripts/release/bump_version.py | 34 ++++++++++ .github/scripts/release/pick_ci_image.py | 65 +++++++++++++++++++ .github/scripts/release/write_release_lock.py | 58 +++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 .github/scripts/release/bump_version.py create mode 100644 .github/scripts/release/pick_ci_image.py create mode 100644 .github/scripts/release/write_release_lock.py diff --git a/.github/scripts/release/bump_version.py b/.github/scripts/release/bump_version.py new file mode 100644 index 000000000..0954c526d --- /dev/null +++ b/.github/scripts/release/bump_version.py @@ -0,0 +1,34 @@ +"""Bump the miles_diffusion version in setup.py. + +Usage: python .github/scripts/release/bump_version.py 0.3.0 + +Ported from radixark/miles (.github/scripts/release/bump_miles_version.py). +""" + +import re +import sys +from pathlib import Path + +VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:(?:rc|\.post)\d+)?$") + + +def main() -> int: + if len(sys.argv) != 2: + print(__doc__.strip(), file=sys.stderr) + return 1 + new_version = sys.argv[1] + if not VERSION_RE.fullmatch(new_version): + print(f"Invalid version {new_version!r}; expected X.Y.Z, X.Y.ZrcN, or X.Y.Z.postN", file=sys.stderr) + return 1 + + setup_py = Path(__file__).resolve().parents[3] / "setup.py" + content = setup_py.read_text() + new_content, n = re.subn(r'version="[^"]+"', f'version="{new_version}"', content) + assert n == 1, f"expected exactly one version= assignment in setup.py, found {n}" + setup_py.write_text(new_content) + print(f"setup.py: version -> {new_version}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/scripts/release/pick_ci_image.py b/.github/scripts/release/pick_ci_image.py new file mode 100644 index 000000000..5dcf485d5 --- /dev/null +++ b/.github/scripts/release/pick_ci_image.py @@ -0,0 +1,65 @@ +"""Pick the dated CI image a release branch cut freezes, and prove it matches a build. + +Usage: pick_ci_image.py + + is the newest successful docker-build.yml run: + gh run list --workflow docker-build.yml --status success --limit 1 \ + --json headSha,headBranch,createdAt,updatedAt + is the Docker Hub tag listing of radixark/miles_diffusion. + +Prints `key=value` lines for the workflow: dev_image_tag, dev_image_digest, +image_build_sha. Fails when the newest dated tag was not pushed by that run +(it must be a main build, and the tag's push time must fall inside the run), +because the cut then cannot say which Dockerfile the frozen image represents. +""" + +import json +import re +import sys +from datetime import datetime + +DATED_TAG_RE = re.compile(r"dev-cu129-sglang-main-\d{8}") + + +def parse_time(value: str) -> datetime: + # Docker Hub carries fractional seconds, gh does not; fromisoformat takes both. + return datetime.fromisoformat(value.replace("Z", "+00:00")) + + +def main() -> int: + run_path, tags_path = sys.argv[1:] + runs = json.load(open(run_path)) + tags = json.load(open(tags_path))["results"] + + dated = sorted((t for t in tags if DATED_TAG_RE.fullmatch(t["name"])), key=lambda t: t["name"]) + if not dated: + print( + "no dev-cu129-sglang-main- tag on Docker Hub; dispatch docker-build.yml first", file=sys.stderr + ) + return 1 + newest = dated[-1] + + if not runs: + print("no successful docker-build.yml run found", file=sys.stderr) + return 1 + run = runs[0] + if run["headBranch"] != "main": + print(f"newest successful docker-build.yml run is on {run['headBranch']!r}, not main", file=sys.stderr) + return 1 + pushed = parse_time(newest["last_updated"]) + if not parse_time(run["createdAt"]) <= pushed <= parse_time(run["updatedAt"]): + print( + f"{newest['name']} (pushed {newest['last_updated']}) was not pushed by the newest successful " + f"docker-build.yml run ({run['createdAt']} .. {run['updatedAt']}); rebuild the image on main first", + file=sys.stderr, + ) + return 1 + + print(f"dev_image_tag={newest['name']}") + print(f"dev_image_digest={newest['digest']}") + print(f"image_build_sha={run['headSha']}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/scripts/release/write_release_lock.py b/.github/scripts/release/write_release_lock.py new file mode 100644 index 000000000..fe5ef9bd7 --- /dev/null +++ b/.github/scripts/release/write_release_lock.py @@ -0,0 +1,58 @@ +"""Write release-lock.json for a release branch cut. + +Ported from radixark/miles (.github/scripts/release/write_release_lock.py) with +miles_diffusion's inputs: no Megatron-LM, one CUDA 12.9 x86_64 image, and the +base image pinned by digest because `docker build --pull` re-resolves its tag. +""" + +import argparse +import json + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--release-branch", required=True) + parser.add_argument("--sglang-commit", required=True) + parser.add_argument("--ci-image-tag", required=True) + parser.add_argument("--ci-image-digest", required=True) + parser.add_argument("--sglang-image-tag", required=True) + parser.add_argument("--sglang-image-digest", required=True) + parser.add_argument("--fa3-wheels-repo", required=True) + parser.add_argument("--fa3-wheels-tag", required=True) + parser.add_argument("--fa3-wheels-fingerprint", required=True) + args = parser.parse_args() + + assert len(args.sglang_commit) == 40, "failed to resolve the sglang commit" + for name in ("ci_image_digest", "sglang_image_digest"): + assert getattr(args, name).startswith("sha256:"), f"failed to resolve {name}" + assert args.fa3_wheels_fingerprint, "failed to fingerprint the FA3 wheels release" + + json.dump( + { + "release_branch": args.release_branch, + # Restored inputs: CI re-installs sglang at this commit and + # release-docker.yml bakes it. + "sglang_repo": "sgl-project/sglang", + "sglang_branch": "sglang-miles", + "sglang_commit": args.sglang_commit, + # Restored input for release CI; the digest records what the tag + # pointed at when it was frozen. + "ci_image_tag": args.ci_image_tag, + "ci_image_digest": args.ci_image_digest, + # Restored input for release-docker.yml: FROM @. + "sglang_image_tag": args.sglang_image_tag, + "sglang_image_digest": args.sglang_image_digest, + # Audit only: a rolling wheels release can have assets replaced in + # place, so it cannot be pinned by name. + "fa3_wheels_repo": args.fa3_wheels_repo, + "fa3_wheels_tag": args.fa3_wheels_tag, + "fa3_wheels_fingerprint": args.fa3_wheels_fingerprint, + }, + open("release-lock.json", "w"), + indent=2, + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From e51d60bc00f74afca989ef306aa945175b3976d9 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:35:49 -0800 Subject: [PATCH 04/24] ci(release): add release-branch-cut workflow Creates release/vX.Y.Z from main, proves the newest dated CI image matches the cut point's Dockerfile and requirements.txt, retags it by digest as release-vX.Y.Z-ci, commits release-lock.json, runs pr-test.yml on the lock commit inside that image, and stamps a release-ci commit status on the tested SHA. Re-dispatching an existing branch keeps its lock and image and re-runs CI on the tip; a re-dispatch cancels the stale run. --- .github/workflows/release-branch-cut.yml | 233 +++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 .github/workflows/release-branch-cut.yml diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml new file mode 100644 index 000000000..b2bcacabe --- /dev/null +++ b/.github/workflows/release-branch-cut.yml @@ -0,0 +1,233 @@ +name: Release Branch Cut + +# Ported from radixark/miles (.github/workflows/release-branch-cut.yml); +# runbook: docs/developer/release.md. +# +# The branch name in run-name identifies the operator run; release-tag.yml +# gates on the per-SHA release-ci commit status, not on this title. +run-name: Release Branch Cut ${{ inputs.branch_name }} +# +# Creates a release/vX.Y.Z branch from main, freezes the release inputs into +# release-lock.json on that branch, then runs the full-scope CI suites against +# the lock commit. Re-dispatching on an existing branch skips creation and +# just re-runs the tests (e.g. after a cherry-pick). +# +# Differences vs miles: +# * No Megatron-LM; the only source dependency is sglang's sglang-miles branch. +# * One CUDA 12.9 x86_64 image. The newest dev-cu129-sglang-main- +# tag is frozen as release-vX.Y.Z-ci, after proving it was pushed by a +# successful main build whose Dockerfile and requirements.txt equal the +# cut point's (the dated tag is overwritten within its day, and a push +# build can be cancelled, so `latest` says nothing about the cut point). +# * The called suites check out the tested SHA, not the branch name. + +on: + workflow_dispatch: + inputs: + branch_name: + description: 'Branch name to create (e.g., release/v0.3.0)' + required: true + type: string + commit_sha: + description: 'Commit SHA from main to cut from (defaults to latest main)' + required: false + type: string + default: '' + +permissions: + contents: write + # The image preflight lists docker-build.yml runs. + actions: read + # report-ci-status stamps the release-ci commit status release-tag.yml checks. + statuses: write + +concurrency: + # A re-dispatch on the same branch (after a cherry-pick) supersedes the + # stale full-scope run, nested suite jobs included, instead of leaving it on + # the H200 runners for hours. + group: release-cut-${{ inputs.branch_name }} + cancel-in-progress: true + +jobs: + cut-release-branch: + if: github.repository == 'radixark/miles_diffusion' + runs-on: ubuntu-latest + outputs: + ci_image_tag: ${{ steps.freeze.outputs.ci_image_tag }} + tested_sha: ${{ steps.freeze.outputs.tested_sha }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + + - name: Validate inputs + id: validate + run: | + BRANCH_NAME="${{ github.event.inputs.branch_name }}" + if [[ ! "$BRANCH_NAME" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Branch name must match 'release/vX.Y.Z', got '$BRANCH_NAME'" + exit 1 + fi + COMMIT_SHA="${{ github.event.inputs.commit_sha }}" + [ -z "$COMMIT_SHA" ] && COMMIT_SHA=$(git rev-parse HEAD) + if ! git merge-base --is-ancestor "$COMMIT_SHA" main; then + echo "::error::Commit '$COMMIT_SHA' is not on main" + exit 1 + fi + echo "commit_sha=$COMMIT_SHA" >> "$GITHUB_OUTPUT" + + - name: Check if branch already exists + id: check_exists + run: | + BRANCH_NAME="${{ github.event.inputs.branch_name }}" + if git ls-remote --exit-code --heads origin "$BRANCH_NAME" > /dev/null 2>&1; then + echo "Branch '$BRANCH_NAME' exists; skipping creation, re-running tests" + echo "branch_exists=true" >> "$GITHUB_OUTPUT" + else + echo "branch_exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Preflight the CI image + if: steps.check_exists.outputs.branch_exists != 'true' + id: preflight + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMMIT_SHA: ${{ steps.validate.outputs.commit_sha }} + run: | + gh run list --workflow docker-build.yml --status success --limit 1 \ + --json headSha,headBranch,createdAt,updatedAt > "$RUNNER_TEMP/docker-build-run.json" + curl -fsS "https://hub.docker.com/v2/repositories/radixark/miles_diffusion/tags/?page_size=100&name=dev-cu129-sglang-main-" \ + > "$RUNNER_TEMP/tags.json" + python3 .github/scripts/release/pick_ci_image.py \ + "$RUNNER_TEMP/docker-build-run.json" "$RUNNER_TEMP/tags.json" > "$RUNNER_TEMP/picked.env" + cat "$RUNNER_TEMP/picked.env" + source "$RUNNER_TEMP/picked.env" + # The frozen image must represent the cut point's image layers; a + # Dockerfile or requirements change in between needs a fresh build. + if ! git diff --quiet "$image_build_sha" "$COMMIT_SHA" -- docker/Dockerfile requirements.txt; then + echo "::error::docker/Dockerfile or requirements.txt differ between the image build ($image_build_sha) and the cut point ($COMMIT_SHA); dispatch docker-build.yml on main and re-run" + git diff --stat "$image_build_sha" "$COMMIT_SHA" -- docker/Dockerfile requirements.txt + exit 1 + fi + cat "$RUNNER_TEMP/picked.env" >> "$GITHUB_OUTPUT" + + - name: Login to Docker Hub + if: steps.check_exists.outputs.branch_exists != 'true' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Create branch and freeze release-lock.json + id: freeze + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DEV_IMAGE_TAG: ${{ steps.preflight.outputs.dev_image_tag }} + DEV_IMAGE_DIGEST: ${{ steps.preflight.outputs.dev_image_digest }} + run: | + BRANCH_NAME="${{ github.event.inputs.branch_name }}" + if [ "${{ steps.check_exists.outputs.branch_exists }}" = "true" ]; then + # Existing branch: reuse its committed lockfile for the CI image tag. + git fetch origin "$BRANCH_NAME" + git checkout "$BRANCH_NAME" + echo "ci_image_tag=$(python3 -c "import json; print(json.load(open('release-lock.json'))['ci_image_tag'])")" >> "$GITHUB_OUTPUT" + echo "tested_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + exit 0 + fi + + git config user.name "miles-bot" + git config user.email "miles-bot@users.noreply.github.com" + git checkout -b "$BRANCH_NAME" "${{ steps.validate.outputs.commit_sha }}" + + SGLANG_SHA=$(git ls-remote https://github.com/sgl-project/sglang refs/heads/sglang-miles | cut -f1) + + # Retag by digest, not by name: the dated tag can be overwritten + # within its day, and the release-scoped name never moves. + CI_IMAGE_TAG="release-${BRANCH_NAME#release/}-ci" + docker buildx imagetools create -t "radixark/miles_diffusion:${CI_IMAGE_TAG}" "radixark/miles_diffusion@${DEV_IMAGE_DIGEST}" + echo "Retagged radixark/miles_diffusion:${DEV_IMAGE_TAG} (${DEV_IMAGE_DIGEST}) -> radixark/miles_diffusion:${CI_IMAGE_TAG}" + + # `docker build --pull` re-resolves the base tag at every build, so + # release-docker.yml pins FROM @. + SGLANG_IMAGE_TAG=$(sed -n 's/^ARG SGLANG_IMAGE_TAG=//p' docker/Dockerfile) + SGLANG_IMAGE_DIGEST=$(docker buildx imagetools inspect "lmsysorg/sglang:${SGLANG_IMAGE_TAG}" --format '{{.Manifest.Digest}}') + + # Wheels release fingerprint (audit only: rolling tags can have assets + # replaced in place, so they cannot be pinned by name). Authenticated + # so a rate limit fails the cut instead of writing an empty record. + MILES_WHEELS_REPO=$(sed -n 's/^ARG MILES_WHEELS_REPO=//p' docker/Dockerfile) + FA3_WHEELS_TAG=$(sed -n 's/^ARG FA3_WHEELS_TAG=//p' docker/Dockerfile) + FA3_FP=$(curl -fsS -H "Authorization: Bearer ${GH_TOKEN}" \ + "https://api.github.com/repos/${MILES_WHEELS_REPO}/releases/tags/${FA3_WHEELS_TAG}" \ + | python3 -c "import sys,json,hashlib; a=json.load(sys.stdin).get('assets',[]); fp=sorted([x['name'],x['id'],x['size'],x['updated_at']] for x in a); print(hashlib.sha256(repr(fp).encode()).hexdigest() if a else '')") + + python3 .github/scripts/release/write_release_lock.py \ + --release-branch "$BRANCH_NAME" \ + --sglang-commit "$SGLANG_SHA" \ + --ci-image-tag "$CI_IMAGE_TAG" \ + --ci-image-digest "$DEV_IMAGE_DIGEST" \ + --sglang-image-tag "$SGLANG_IMAGE_TAG" \ + --sglang-image-digest "$SGLANG_IMAGE_DIGEST" \ + --fa3-wheels-repo "$MILES_WHEELS_REPO" \ + --fa3-wheels-tag "$FA3_WHEELS_TAG" \ + --fa3-wheels-fingerprint "$FA3_FP" + git add release-lock.json + git commit -m "chore(release): freeze dependency lockfile for $BRANCH_NAME" + git push origin "$BRANCH_NAME" + echo "ci_image_tag=$CI_IMAGE_TAG" >> "$GITHUB_OUTPUT" + echo "tested_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + echo "Froze: sglang=$SGLANG_SHA image=$CI_IMAGE_TAG base=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" + + - name: Summary + run: | + { + echo "## Release Branch Cut" + echo "- Branch: \`${{ github.event.inputs.branch_name }}\`" + echo "- Tested SHA: \`${{ steps.freeze.outputs.tested_sha }}\`" + echo "- CI image: \`radixark/miles_diffusion:${{ steps.freeze.outputs.ci_image_tag }}\`" + echo "- Once fully green, confirm the branch still points to the tested SHA, keep it frozen, then tag:" + echo " \`gh workflow run release-tag.yml -f version=X.Y.Z -f ref=${{ steps.freeze.outputs.tested_sha }}\`" + echo " (release-tag checks release-ci on this SHA but does not compare the remote branch tip)" + } >> "$GITHUB_STEP_SUMMARY" + + run-tests: + needs: cut-release-branch + # A called workflow may only narrow the caller job's permissions, and + # pr-test.yml declares exactly these. + permissions: + contents: read + pull-requests: read + uses: ./.github/workflows/pr-test.yml + with: + ref: ${{ needs.cut-release-branch.outputs.tested_sha }} + image_tag: ${{ needs.cut-release-branch.outputs.ci_image_tag }} + secrets: inherit + + # Finalizer: stamps the verdict onto the exact tested commit so + # release-tag.yml can gate on per-SHA evidence instead of run archaeology. + # always() so a red run stamps failure; !cancelled() so a run superseded by a + # re-dispatch stamps nothing; a re-dispatch on the same SHA overwrites the + # same context (newest status per context wins). + report-ci-status: + needs: [cut-release-branch, run-tests] + if: always() && !cancelled() && needs.cut-release-branch.result == 'success' + runs-on: ubuntu-latest + steps: + - name: Post release-ci commit status on the tested SHA + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SHA: ${{ needs.cut-release-branch.outputs.tested_sha }} + CI_RESULT: ${{ needs.run-tests.result }} + run: | + if [ "$CI_RESULT" = "success" ]; then + STATE=success + else + STATE=failure + fi + gh api "repos/${{ github.repository }}/statuses/$SHA" \ + -f state="$STATE" -f context=release-ci \ + -f description="full release CI (cpu/cuda=$CI_RESULT)" \ + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "Posted release-ci=$STATE on $SHA" From 4e5dfec2253c93b7aae389ccad7a73be2adb8de4 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:35:49 -0800 Subject: [PATCH 05/24] ci(release): add release-tag workflow Validates the version grammar (X.Y.Z, X.Y.ZrcN, X.Y.Z.postN), requires setup.py to carry the base version and release-ci=success on the exact commit, pushes the annotated v tag and dispatches release-docker.yml explicitly, since a GITHUB_TOKEN tag push does not trigger it. --- .github/workflows/release-tag.yml | 123 ++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/release-tag.yml diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 000000000..c82da07c1 --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,123 @@ +name: Release Tag + +# Ported from radixark/miles (.github/workflows/release-tag.yml); +# runbook: docs/developer/release.md. +# +# Creates an annotated v tag, then explicitly dispatches +# release-docker.yml. Use after release-branch-cut.yml is green. +# +# It refuses to tag blind: it requires a green `release-ci` commit status on +# the exact commit being tagged, the status release-branch-cut.yml's finalizer +# job stamps on the tested SHA. A cherry-pick moves the tip to an unstamped +# commit, so older green runs can never vouch for it. force=true is the +# deliberate, audited escape hatch. + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to tag, without v prefix (e.g., 0.3.0 or 0.3.0.post1)' + required: true + type: string + ref: + description: 'Branch or commit to tag (e.g., release/v0.3.0)' + required: true + type: string + force: + description: 'Tag without a verified green branch-cut run (not recommended)' + required: false + type: boolean + default: false + +permissions: + contents: write + actions: write + statuses: read + +jobs: + create-tag: + if: github.repository == 'radixark/miles_diffusion' + runs-on: ubuntu-latest + steps: + - name: Validate version format + env: + VERSION: ${{ github.event.inputs.version }} + run: | + if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+((rc|\.post)[0-9]+)?$'; then + echo "::error::Invalid version: $VERSION (expected X.Y.Z, X.Y.ZrcN, or X.Y.Z.postN)" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + fetch-depth: 0 + + - name: Verify version matches setup.py + env: + VERSION: ${{ github.event.inputs.version }} + run: | + # rc/postN tags share the branch with the base release and setup.py + # keeps the base version (hotfixes don't bump), so compare X.Y.Z only. + BASE_VERSION=$(echo "$VERSION" | sed -E 's/(rc[0-9]+|\.post[0-9]+)$//') + if ! grep -q "version=\"${BASE_VERSION}\"" setup.py; then + echo "::error::setup.py at '${{ github.event.inputs.ref }}' does not carry version=\"${BASE_VERSION}\" — merge the bump PR (release step 1) and get it onto this branch first" + grep -n 'version="' setup.py + exit 1 + fi + echo "setup.py version matches ${BASE_VERSION}" + + - name: Verify release CI on this exact commit + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REF: ${{ github.event.inputs.ref }} + FORCE: ${{ github.event.inputs.force }} + run: | + if [ "$FORCE" = "true" ]; then + echo "::warning::force=true — tagging without verified release CI" + exit 0 + fi + + SHA=$(git rev-parse HEAD) + # Latest status per context; stamped by release-branch-cut's finalizer. + STATE=$(gh api "repos/${{ github.repository }}/commits/$SHA/status" \ + --jq '[.statuses[] | select(.context == "release-ci")][0].state // "absent"') + case "$STATE" in + success) + echo "release-ci on $SHA is success — tagging" ;; + absent) + echo "::error::No release-ci status on $SHA — this exact commit never completed full release CI (first cut still running, or a cherry-pick moved the tip). Dispatch: gh workflow run release-branch-cut.yml -f branch_name=$REF and wait for green." + exit 1 ;; + *) + echo "::error::release-ci on $SHA is '$STATE' — get the branch-cut run green, then tag." + exit 1 ;; + esac + + - name: Create and push tag + env: + VERSION: ${{ github.event.inputs.version }} + REF: ${{ github.event.inputs.ref }} + run: | + TAG="v${VERSION}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "::error::Tag $TAG already exists" + exit 1 + fi + git config user.name "miles-bot" + git config user.email "miles-bot@users.noreply.github.com" + echo "Tagging $TAG at $(git rev-parse HEAD) (ref $REF)" + git tag -a "$TAG" -m "Release $TAG" + git push origin "$TAG" + + - name: Trigger release-docker build + # A tag pushed with GITHUB_TOKEN does not fire release-docker.yml's + # tag trigger (GitHub suppresses workflow-triggering events from + # GITHUB_TOKEN), so dispatch it explicitly. The tag trigger stays for + # manually pushed tags. + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ github.event.inputs.version }} + run: | + gh workflow run release-docker.yml -f version="$VERSION" -f ref="v$VERSION" + echo "::notice::Dispatched release-docker.yml for v$VERSION" From f8ef94aa75110d35fc699e3e70d064feef3dc987 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:35:49 -0800 Subject: [PATCH 06/24] ci(release): add release-docker workflow Builds radixark/miles_diffusion:v from the tagged commit with the lockfile's inputs: the sglang commit and the base image pinned by digest, plus the checked-out miles_diffusion SHA. Same build body as docker-build.yml (self-hosted, --no-cache --pull, chown before checkout, prune after), but it never moves latest. --- .github/workflows/release-docker.yml | 123 +++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/release-docker.yml diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml new file mode 100644 index 000000000..3547af929 --- /dev/null +++ b/.github/workflows/release-docker.yml @@ -0,0 +1,123 @@ +name: Release Docker Image + +# Ported from radixark/miles (.github/workflows/release-docker.yml) with +# docker-build.yml's build body; runbook: docs/developer/release.md. +# +# release-tag.yml dispatches this workflow explicitly after its GITHUB_TOKEN +# tag push; independently pushed matching tags and manual retries also run it. +# Builds and publishes radixark/miles_diffusion:v{version} (cu129, x86_64) +# from the tagged commit with release-lock.json's inputs: the sglang commit, +# and the base image pinned by digest. MILES_DIFFUSION_COMMIT is the +# checked-out SHA. The FA3 wheels release stays a rolling input whose lockfile +# fingerprint is an audit record, not a restored build input. `latest` never +# moves here. + +on: + push: + tags: + - "v[0-9]+.*" + workflow_dispatch: + inputs: + version: + description: 'Version to build, without v prefix (e.g., 0.3.0)' + required: true + type: string + ref: + description: 'Tag or branch to build from (defaults to v{version})' + required: false + type: string + default: '' + +# Publishing uses DOCKERHUB_* secrets, not GITHUB_TOKEN — checkout read is all it needs. +permissions: + contents: read + +jobs: + build-and-publish: + if: github.repository == 'radixark/miles_diffusion' + runs-on: self-hosted + timeout-minutes: 180 + steps: + - name: Resolve version and ref + id: resolve + shell: bash + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + REF="${{ github.event.inputs.ref }}" + [ -z "$REF" ] && REF="v${VERSION}" + else + VERSION="${GITHUB_REF_NAME#v}" + REF="${GITHUB_REF_NAME}" + fi + if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then + echo "::error::Invalid version: $VERSION" + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "ref=$REF" >> "$GITHUB_OUTPUT" + + # Container CI jobs leave root-owned files in the shared workspace; reclaim it before checkout cleans. + - name: Fix workspace ownership + run: docker run --rm -v "${{ github.workspace }}:/ws" alpine:3 chown -R "$(id -u):$(id -g)" /ws + + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ steps.resolve.outputs.ref }} + + - name: Read release lockfile + id: lock + shell: bash + run: | + if [ ! -f release-lock.json ]; then + echo "::error::release-lock.json not found at ${{ steps.resolve.outputs.ref }} — was this tag cut via release-branch-cut.yml?" + exit 1 + fi + for key in sglang_commit sglang_image_tag sglang_image_digest; do + echo "$key=$(python3 -c "import json; print(json.load(open('release-lock.json'))['$key'])")" >> "$GITHUB_OUTPUT" + done + # github.sha is the default-branch HEAD on workflow_dispatch; the + # image must bake the checked-out release commit. + echo "md_commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push v${{ steps.resolve.outputs.version }} + shell: bash + env: + IMAGE: radixark/miles_diffusion:v${{ steps.resolve.outputs.version }} + SGLANG_IMAGE_TAG: ${{ steps.lock.outputs.sglang_image_tag }} + SGLANG_IMAGE_DIGEST: ${{ steps.lock.outputs.sglang_image_digest }} + SGLANG_COMMIT: ${{ steps.lock.outputs.sglang_commit }} + MD_COMMIT: ${{ steps.lock.outputs.md_commit }} + run: | + # --no-cache --pull as in docker-build.yml: cached layers would pin + # stale sources; the base image is pinned by digest so --pull cannot + # move it. + docker build --no-cache --pull -f docker/Dockerfile . \ + --build-arg "SGLANG_IMAGE_TAG=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" \ + --build-arg "SGLANG_DIFFUSION_COMMIT=${SGLANG_COMMIT}" \ + --build-arg "MILES_DIFFUSION_COMMIT=${MD_COMMIT}" \ + -t "${IMAGE}" + docker push "${IMAGE}" + + # Each no-cache build leaves a full new layer set locally; keep the runner disk from filling up. + - name: Prune local build leftovers + if: always() + run: docker image prune -f + + - name: Summary + shell: bash + run: | + { + echo "## Released radixark/miles_diffusion v${{ steps.resolve.outputs.version }}" + echo "- \`radixark/miles_diffusion:v${{ steps.resolve.outputs.version }}\` (cu129, x86_64)" + echo "- base image: \`lmsysorg/sglang:${{ steps.lock.outputs.sglang_image_tag }}@${{ steps.lock.outputs.sglang_image_digest }}\`" + echo "- sglang: \`${{ steps.lock.outputs.sglang_commit }}\`" + echo "- miles_diffusion: \`${{ steps.lock.outputs.md_commit }}\`" + } >> "$GITHUB_STEP_SUMMARY" From 260d05510c3a0b7e1ca31de61c53d01168aa1128 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:35:49 -0800 Subject: [PATCH 07/24] ci(release): add bot-cherry-pick workflow Picks one merged main PR or commit onto a release branch. Rejects commits touching docker/Dockerfile or requirements.txt: the frozen CI image bakes both and the GPU suites do not reinstall requirements at run time, so such a fix ships as a new release instead. --- .github/workflows/bot-cherry-pick.yml | 108 ++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 .github/workflows/bot-cherry-pick.yml diff --git a/.github/workflows/bot-cherry-pick.yml b/.github/workflows/bot-cherry-pick.yml new file mode 100644 index 000000000..2b44fec58 --- /dev/null +++ b/.github/workflows/bot-cherry-pick.yml @@ -0,0 +1,108 @@ +name: Bot Cherry Pick to Release Branch + +# Ported from radixark/miles (.github/workflows/bot-cherry-pick.yml); +# runbook: docs/developer/release.md. +# +# Picks a merged main PR (or a raw commit) onto a release branch. Re-dispatch +# release-branch-cut.yml on the branch afterwards to re-run the full CI. + +on: + workflow_dispatch: + inputs: + pr_number: + description: 'Merged PR number to cherry-pick (preferred). Provide either pr_number OR commit_sha.' + required: false + type: string + commit_sha: + description: 'Commit SHA to cherry-pick (alternative to pr_number).' + required: false + type: string + target_branch: + description: 'Target release branch (e.g., release/v0.3.0)' + required: true + type: string + +permissions: + contents: write + +jobs: + cherry-pick: + if: github.repository == 'radixark/miles_diffusion' + runs-on: ubuntu-latest + steps: + - name: Validate inputs + env: + TARGET_BRANCH: ${{ github.event.inputs.target_branch }} + PR_NUMBER: ${{ github.event.inputs.pr_number }} + COMMIT_SHA: ${{ github.event.inputs.commit_sha }} + run: | + if [[ ! "$TARGET_BRANCH" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Target branch must match 'release/vX.Y.Z'" + exit 1 + fi + if [[ -z "$PR_NUMBER" && -z "$COMMIT_SHA" ]] || [[ -n "$PR_NUMBER" && -n "$COMMIT_SHA" ]]; then + echo "::error::Provide exactly one of pr_number or commit_sha" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cherry-pick and push + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_BRANCH: ${{ github.event.inputs.target_branch }} + PR_NUMBER: ${{ github.event.inputs.pr_number }} + COMMIT_SHA: ${{ github.event.inputs.commit_sha }} + run: | + git config user.name "miles-bot" + git config user.email "miles-bot@users.noreply.github.com" + + if [ -n "$PR_NUMBER" ]; then + COMMIT_SHA=$(gh pr view "$PR_NUMBER" --json mergeCommit,state -q '.mergeCommit.oid') + if [ -z "$COMMIT_SHA" ] || [ "$COMMIT_SHA" = "null" ]; then + echo "::error::PR #$PR_NUMBER has no merge commit (not merged?)" + exit 1 + fi + fi + + # Refuse to pick anything that is not on main: fixes land on main first + # (review + CI), then get picked. Covers both input paths — a PR merged + # into a non-main base also fails this check. + if ! git merge-base --is-ancestor "$COMMIT_SHA" origin/main; then + echo "::error::Commit $COMMIT_SHA is not on main; only merged main commits can be cherry-picked" + exit 1 + fi + + # The frozen release-v*-ci image is built from the Dockerfile and + # requirements.txt at cut time, and the GPU suites run the image's + # installed requirements (only the CPU job installs the file at run + # time): a pick that changes either would make CI test the old image + # while release-docker publishes an untested new one. Such fixes ship + # as a new release (bump + fresh cut), never as a hotfix. Same paths + # as pr-test.yml's docker-paths filter. + if git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" \ + | grep -qE '^(docker/Dockerfile|requirements\.txt)$'; then + echo "::error::Commit $COMMIT_SHA touches image-layer files; the frozen CI image cannot represent it. Ship this as a new release (bump + release-branch-cut) instead of a cherry-pick." + git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" | grep -E '^(docker/|requirements\.txt)' + exit 1 + fi + + if ! git ls-remote --exit-code --heads origin "$TARGET_BRANCH" > /dev/null 2>&1; then + echo "::error::Target branch '$TARGET_BRANCH' does not exist" + exit 1 + fi + git checkout -b work "origin/$TARGET_BRANCH" + + # -m 1 handles merge commits (squash merges are plain commits, unaffected). + if git rev-parse "$COMMIT_SHA^2" >/dev/null 2>&1; then + git cherry-pick -m 1 -x "$COMMIT_SHA" + else + git cherry-pick -x "$COMMIT_SHA" + fi + + git push origin "work:$TARGET_BRANCH" + echo "Cherry-picked $COMMIT_SHA onto $TARGET_BRANCH" + echo "Re-run CI: gh workflow run release-branch-cut.yml -f branch_name=$TARGET_BRANCH" >> "$GITHUB_STEP_SUMMARY" From 2f57043711e6f18e3b9d8f12feb5748fc27c9298 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:36:53 -0800 Subject: [PATCH 08/24] docs: add the release runbook and the docker release rule docs/developer/release.md is the maintainer procedure for the release workflows (bump, image preflight and cut, hotfix, tag, image, notes) and the table of what a version freezes. docker/README.md's release rule names the tag families a release publishes and never touches; installation.md mentions the versioned image tags. --- docker/README.md | 16 ++- docs/developer/release.md | 200 +++++++++++++++++++++++++++ docs/getting-started/installation.md | 4 +- 3 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 docs/developer/release.md diff --git a/docker/README.md b/docker/README.md index 2bd8c7804..28636803a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -22,4 +22,18 @@ build and stay on `latest`. ## Release rule -_TBD._ +Versioned images are published only by `release-docker.yml`, from an annotated `v` +tag that `release-tag.yml` created after release CI passed on that exact commit: + +- `radixark/miles_diffusion:v` (`v0.2.0`, `v0.2.0rc1`, `v0.2.0.post1`): built from the + tagged commit with `release-lock.json`'s inputs — the `sglang-miles` commit as + `SGLANG_DIFFUSION_COMMIT`, the base image as `SGLANG_IMAGE_TAG=@`, the tagged + commit as `MILES_DIFFUSION_COMMIT`. Never moves, never rebuilt in place; a shipped bug gets a + new `.postN` tag. +- `radixark/miles_diffusion:release-v-ci`: the dated dev image `release-branch-cut.yml` + froze (by digest) for that release branch's CI. Release CI always runs inside it. +- `latest` and `dev-cu129-sglang-main-` are rolling and are not touched by a release. + +A fix that changes `docker/Dockerfile` or `requirements.txt` cannot be hotfixed onto a release +branch (`bot-cherry-pick.yml` refuses it): it needs a new base version and a fresh cut. The +maintainer procedure is in [Release a Version](../docs/developer/release.md). diff --git a/docs/developer/release.md b/docs/developer/release.md new file mode 100644 index 000000000..63ac366e6 --- /dev/null +++ b/docs/developer/release.md @@ -0,0 +1,200 @@ +--- +title: Release a Version +description: Cut a versioned miles-diffusion release branch, run release CI inside a frozen image, tag an exact release, and publish the official Docker image. +--- +This runbook is for maintainers publishing an official miles-diffusion version from +`radixark/miles_diffusion`. It mirrors the miles procedure +([Release a Version](https://github.com/radixark/miles/blob/main/docs/developer/ci/04-release.md)) +with this repository's inputs: one source dependency (sglang's `sglang-miles` branch), one CUDA +12.9 x86_64 image, and the CI suites from [Contributing](contributor-guide.md). + +## What a version freezes + +| Fact | Authoritative source | Consumed as | +|---|---|---| +| Base version `X.Y.Z` | `setup.py` | release branch `release/vX.Y.Z`; checked before tagging | +| Exact version | `version` input of `release-tag.yml` | annotated git tag `v`, image tag `radixark/miles_diffusion:v` | +| sglang commit | `release-lock.json` → `sglang_commit` | CI re-installs sglang at it; `release-docker.yml` bakes it (`SGLANG_DIFFUSION_COMMIT`) | +| CI image | `release-lock.json` → `ci_image_tag` (+ `ci_image_digest`) | every GPU suite of release CI runs inside `release-vX.Y.Z-ci` | +| Base image | `release-lock.json` → `sglang_image_tag` + `sglang_image_digest` | `release-docker.yml` builds `FROM lmsysorg/sglang:@` | +| FA3 wheels release | `release-lock.json` → `fa3_wheels_*` | audit record only: the rolling release cannot be pinned by name | +| miles-diffusion code | the tagged commit | `MILES_DIFFUSION_COMMIT` of the release build | + +`release-lock.json` is written once, by the first dispatch of `release-branch-cut.yml`, and +committed on the release branch. Everything a release branch runs in CI reads it: the sglang ref +and the image tag resolve from it whenever no explicit input or PR-body directive names a value, +so a plain `pr-test.yml` dispatch on the branch is pinned too. + +The exact version may be `X.Y.Z`, `X.Y.ZrcN` or `X.Y.Z.postN`; the branch and `setup.py` always +carry the base version. `v0.2.0rc1`, `v0.2.0` and `v0.2.0.post1` all come from `release/v0.2.0` +and share its lockfile. + +What a release does **not** freeze: `apt` packages, pip's transitive resolution, the `kernels` +lockfile the Dockerfile generates at build time, the PaddleOCR model download, and the CPU half +of release CI (`ubuntu-latest`, runtime installs). Two builds of the same tag are the same +sources, not byte-identical images. + +## Before you start + +- Authenticate `gh` to `radixark/miles_diffusion` with permission to run workflows, push release + refs, and open pull requests. GitHub Actions in this repository cannot open pull requests, so + the bump PR is yours. +- Choose the base version and the exact version: + +```bash +BASE_VERSION=X.Y.Z +EXACT_VERSION=X.Y.Z # or X.Y.ZrcN / X.Y.Z.postN +RELEASE_BRANCH="release/v${BASE_VERSION}" +``` + +- Every release workflow is dispatched on `main`: the workflow files that run are `main`'s, the + code they test and build is the branch's or the tag's. A later change to the CI harness on + `main` therefore changes what a `.postN` re-dispatch runs. +- `release/*` branches take only `bot-cherry-pick.yml` pushes. Do not open pull requests + against a release branch; nothing protects `release/*` today, so that is a rule, not a guard. +- `force=true` on the tag workflow is an audited emergency bypass, never the normal path. + +## 1. Merge the base-version bump + +Skip this step if `setup.py` on `main` already carries `BASE_VERSION`. Otherwise: + +```bash +git checkout -b "chore/bump-version-${BASE_VERSION}" origin/main +python .github/scripts/release/bump_version.py "${BASE_VERSION}" +git commit -am "chore(release): bump version to ${BASE_VERSION}" +git push -u origin HEAD +gh pr create --base main --title "chore(release): bump version to ${BASE_VERSION}" \ + --body "Sets setup.py to the base version for the ${RELEASE_BRANCH} release." +``` + +Pass only `X.Y.Z` here; `rcN` / `.postN` belong to `EXACT_VERSION` at tag time. Normal PR CI +runs; merge it. Do not cut until `main` contains the base version. + +## 2. Preflight the image, cut the branch, run release CI + +The cut freezes the newest `radixark/miles_diffusion:dev-cu129-sglang-main-` image +and refuses unless that tag was pushed by the newest **successful** `docker-build.yml` run on +`main` whose `docker/Dockerfile` and `requirements.txt` equal the cut point's. Check before +dispatching: + +```bash +gh run list --workflow docker-build.yml --status success --limit 1 \ + --json headSha,headBranch,createdAt,updatedAt,url +git log --oneline -1 origin/main -- docker/Dockerfile requirements.txt +``` + +If the last image-layer commit is newer than that run's `headSha` (a push build was cancelled, +or a change merged since), build first and wait for success: + +```bash +gh workflow run docker-build.yml --ref main +``` + +Then cut from the `main` tip (or pass `-f commit_sha=FULL_MAIN_SHA` for an older commit with +the same image layers): + +```bash +gh workflow run release-branch-cut.yml -f branch_name="${RELEASE_BRANCH}" +``` + +The first dispatch creates `release/vX.Y.Z`, retags the preflighted image by digest as +`release-vX.Y.Z-ci`, records the sglang commit, the base-image digest and the FA3 fingerprint +in `release-lock.json`, commits the lockfile, and calls `pr-test.yml` on that commit with every +suite in full scope (`--match-all-labels --nightly --continue-on-error`) inside the frozen +image. A finalizer job stamps a `release-ci` commit status on the tested SHA. Re-dispatching on +an existing branch keeps the lockfile and the image and tests the current tip; it cancels a +still-running cut of the same branch. + +After the run is green, resolve the branch tip and keep it as `RELEASE_SHA`: + +```bash +git ls-remote https://github.com/radixark/miles_diffusion.git "refs/heads/${RELEASE_BRANCH}" +RELEASE_SHA=FULL_RELEASE_SHA +gh api "repos/radixark/miles_diffusion/commits/${RELEASE_SHA}/status" \ + --jq '[.statuses[] | select(.context == "release-ci")][0].state' +``` + +The last command must print `success`. The suites checked out this exact SHA (not the branch +name), so a push to the branch during the run does not change what the status vouches for; it +does mean the tip is no longer the tested commit. + +## 3. Apply a release hotfix, if needed + +Fixes land on `main` first. Cherry-pick exactly one merged PR or one commit reachable from +`main`: + +```bash +gh workflow run bot-cherry-pick.yml -f pr_number=PR_NUMBER -f target_branch="${RELEASE_BRANCH}" +# Or exactly one commit: +gh workflow run bot-cherry-pick.yml -f commit_sha=FULL_MAIN_SHA -f target_branch="${RELEASE_BRANCH}" +``` + +The workflow rejects commits that touch `docker/Dockerfile` or `requirements.txt`: release CI +keeps running inside the frozen image, and the GPU suites use the image's installed +requirements, so neither change can be represented without a rebuild. Such a fix needs a new +base version and a fresh cut. A fix that re-records an e2e standard carries the standard in the +same `main` commit, so the pick brings it along. + +After every successful cherry-pick, repeat step 2 on the branch and replace `RELEASE_SHA` with +the newly verified tip. An older green status never authorizes the new commit. + +## 4. Tag the verified SHA + +Re-read the remote tip immediately before dispatch and require it to equal the verified SHA: + +```bash +REMOTE_SHA=$(git ls-remote https://github.com/radixark/miles_diffusion.git "refs/heads/${RELEASE_BRANCH}" | cut -f1) +[ "${REMOTE_SHA}" = "${RELEASE_SHA}" ] || { echo "release branch moved; rerun release CI on the new tip" >&2; exit 1; } +gh workflow run release-tag.yml -f version="${EXACT_VERSION}" -f ref="${RELEASE_SHA}" +``` + +The workflow checks the version grammar, verifies that `setup.py` contains the base version, +requires `release-ci=success` on the checked-out SHA, creates the annotated tag +`v${EXACT_VERSION}`, and dispatches `release-docker.yml`. It does not compare the branch tip; +that is the operator check above. + +## 5. Verify the published image + +`release-docker.yml` checks out `v${EXACT_VERSION}`, reads its `release-lock.json`, and builds +`radixark/miles_diffusion:v${EXACT_VERSION}` on the self-hosted runner with +`SGLANG_IMAGE_TAG=@`, `SGLANG_DIFFUSION_COMMIT=` and +`MILES_DIFFUSION_COMMIT=`. It never moves `latest`. + +```bash +docker buildx imagetools inspect "radixark/miles_diffusion:v${EXACT_VERSION}" +docker run --rm "radixark/miles_diffusion:v${EXACT_VERSION}" \ + bash -c 'git -C /root/miles_diffusion rev-parse HEAD; git -C /sgl-workspace/sglang rev-parse HEAD' +``` + +Both SHAs must match the tag and the lockfile. To retry a failed build, keep the two inputs +paired to the same tag: + +```bash +gh workflow run release-docker.yml -f version="${EXACT_VERSION}" -f ref="v${EXACT_VERSION}" +``` + +Never alter a published tag; a shipped bug gets a new exact version (`.postN`) through steps +3–5. + +## 6. Publish the release notes + +There is no notes automation. Draft from the commit range, review, then publish: + +```bash +PREV_TAG=$(git describe --tags --abbrev=0 "v${EXACT_VERSION}^" 2>/dev/null || true) +git log --oneline "${PREV_TAG:+${PREV_TAG}..}v${EXACT_VERSION}" > /tmp/notes-input.txt +gh release create "v${EXACT_VERSION}" --draft --title "v${EXACT_VERSION}" --notes-file NOTES.md +``` + +For the first versioned release there is no previous tag; choose the baseline commit by hand. +Mark `rcN` tags as pre-releases (`--prerelease`). + +## Workflow map + +| Workflow | Trigger | Does | +|---|---|---| +| `release-branch-cut.yml` | dispatch on `main` | branch + image preflight + lockfile + retag + full CI + `release-ci` status | +| `bot-cherry-pick.yml` | dispatch on `main` | one `main` PR/commit onto `release/vX.Y.Z`, image-layer guard | +| `release-tag.yml` | dispatch on `main` | grammar + `setup.py` + `release-ci` gate → tag `v` → dispatch the image build | +| `release-docker.yml` | dispatched by the tag workflow, or a hand-pushed `v*` tag, or a retry | `radixark/miles_diffusion:v` from the tag and its lockfile | +| `pr-test.yml` (`workflow_call`) | called by the cut | the normal suites on an exact commit inside the frozen image | diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 71d4ed464..c918c4a81 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -18,7 +18,9 @@ docker pull radixark/miles_diffusion:latest `latest` carries the `sglang-miles` tip as of its last build, and is rebuilt when `docker/Dockerfile` or `requirements.txt` changes on main (or on a manual dispatch); dated tags -(`dev-cu129-sglang-main-YYYYMMDD`) pin a specific build. CUDA 12.9 is the only supported +(`dev-cu129-sglang-main-YYYYMMDD`) pin a specific build. Versioned tags (`v`, e.g. +`v0.2.0`) are built from a git tag of the same name with every dependency pinned in that tag's +`release-lock.json`, and never move. CUDA 12.9 is the only supported build — the Dockerfile carries a CUDA 13 recipe in a comment, but its `sglang-kernel` pin is hardcoded to cu129 and no CI covers it. From c0ce61d034341e849d57b934fd8029e50df831ec Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:41:31 -0800 Subject: [PATCH 09/24] ci(release): check the two lock digests with plain asserts The attribute names were fixed, so the getattr loop only hid which field each assert reads. --- .github/scripts/release/write_release_lock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/release/write_release_lock.py b/.github/scripts/release/write_release_lock.py index fe5ef9bd7..e1c8a6993 100644 --- a/.github/scripts/release/write_release_lock.py +++ b/.github/scripts/release/write_release_lock.py @@ -23,8 +23,8 @@ def main() -> int: args = parser.parse_args() assert len(args.sglang_commit) == 40, "failed to resolve the sglang commit" - for name in ("ci_image_digest", "sglang_image_digest"): - assert getattr(args, name).startswith("sha256:"), f"failed to resolve {name}" + assert args.ci_image_digest.startswith("sha256:"), "failed to resolve ci_image_digest" + assert args.sglang_image_digest.startswith("sha256:"), "failed to resolve sglang_image_digest" assert args.fa3_wheels_fingerprint, "failed to fingerprint the FA3 wheels release" json.dump( From a3b7f7d903f72f7b7cdf070ae8f44764cc5e8991 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:42:25 -0800 Subject: [PATCH 10/24] ci: name the workflow_call image input ci_image_tag as on dispatch pr-test.yml now reads the same input name on both triggers, as it already does for continue_on_error. --- .github/workflows/pr-test.yml | 8 ++++---- .github/workflows/release-branch-cut.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index ba7a17235..1e61a5d14 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -19,7 +19,7 @@ name: PR Test # * `workflow_call` from release-branch-cut.yml: tests an exact commit inside # a frozen image. The caller is always a workflow_dispatch, and the called # run inherits that event name, so every job below takes the trusted, -# full-scope manual-dispatch path; `inputs.ref` / `inputs.image_tag` only +# full-scope manual-dispatch path; `inputs.ref` / `inputs.ci_image_tag` only # redirect what is checked out and which image the suites run in. on: @@ -60,7 +60,7 @@ on: description: 'Exact commit to test (e.g. the release branch tip the lockfile was committed on).' required: true type: string - image_tag: + ci_image_tag: description: 'miles-diffusion Docker image tag to run the GPU suites in (the frozen release-vX.Y.Z-ci tag).' required: true type: string @@ -279,8 +279,8 @@ jobs: env: PR_BODY: ${{ github.event.pull_request.body || '' }} # In a workflow_call chain github.event.inputs are the caller's, so the - # frozen release tag arrives as inputs.image_tag. - INPUT_CI_IMAGE_TAG: ${{ inputs.image_tag || github.event.inputs.ci_image_tag || '' }} + # frozen release tag arrives as inputs.ci_image_tag. + INPUT_CI_IMAGE_TAG: ${{ inputs.ci_image_tag || github.event.inputs.ci_image_tag || '' }} DOCKER_BUILT: ${{ needs.docker-build.result == 'success' }} PR_NUMBER: ${{ github.event.pull_request.number || '' }} run: | diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index b2bcacabe..140f8ab02 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -202,7 +202,7 @@ jobs: uses: ./.github/workflows/pr-test.yml with: ref: ${{ needs.cut-release-branch.outputs.tested_sha }} - image_tag: ${{ needs.cut-release-branch.outputs.ci_image_tag }} + ci_image_tag: ${{ needs.cut-release-branch.outputs.ci_image_tag }} secrets: inherit # Finalizer: stamps the verdict onto the exact tested commit so From bffa7d476001b5707b28facb66749f5b7ca8c5ec Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:43:06 -0800 Subject: [PATCH 11/24] ci(release): spell out the abbreviated release variable names FA3_FP, MD_COMMIT and the dated/newest/pushed locals in pick_ci_image.py now carry the names their lock fields and build args use. --- .github/scripts/release/pick_ci_image.py | 16 ++++++++-------- .github/workflows/release-branch-cut.yml | 4 ++-- .github/workflows/release-docker.yml | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/scripts/release/pick_ci_image.py b/.github/scripts/release/pick_ci_image.py index 5dcf485d5..cfbf4c8e0 100644 --- a/.github/scripts/release/pick_ci_image.py +++ b/.github/scripts/release/pick_ci_image.py @@ -31,13 +31,13 @@ def main() -> int: runs = json.load(open(run_path)) tags = json.load(open(tags_path))["results"] - dated = sorted((t for t in tags if DATED_TAG_RE.fullmatch(t["name"])), key=lambda t: t["name"]) - if not dated: + dated_tags = sorted((t for t in tags if DATED_TAG_RE.fullmatch(t["name"])), key=lambda t: t["name"]) + if not dated_tags: print( "no dev-cu129-sglang-main- tag on Docker Hub; dispatch docker-build.yml first", file=sys.stderr ) return 1 - newest = dated[-1] + newest_tag = dated_tags[-1] if not runs: print("no successful docker-build.yml run found", file=sys.stderr) @@ -46,17 +46,17 @@ def main() -> int: if run["headBranch"] != "main": print(f"newest successful docker-build.yml run is on {run['headBranch']!r}, not main", file=sys.stderr) return 1 - pushed = parse_time(newest["last_updated"]) - if not parse_time(run["createdAt"]) <= pushed <= parse_time(run["updatedAt"]): + pushed_at = parse_time(newest_tag["last_updated"]) + if not parse_time(run["createdAt"]) <= pushed_at <= parse_time(run["updatedAt"]): print( - f"{newest['name']} (pushed {newest['last_updated']}) was not pushed by the newest successful " + f"{newest_tag['name']} (pushed {newest_tag['last_updated']}) was not pushed by the newest successful " f"docker-build.yml run ({run['createdAt']} .. {run['updatedAt']}); rebuild the image on main first", file=sys.stderr, ) return 1 - print(f"dev_image_tag={newest['name']}") - print(f"dev_image_digest={newest['digest']}") + print(f"dev_image_tag={newest_tag['name']}") + print(f"dev_image_digest={newest_tag['digest']}") print(f"image_build_sha={run['headSha']}") return 0 diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index 140f8ab02..181cec0d1 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -159,7 +159,7 @@ jobs: # so a rate limit fails the cut instead of writing an empty record. MILES_WHEELS_REPO=$(sed -n 's/^ARG MILES_WHEELS_REPO=//p' docker/Dockerfile) FA3_WHEELS_TAG=$(sed -n 's/^ARG FA3_WHEELS_TAG=//p' docker/Dockerfile) - FA3_FP=$(curl -fsS -H "Authorization: Bearer ${GH_TOKEN}" \ + FA3_WHEELS_FINGERPRINT=$(curl -fsS -H "Authorization: Bearer ${GH_TOKEN}" \ "https://api.github.com/repos/${MILES_WHEELS_REPO}/releases/tags/${FA3_WHEELS_TAG}" \ | python3 -c "import sys,json,hashlib; a=json.load(sys.stdin).get('assets',[]); fp=sorted([x['name'],x['id'],x['size'],x['updated_at']] for x in a); print(hashlib.sha256(repr(fp).encode()).hexdigest() if a else '')") @@ -172,7 +172,7 @@ jobs: --sglang-image-digest "$SGLANG_IMAGE_DIGEST" \ --fa3-wheels-repo "$MILES_WHEELS_REPO" \ --fa3-wheels-tag "$FA3_WHEELS_TAG" \ - --fa3-wheels-fingerprint "$FA3_FP" + --fa3-wheels-fingerprint "$FA3_WHEELS_FINGERPRINT" git add release-lock.json git commit -m "chore(release): freeze dependency lockfile for $BRANCH_NAME" git push origin "$BRANCH_NAME" diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 3547af929..848b99eea 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -79,7 +79,7 @@ jobs: done # github.sha is the default-branch HEAD on workflow_dispatch; the # image must bake the checked-out release commit. - echo "md_commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + echo "miles_diffusion_commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - name: Login to Docker Hub uses: docker/login-action@v3 @@ -94,7 +94,7 @@ jobs: SGLANG_IMAGE_TAG: ${{ steps.lock.outputs.sglang_image_tag }} SGLANG_IMAGE_DIGEST: ${{ steps.lock.outputs.sglang_image_digest }} SGLANG_COMMIT: ${{ steps.lock.outputs.sglang_commit }} - MD_COMMIT: ${{ steps.lock.outputs.md_commit }} + MILES_DIFFUSION_COMMIT: ${{ steps.lock.outputs.miles_diffusion_commit }} run: | # --no-cache --pull as in docker-build.yml: cached layers would pin # stale sources; the base image is pinned by digest so --pull cannot @@ -102,7 +102,7 @@ jobs: docker build --no-cache --pull -f docker/Dockerfile . \ --build-arg "SGLANG_IMAGE_TAG=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" \ --build-arg "SGLANG_DIFFUSION_COMMIT=${SGLANG_COMMIT}" \ - --build-arg "MILES_DIFFUSION_COMMIT=${MD_COMMIT}" \ + --build-arg "MILES_DIFFUSION_COMMIT=${MILES_DIFFUSION_COMMIT}" \ -t "${IMAGE}" docker push "${IMAGE}" @@ -119,5 +119,5 @@ jobs: echo "- \`radixark/miles_diffusion:v${{ steps.resolve.outputs.version }}\` (cu129, x86_64)" echo "- base image: \`lmsysorg/sglang:${{ steps.lock.outputs.sglang_image_tag }}@${{ steps.lock.outputs.sglang_image_digest }}\`" echo "- sglang: \`${{ steps.lock.outputs.sglang_commit }}\`" - echo "- miles_diffusion: \`${{ steps.lock.outputs.md_commit }}\`" + echo "- miles_diffusion: \`${{ steps.lock.outputs.miles_diffusion_commit }}\`" } >> "$GITHUB_STEP_SUMMARY" From c1b17d5a79fc3ec6444a39bded555a8dc2ec0911 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:43:52 -0800 Subject: [PATCH 12/24] ci(release): move the lock field comments above the literal One comment on the restored-versus-audit split instead of four inside the json.dump call. --- .github/scripts/release/write_release_lock.py | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/scripts/release/write_release_lock.py b/.github/scripts/release/write_release_lock.py index e1c8a6993..533bae152 100644 --- a/.github/scripts/release/write_release_lock.py +++ b/.github/scripts/release/write_release_lock.py @@ -27,30 +27,25 @@ def main() -> int: assert args.sglang_image_digest.startswith("sha256:"), "failed to resolve sglang_image_digest" assert args.fa3_wheels_fingerprint, "failed to fingerprint the FA3 wheels release" - json.dump( - { - "release_branch": args.release_branch, - # Restored inputs: CI re-installs sglang at this commit and - # release-docker.yml bakes it. - "sglang_repo": "sgl-project/sglang", - "sglang_branch": "sglang-miles", - "sglang_commit": args.sglang_commit, - # Restored input for release CI; the digest records what the tag - # pointed at when it was frozen. - "ci_image_tag": args.ci_image_tag, - "ci_image_digest": args.ci_image_digest, - # Restored input for release-docker.yml: FROM @. - "sglang_image_tag": args.sglang_image_tag, - "sglang_image_digest": args.sglang_image_digest, - # Audit only: a rolling wheels release can have assets replaced in - # place, so it cannot be pinned by name. - "fa3_wheels_repo": args.fa3_wheels_repo, - "fa3_wheels_tag": args.fa3_wheels_tag, - "fa3_wheels_fingerprint": args.fa3_wheels_fingerprint, - }, - open("release-lock.json", "w"), - indent=2, - ) + # Restored inputs: release CI re-installs sglang at sglang_commit and runs + # inside ci_image_tag; release-docker.yml bakes sglang_commit and builds + # FROM sglang_image_tag@sglang_image_digest. ci_image_digest and the + # fa3_wheels_* fields are audit records: a rolling wheels release can have + # its assets replaced in place, so it cannot be pinned by name. + lock = { + "release_branch": args.release_branch, + "sglang_repo": "sgl-project/sglang", + "sglang_branch": "sglang-miles", + "sglang_commit": args.sglang_commit, + "ci_image_tag": args.ci_image_tag, + "ci_image_digest": args.ci_image_digest, + "sglang_image_tag": args.sglang_image_tag, + "sglang_image_digest": args.sglang_image_digest, + "fa3_wheels_repo": args.fa3_wheels_repo, + "fa3_wheels_tag": args.fa3_wheels_tag, + "fa3_wheels_fingerprint": args.fa3_wheels_fingerprint, + } + json.dump(lock, open("release-lock.json", "w"), indent=2) return 0 From e0241d37385ba8743d92d70182fe948ae253a398 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:43:52 -0800 Subject: [PATCH 13/24] ci: add the lockfile tag to resolve-ci-image's header comment --- .github/workflows/pr-test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 1e61a5d14..f3e0fec6d 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -7,7 +7,8 @@ name: PR Test # node-radixark-32-0000) split into (h200,3gpu) + (h200,5gpu) runners — # stage-b (fast-gpu) and stage-c (e2e) only, no stage-c-8-gpu-h100. # * `resolve-ci-image` resolves a `radixark/miles_diffusion:` -# container (default `latest`), overridable via the `ci-image-tag:` +# container (default `latest`, or the tag a release branch's +# release-lock.json freezes), overridable via the `ci-image-tag:` # PR-body line or the `ci_image_tag` dispatch input. # * `docker-paths` + `docker-build` build a `pr-` image on docker PRs. # * `ci_megatron_pr` workflow_dispatch input removed — miles-D source has @@ -32,8 +33,8 @@ on: - cron: '30 16 * * *' workflow_dispatch: inputs: - # Empty defaults: on a release branch the values come from its - # release-lock.json; anywhere else the old defaults still apply. + # Empty so a release branch's release-lock.json can apply; without a + # lockfile the resolve steps fall back to the values named below. ci_sglang_pr: description: 'SGLang branch/commit (empty: release-lock.json if present, else sglang-miles)' required: false From ab0d2c6c856f8887e0cbbd36694d220988aaad2f Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:44:13 -0800 Subject: [PATCH 14/24] docs: say which inputs a versioned image tag pins, not all of them The runbook lists what a release does not freeze (apt, pip resolution, kernels lock), so installation.md must not promise more. --- docs/getting-started/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index c918c4a81..59f491a7e 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -19,8 +19,8 @@ docker pull radixark/miles_diffusion:latest `latest` carries the `sglang-miles` tip as of its last build, and is rebuilt when `docker/Dockerfile` or `requirements.txt` changes on main (or on a manual dispatch); dated tags (`dev-cu129-sglang-main-YYYYMMDD`) pin a specific build. Versioned tags (`v`, e.g. -`v0.2.0`) are built from a git tag of the same name with every dependency pinned in that tag's -`release-lock.json`, and never move. CUDA 12.9 is the only supported +`v0.2.0`) are built from a git tag of the same name with the sglang commit and the base image +pinned in that tag's `release-lock.json`, and never move. CUDA 12.9 is the only supported build — the Dockerfile carries a CUDA 13 recipe in a comment, but its `sglang-kernel` pin is hardcoded to cu129 and no CI covers it. From 5c5c5573b79cc723ee953c79e85eba696f1e34cf Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:49:49 -0800 Subject: [PATCH 15/24] ci(release): spell the sglang commit SGLANG_COMMIT, as the lock does release-branch-cut.yml called it SGLANG_SHA while the lock field it fills is sglang_commit and release-docker.yml reads it back as SGLANG_COMMIT. --- .github/workflows/release-branch-cut.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index 181cec0d1..b46c10925 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -141,7 +141,7 @@ jobs: git config user.email "miles-bot@users.noreply.github.com" git checkout -b "$BRANCH_NAME" "${{ steps.validate.outputs.commit_sha }}" - SGLANG_SHA=$(git ls-remote https://github.com/sgl-project/sglang refs/heads/sglang-miles | cut -f1) + SGLANG_COMMIT=$(git ls-remote https://github.com/sgl-project/sglang refs/heads/sglang-miles | cut -f1) # Retag by digest, not by name: the dated tag can be overwritten # within its day, and the release-scoped name never moves. @@ -165,7 +165,7 @@ jobs: python3 .github/scripts/release/write_release_lock.py \ --release-branch "$BRANCH_NAME" \ - --sglang-commit "$SGLANG_SHA" \ + --sglang-commit "$SGLANG_COMMIT" \ --ci-image-tag "$CI_IMAGE_TAG" \ --ci-image-digest "$DEV_IMAGE_DIGEST" \ --sglang-image-tag "$SGLANG_IMAGE_TAG" \ @@ -178,7 +178,7 @@ jobs: git push origin "$BRANCH_NAME" echo "ci_image_tag=$CI_IMAGE_TAG" >> "$GITHUB_OUTPUT" echo "tested_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - echo "Froze: sglang=$SGLANG_SHA image=$CI_IMAGE_TAG base=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" + echo "Froze: sglang=$SGLANG_COMMIT image=$CI_IMAGE_TAG base=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" - name: Summary run: | From 019bc32c99da606d738daa5869d34e0ed3c7409d Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:50:37 -0800 Subject: [PATCH 16/24] ci(release): trim the lockfile and image-guard comments Drop the sentences that restate the guard they sit above or the error line they precede (override precedence, the latest fallback, the preflight's own ::error text, the cherry-pick's ship-as-a-new-release advice) and keep the one fact the code cannot show: the lock's repo and commit apply as a pair, github.sha is the main tip the cut was dispatched on, and the GPU suites never reinstall requirements.txt. --- .github/workflows/_run-ci.yml | 20 ++++++++------------ .github/workflows/bot-cherry-pick.yml | 12 +++++------- .github/workflows/pr-test.yml | 7 +++---- .github/workflows/release-branch-cut.yml | 2 -- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/.github/workflows/_run-ci.yml b/.github/workflows/_run-ci.yml index ac3d4ecaa..e96d43942 100644 --- a/.github/workflows/_run-ci.yml +++ b/.github/workflows/_run-ci.yml @@ -95,8 +95,7 @@ jobs: uses: actions/checkout@v4 with: # Review-triggered callers otherwise check out the default branch. - # Release CI passes the exact commit; github.sha would be the main tip - # the cut workflow was dispatched on. + # release CI: github.sha is the main tip the cut was dispatched on ref: ${{ inputs.ref || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha) }} - name: Cleanup Ray processes @@ -149,10 +148,9 @@ jobs: PR_SGLANG_REPO=$(echo "$PR_BODY" | grep -m1 -oP '^ci-sglang-repo:\s+\K\S+' || true) [ -z "$SGLANG_REPO" ] && [ -n "$PR_SGLANG_REPO" ] && SGLANG_REPO="$PR_SGLANG_REPO" fi - # A release branch carries release-lock.json (written by - # release-branch-cut.yml) naming the sglang commit the release was - # frozen with. Explicit overrides above still win; the moving branch - # head is only the last resort. Repo and commit apply as a pair. + # release-lock.json (committed by release-branch-cut.yml) names the + # sglang commit a release branch was frozen with; its repo and + # commit apply as a pair. if [ -z "$SGLANG_PR" ] && [ -f release-lock.json ]; then SGLANG_PR=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_commit'])") SGLANG_REPO=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_repo'])") @@ -233,8 +231,7 @@ jobs: - name: Checkout miles-diffusion uses: actions/checkout@v4 with: - # Release CI passes the exact commit; github.sha would be the main tip - # the cut workflow was dispatched on. + # release CI: github.sha is the main tip the cut was dispatched on ref: ${{ inputs.ref || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha) }} - name: Set up Python @@ -269,10 +266,9 @@ jobs: PR_SGLANG_REPO=$(echo "$PR_BODY" | grep -m1 -oP '^ci-sglang-repo:\s+\K\S+' || true) [ -z "$SGLANG_REPO" ] && [ -n "$PR_SGLANG_REPO" ] && SGLANG_REPO="$PR_SGLANG_REPO" fi - # A release branch carries release-lock.json (written by - # release-branch-cut.yml) naming the sglang commit the release was - # frozen with. Explicit overrides above still win; the moving branch - # head is only the last resort. Repo and commit apply as a pair. + # release-lock.json (committed by release-branch-cut.yml) names the + # sglang commit a release branch was frozen with; its repo and + # commit apply as a pair. if [ -z "$SGLANG_PR" ] && [ -f release-lock.json ]; then SGLANG_PR=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_commit'])") SGLANG_REPO=$(python3 -c "import json; print(json.load(open('release-lock.json'))['sglang_repo'])") diff --git a/.github/workflows/bot-cherry-pick.yml b/.github/workflows/bot-cherry-pick.yml index 2b44fec58..02675f067 100644 --- a/.github/workflows/bot-cherry-pick.yml +++ b/.github/workflows/bot-cherry-pick.yml @@ -76,13 +76,11 @@ jobs: exit 1 fi - # The frozen release-v*-ci image is built from the Dockerfile and - # requirements.txt at cut time, and the GPU suites run the image's - # installed requirements (only the CPU job installs the file at run - # time): a pick that changes either would make CI test the old image - # while release-docker publishes an untested new one. Such fixes ship - # as a new release (bump + fresh cut), never as a hotfix. Same paths - # as pr-test.yml's docker-paths filter. + # The frozen release-v*-ci image bakes the cut point's Dockerfile and + # requirements.txt, and the GPU suites never reinstall requirements.txt + # (only the CPU job does): a pick changing either would be tested in + # the old image while release-docker publishes an untested new one. + # Same paths as pr-test.yml's docker-paths filter. if git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" \ | grep -qE '^(docker/Dockerfile|requirements\.txt)$'; then echo "::error::Commit $COMMIT_SHA touches image-layer files; the frozen CI image cannot represent it. Ship this as a new release (bump + release-branch-cut) instead of a cherry-pick." diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index f3e0fec6d..289adbce5 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -33,8 +33,7 @@ on: - cron: '30 16 * * *' workflow_dispatch: inputs: - # Empty so a release branch's release-lock.json can apply; without a - # lockfile the resolve steps fall back to the values named below. + # empty defaults let a release branch's release-lock.json apply ci_sglang_pr: description: 'SGLang branch/commit (empty: release-lock.json if present, else sglang-miles)' required: false @@ -292,8 +291,8 @@ jobs: PR_CI_IMAGE_TAG=$(echo "$PR_BODY" | grep -m1 -oP '^ci-image-tag:\s+\K\S+' || true) [ -z "$CI_IMAGE_TAG" ] && [ -n "$PR_CI_IMAGE_TAG" ] && CI_IMAGE_TAG="$PR_CI_IMAGE_TAG" fi - # Release branches freeze their CI image in release-lock.json; `latest` - # moves on every main push touching docker files and is the last resort. + # release-lock.json pins a release branch's CI image; `latest` moves on + # every main push touching docker files. if [ -z "$CI_IMAGE_TAG" ] && [ -f release-lock.json ]; then CI_IMAGE_TAG=$(python3 -c "import json; print(json.load(open('release-lock.json'))['ci_image_tag'])") echo "release-lock.json present: image tag ${CI_IMAGE_TAG}" diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index b46c10925..fffc5b923 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -104,8 +104,6 @@ jobs: "$RUNNER_TEMP/docker-build-run.json" "$RUNNER_TEMP/tags.json" > "$RUNNER_TEMP/picked.env" cat "$RUNNER_TEMP/picked.env" source "$RUNNER_TEMP/picked.env" - # The frozen image must represent the cut point's image layers; a - # Dockerfile or requirements change in between needs a fresh build. if ! git diff --quiet "$image_build_sha" "$COMMIT_SHA" -- docker/Dockerfile requirements.txt; then echo "::error::docker/Dockerfile or requirements.txt differ between the image build ($image_build_sha) and the cut point ($COMMIT_SHA); dispatch docker-build.yml on main and re-run" git diff --stat "$image_build_sha" "$COMMIT_SHA" -- docker/Dockerfile requirements.txt From 19bc02e28ca14667535f09207c62f640e01cc8da Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:50:54 -0800 Subject: [PATCH 17/24] ci(release): spell the cherry-pick image-layer path pattern once The guard matched docker/Dockerfile and requirements.txt while the listing printed under the error used a looser ^docker/ pattern, so the two had to be proved equivalent by the reader; one IMAGE_LAYER_PATHS serves both and the listing now names exactly the files that tripped the guard. --- .github/workflows/bot-cherry-pick.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bot-cherry-pick.yml b/.github/workflows/bot-cherry-pick.yml index 02675f067..37cc4dc7b 100644 --- a/.github/workflows/bot-cherry-pick.yml +++ b/.github/workflows/bot-cherry-pick.yml @@ -81,10 +81,10 @@ jobs: # (only the CPU job does): a pick changing either would be tested in # the old image while release-docker publishes an untested new one. # Same paths as pr-test.yml's docker-paths filter. - if git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" \ - | grep -qE '^(docker/Dockerfile|requirements\.txt)$'; then + IMAGE_LAYER_PATHS='^(docker/Dockerfile|requirements\.txt)$' + if git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" | grep -qE "$IMAGE_LAYER_PATHS"; then echo "::error::Commit $COMMIT_SHA touches image-layer files; the frozen CI image cannot represent it. Ship this as a new release (bump + release-branch-cut) instead of a cherry-pick." - git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" | grep -E '^(docker/|requirements\.txt)' + git diff --name-only "${COMMIT_SHA}^1" "$COMMIT_SHA" | grep -E "$IMAGE_LAYER_PATHS" exit 1 fi From 2fef82416709d5fb7592ae88ac47ff6dcd471f4f Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 14:51:51 -0800 Subject: [PATCH 18/24] ci: describe the lockfile fallback on record-e2e-standards' sglang input --- .github/workflows/record-e2e-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/record-e2e-standards.yml b/.github/workflows/record-e2e-standards.yml index f09b0a73e..33515f1df 100644 --- a/.github/workflows/record-e2e-standards.yml +++ b/.github/workflows/record-e2e-standards.yml @@ -15,7 +15,7 @@ on: type: string default: '["h200", "5gpu"]' ci_sglang_pr: - description: 'SGLang branch, commit, or PR (default: sglang-miles)' + description: 'SGLang branch, commit, or PR (empty: release-lock.json if present, else sglang-miles)' required: false type: string ci_sglang_repo: From 5d1b2c2b6a631184a41013a040492127570e808c Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:21:31 -0800 Subject: [PATCH 19/24] ci(release): fail on an unreadable lockfile instead of echoing empty outputs echo "key=$(cmd)" exits 0 when cmd fails under bash -e, so a hand-created release branch without release-lock.json would have been re-tested on latest and the sglang-miles tip and stamped release-ci=success. Assign first, echo second; an existing branch without a lockfile is refused. --- .github/workflows/release-branch-cut.yml | 14 +++++++++++--- .github/workflows/release-docker.yml | 8 ++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index fffc5b923..c7556f3a0 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -130,8 +130,15 @@ jobs: # Existing branch: reuse its committed lockfile for the CI image tag. git fetch origin "$BRANCH_NAME" git checkout "$BRANCH_NAME" - echo "ci_image_tag=$(python3 -c "import json; print(json.load(open('release-lock.json'))['ci_image_tag'])")" >> "$GITHUB_OUTPUT" - echo "tested_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + if [ ! -f release-lock.json ]; then + echo "::error::$BRANCH_NAME has no release-lock.json; only branches created by this workflow can be re-tested" + exit 1 + fi + # Assign before echoing: a failing $(...) inside echo exits 0 under bash -e. + CI_IMAGE_TAG=$(python3 -c "import json; print(json.load(open('release-lock.json'))['ci_image_tag'])") + TESTED_SHA=$(git rev-parse HEAD) + echo "ci_image_tag=$CI_IMAGE_TAG" >> "$GITHUB_OUTPUT" + echo "tested_sha=$TESTED_SHA" >> "$GITHUB_OUTPUT" exit 0 fi @@ -174,8 +181,9 @@ jobs: git add release-lock.json git commit -m "chore(release): freeze dependency lockfile for $BRANCH_NAME" git push origin "$BRANCH_NAME" + TESTED_SHA=$(git rev-parse HEAD) echo "ci_image_tag=$CI_IMAGE_TAG" >> "$GITHUB_OUTPUT" - echo "tested_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + echo "tested_sha=$TESTED_SHA" >> "$GITHUB_OUTPUT" echo "Froze: sglang=$SGLANG_COMMIT image=$CI_IMAGE_TAG base=${SGLANG_IMAGE_TAG}@${SGLANG_IMAGE_DIGEST}" - name: Summary diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 848b99eea..29e620d89 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -74,12 +74,16 @@ jobs: echo "::error::release-lock.json not found at ${{ steps.resolve.outputs.ref }} — was this tag cut via release-branch-cut.yml?" exit 1 fi + # Assign before echoing: a failing $(...) inside echo exits 0 under bash -e. for key in sglang_commit sglang_image_tag sglang_image_digest; do - echo "$key=$(python3 -c "import json; print(json.load(open('release-lock.json'))['$key'])")" >> "$GITHUB_OUTPUT" + value=$(python3 -c "import json; print(json.load(open('release-lock.json'))['$key'])") + [ -n "$value" ] || { echo "::error::release-lock.json has an empty $key"; exit 1; } + echo "$key=$value" >> "$GITHUB_OUTPUT" done # github.sha is the default-branch HEAD on workflow_dispatch; the # image must bake the checked-out release commit. - echo "miles_diffusion_commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + MILES_DIFFUSION_COMMIT=$(git rev-parse HEAD) + echo "miles_diffusion_commit=$MILES_DIFFUSION_COMMIT" >> "$GITHUB_OUTPUT" - name: Login to Docker Hub uses: docker/login-action@v3 From 7ac69478d886823b92df6506a7ef42dfdc44347e Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:21:31 -0800 Subject: [PATCH 20/24] ci(release): accept only well-formed digests and SHAs from the image pick --- .github/scripts/release/pick_ci_image.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/scripts/release/pick_ci_image.py b/.github/scripts/release/pick_ci_image.py index cfbf4c8e0..f0acc38d0 100644 --- a/.github/scripts/release/pick_ci_image.py +++ b/.github/scripts/release/pick_ci_image.py @@ -55,6 +55,13 @@ def main() -> int: ) return 1 + # The workflow sources these lines: accept only the exact digest / SHA shapes. + if not re.fullmatch(r"sha256:[0-9a-f]{64}", newest_tag["digest"] or ""): + print(f"unexpected digest for {newest_tag['name']}: {newest_tag['digest']!r}", file=sys.stderr) + return 1 + if not re.fullmatch(r"[0-9a-f]{40}", run["headSha"]): + print(f"unexpected headSha: {run['headSha']!r}", file=sys.stderr) + return 1 print(f"dev_image_tag={newest_tag['name']}") print(f"dev_image_digest={newest_tag['digest']}") print(f"image_build_sha={run['headSha']}") From f7d2e810ed79adef1f087fcf26ca7c1a7d042dd4 Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:21:31 -0800 Subject: [PATCH 21/24] ci(release): let bump_version.py accept only the base version X.Y.Z release-tag.yml greps setup.py for the base version, so a merged rc or post bump would block every tag on the branch. --- .github/scripts/release/bump_version.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/scripts/release/bump_version.py b/.github/scripts/release/bump_version.py index 0954c526d..bba7c715b 100644 --- a/.github/scripts/release/bump_version.py +++ b/.github/scripts/release/bump_version.py @@ -1,4 +1,4 @@ -"""Bump the miles_diffusion version in setup.py. +"""Bump the miles_diffusion base version in setup.py. Usage: python .github/scripts/release/bump_version.py 0.3.0 @@ -9,7 +9,7 @@ import sys from pathlib import Path -VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:(?:rc|\.post)\d+)?$") +VERSION_RE = re.compile(r"^\d+\.\d+\.\d+$") def main() -> int: @@ -18,7 +18,8 @@ def main() -> int: return 1 new_version = sys.argv[1] if not VERSION_RE.fullmatch(new_version): - print(f"Invalid version {new_version!r}; expected X.Y.Z, X.Y.ZrcN, or X.Y.Z.postN", file=sys.stderr) + # setup.py carries the base version only; rcN / .postN belong to the tag. + print(f"Invalid version {new_version!r}; expected the base version X.Y.Z", file=sys.stderr) return 1 setup_py = Path(__file__).resolve().parents[3] / "setup.py" From fcfc5238b5d7a35161cf838b6afe860a087b20ea Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:21:32 -0800 Subject: [PATCH 22/24] docs: say record-e2e-standards gets only the sglang pin on a release branch --- docs/developer/release.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/developer/release.md b/docs/developer/release.md index 63ac366e6..cc9b399bd 100644 --- a/docs/developer/release.md +++ b/docs/developer/release.md @@ -21,9 +21,10 @@ with this repository's inputs: one source dependency (sglang's `sglang-miles` br | miles-diffusion code | the tagged commit | `MILES_DIFFUSION_COMMIT` of the release build | `release-lock.json` is written once, by the first dispatch of `release-branch-cut.yml`, and -committed on the release branch. Everything a release branch runs in CI reads it: the sglang ref -and the image tag resolve from it whenever no explicit input or PR-body directive names a value, -so a plain `pr-test.yml` dispatch on the branch is pinned too. +committed on the release branch. `pr-test.yml` reads it whenever no explicit input or PR-body +directive names a value, so a plain dispatch on the branch gets the locked sglang ref and the +frozen image too. `record-e2e-standards.yml` passes no image and gets the sglang pin only; do +not record standards on a release branch (they are re-recorded on `main` through the fix's PR). The exact version may be `X.Y.Z`, `X.Y.ZrcN` or `X.Y.Z.postN`; the branch and `setup.py` always carry the base version. `v0.2.0rc1`, `v0.2.0` and `v0.2.0.post1` all come from `release/v0.2.0` From af389622651106bb4850d0a460a25fa3b837e14e Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:21:32 -0800 Subject: [PATCH 23/24] ci(release): retag the CI image only after every lock input resolved shell: bash adds pipefail to the two piped steps; the retag moves after write_release_lock.py so a cut that fails on a missing input leaves no release-vX.Y.Z-ci tag behind. --- .github/workflows/release-branch-cut.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index c7556f3a0..eeea5da55 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -92,6 +92,8 @@ jobs: - name: Preflight the CI image if: steps.check_exists.outputs.branch_exists != 'true' id: preflight + # bash with pipefail: the pipelines below must not hide a failing producer. + shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_SHA: ${{ steps.validate.outputs.commit_sha }} @@ -120,6 +122,7 @@ jobs: - name: Create branch and freeze release-lock.json id: freeze + shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEV_IMAGE_TAG: ${{ steps.preflight.outputs.dev_image_tag }} @@ -148,11 +151,7 @@ jobs: SGLANG_COMMIT=$(git ls-remote https://github.com/sgl-project/sglang refs/heads/sglang-miles | cut -f1) - # Retag by digest, not by name: the dated tag can be overwritten - # within its day, and the release-scoped name never moves. CI_IMAGE_TAG="release-${BRANCH_NAME#release/}-ci" - docker buildx imagetools create -t "radixark/miles_diffusion:${CI_IMAGE_TAG}" "radixark/miles_diffusion@${DEV_IMAGE_DIGEST}" - echo "Retagged radixark/miles_diffusion:${DEV_IMAGE_TAG} (${DEV_IMAGE_DIGEST}) -> radixark/miles_diffusion:${CI_IMAGE_TAG}" # `docker build --pull` re-resolves the base tag at every build, so # release-docker.yml pins FROM @. @@ -178,6 +177,13 @@ jobs: --fa3-wheels-repo "$MILES_WHEELS_REPO" \ --fa3-wheels-tag "$FA3_WHEELS_TAG" \ --fa3-wheels-fingerprint "$FA3_WHEELS_FINGERPRINT" + + # Retag by digest, not by name: the dated tag can be overwritten + # within its day, and the release-scoped name never moves. After the + # lock writer validated every input, so a failed cut leaves no tag. + docker buildx imagetools create -t "radixark/miles_diffusion:${CI_IMAGE_TAG}" "radixark/miles_diffusion@${DEV_IMAGE_DIGEST}" + echo "Retagged radixark/miles_diffusion:${DEV_IMAGE_TAG} (${DEV_IMAGE_DIGEST}) -> radixark/miles_diffusion:${CI_IMAGE_TAG}" + git add release-lock.json git commit -m "chore(release): freeze dependency lockfile for $BRANCH_NAME" git push origin "$BRANCH_NAME" From 95bbe767ffb6ba9f266ac586d5e97cf69d6fc7af Mon Sep 17 00:00:00 2001 From: rockdu Date: Tue, 10 Nov 2026 15:24:19 -0800 Subject: [PATCH 24/24] ci(release): put the pipefail comment on the step that has pipelines --- .github/workflows/release-branch-cut.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-branch-cut.yml b/.github/workflows/release-branch-cut.yml index eeea5da55..be775a5de 100644 --- a/.github/workflows/release-branch-cut.yml +++ b/.github/workflows/release-branch-cut.yml @@ -92,7 +92,7 @@ jobs: - name: Preflight the CI image if: steps.check_exists.outputs.branch_exists != 'true' id: preflight - # bash with pipefail: the pipelines below must not hide a failing producer. + # Explicit bash (-eo pipefail) on both scripted steps, so they behave alike. shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -122,6 +122,8 @@ jobs: - name: Create branch and freeze release-lock.json id: freeze + # pipefail: the ls-remote | cut and curl | python3 pipelines below must + # not hide a failing producer. shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}