From b3b8c42b5ccdc846c9944deae2033c1cf8e8a3e8 Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:21:46 +0100 Subject: [PATCH 1/5] AI-3561: release.yml builds through a shared action that checks the tag's version Co-Authored-By: Claude Opus 5.5 --- .../actions/build-python-packages/action.yml | 38 ++++++++ .github/scripts/check-release-version.sh | 43 +++++++++ .github/workflows/release-check.yml | 88 +++++++++++++++++++ .github/workflows/release.yml | 34 +++---- 4 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 .github/actions/build-python-packages/action.yml create mode 100755 .github/scripts/check-release-version.sh create mode 100644 .github/workflows/release-check.yml diff --git a/.github/actions/build-python-packages/action.yml b/.github/actions/build-python-packages/action.yml new file mode 100644 index 0000000000..5336128902 --- /dev/null +++ b/.github/actions/build-python-packages/action.yml @@ -0,0 +1,38 @@ +name: Build the Python packages +description: Build every workspace package and check that each carries the version of the release tag. Never uploads. +inputs: + tag: + description: The release tag, vX.Y.Z. The checkout must see it. + required: true +outputs: + version: + description: The version, X.Y.Z, that every built file carries + value: ${{ steps.check.outputs.version }} +runs: + using: composite + steps: + # No dependency cache in a job that holds an OIDC token: a cache poisoned by another + # run would hand that token to whatever it planted. + - uses: ./.github/actions/python-uv-setup + with: + enable-cache: "false" + + - name: Clean dist directory + shell: bash + run: | + rm -rf dist + + - name: Build all distributions + shell: bash + env: + UV_BUILD_CONSTRAINT: ${{ github.workspace }}/.github/release-build-constraints.txt + run: | + uv build --all + + - name: Check that every file has the release version + id: check + shell: bash + env: + TAG: ${{ inputs.tag }} + run: | + .github/scripts/check-release-version.sh "$TAG" dist diff --git a/.github/scripts/check-release-version.sh b/.github/scripts/check-release-version.sh new file mode 100755 index 0000000000..8302703c3b --- /dev/null +++ b/.github/scripts/check-release-version.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Fails unless the Python packages built in all carry the version of the release tag. +# +# The version is read from the nearest git tag (hatch-vcs). When the tag is not visible, the +# build does not fail: it falls back to 0.0.0 (`fallback_version` in each pyproject.toml), or to +# a dev version from another tag. PyPI never accepts a version twice, so this runs before upload. +# +# Usage: check-release-version.sh [] (tag: vX.Y.Z; dist-dir: dist) +# Writes `version=X.Y.Z` to $GITHUB_OUTPUT when it is set. +set -euo pipefail + +tag=${1:?usage: check-release-version.sh []} +dist=${2:-dist} + +fail() { + echo "::error::$*" + exit 1 +} + +[[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "release tag '$tag' is not vX.Y.Z" +want=${tag#v} + +got=$(cd sdks/python && uvx -q --from 'hatch==1.18.2' hatch version) +[[ $got == "$want" ]] || fail "hatch version prints '$got' for release tag '$tag', expected '$want'" + +shopt -s nullglob +files=("$dist"/*.whl "$dist"/*.tar.gz) +(( ${#files[@]} > 0 )) || fail "no wheel or sdist in $dist" +for f in "${files[@]}"; do + name=$(basename "$f") + case $name in + # A wheel is {name}-{version}-{python}-{abi}-{platform}.whl, and name has no '-'. + *.whl) version=$(cut -d- -f2 <<<"$name") ;; + # An sdist is {name}-{version}.tar.gz. + *) stem=${name%.tar.gz}; version=${stem##*-} ;; + esac + [[ $version == "$want" ]] || fail "$name has version '$version', expected '$want'" +done + +echo "${#files[@]} files in $dist, all at version $want" +if [[ -n ${GITHUB_OUTPUT:-} ]]; then + echo "version=$want" >> "$GITHUB_OUTPUT" +fi diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml new file mode 100644 index 0000000000..82808a0a14 --- /dev/null +++ b/.github/workflows/release-check.yml @@ -0,0 +1,88 @@ +name: Release check +# Proves, without publishing, that a release would build every Python package at the tag's +# version. It runs the build steps of release.yml (the build-python-packages action) on a local +# tag, and has no `uv publish`, no `pypi` environment and no `id-token` permission, so it can +# never reach PyPI. Run it by hand (Actions > Release check) before you tag a release. +on: + pull_request: + branches: [ "**" ] + # A draft runs nothing: CI starts when the pull request is marked ready (ready_for_review). + types: [ opened, synchronize, reopened, ready_for_review ] + paths: + - '.github/workflows/release.yml' + - '.github/workflows/release-check.yml' + - '.github/actions/build-python-packages/**' + - '.github/actions/python-uv-setup/**' + - '.github/scripts/check-release-version.sh' + - '.github/release-build-constraints.txt' + - '**/pyproject.toml' + - 'uv.lock' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release-check-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build every package at the release version + if: github.event.pull_request.draft != true + runs-on: ubuntu-latest + env: + # A version no release has, so the check never meets a real tag. + TAG: v99.0.0 + steps: + # The release job checks out the same way: one commit, no tags but the release's. + - name: Checkout + uses: actions/checkout@v6 + + - name: Tag this commit as the release + run: | + git tag "$TAG" + git tag --list + + - name: Build all distributions + uses: ./.github/actions/build-python-packages + with: + tag: ${{ env.TAG }} + + # Each wrong input must fail the version check. If one passes, the check no longer guards + # the upload. + - name: A wrong tag or a wrong file version must fail the check + run: | + fails() { + if "$@" > /dev/null 2>&1; then + echo "::error::passed, but must fail: $*" + exit 1 + fi + echo "failed as expected: $*" + } + fails .github/scripts/check-release-version.sh v99.0.1 dist + fails .github/scripts/check-release-version.sh 99.0.0 dist + fails .github/scripts/check-release-version.sh v99.0.0-rc1 dist + wheels=(dist/*.whl) + mkdir wrong empty + cp "${wheels[0]}" "wrong/$(basename "${wheels[0]}" | sed 's/-99\.0\.0-/-99.0.1-/')" + fails .github/scripts/check-release-version.sh "$TAG" wrong + fails .github/scripts/check-release-version.sh "$TAG" empty + + # Metadata PyPI refuses, such as a long description that does not render. + - name: Check the package metadata + run: uvx -q --from twine==7.0.0 twine check dist/* + + # PyPI takes an upload to a project that does not exist only from a pending trusted + # publisher. This repo cannot read that setting, so the step lists the projects to look at. + - name: List the projects PyPI does not have yet + run: | + missing="" + for wheel in dist/*.whl; do + name=$(basename "$wheel" | cut -d- -f1 | tr _ -) + code=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/$name/json") + [ "$code" = 200 ] || missing="$missing $name($code)" + done + if [ -n "$missing" ]; then + echo "::warning::not on PyPI, needs a pending trusted publisher before a release:$missing" + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 272477384c..1102714a59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,35 +30,23 @@ jobs: contents: read id-token: write # REQUIRED for PyPI Trusted Publishing (OIDC) outputs: - version: ${{ steps.get_version.outputs.version }} + version: ${{ steps.build.outputs.version }} steps: - name: Checkout uses: actions/checkout@v6 - # No dependency cache in a job that holds an OIDC token: a cache poisoned by another - # run would hand that token to whatever it planted. - - uses: ./.github/actions/python-uv-setup - with: - enable-cache: "false" - - - name: Clean dist directory - run: | - rm -rf dist - + # Builds every package and fails, before anything is uploaded, unless each file carries the + # tag's version. release-check.yml runs the same steps without the PyPI environment. - name: Build all distributions - env: - UV_BUILD_CONSTRAINT: ${{ github.workspace }}/.github/release-build-constraints.txt - run: | - uv build --all - - - name: Extract package version (hatch via uv) - id: get_version - working-directory: sdks/python - run: | - VERSION=$(uvx -q --from 'hatch==1.18.2' hatch version) - echo "version=$VERSION" >> "$GITHUB_OUTPUT" + id: build + uses: ./.github/actions/build-python-packages + with: + tag: ${{ github.event.release.tag_name }} + # `always`: the default, `automatic`, carries on without credentials when uv cannot get a + # token. Each PyPI project must list this workflow file and the `pypi` environment as a + # trusted publisher. - name: Publish to PyPI (Trusted Publishing) - run: uv publish + run: uv publish --trusted-publishing always test-core-index: name: Verify PIP install works From 1c7e63af58af9366a1405550a0a5309f37a23084 Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:24:24 +0100 Subject: [PATCH 2/5] AI-3561: Release check workflow, version guard without hatch, skill steps Co-Authored-By: Claude Opus 5.5 --- .claude/skills/release/SKILL.md | 14 ++++++++++++-- .github/scripts/check-release-version.sh | 10 ++++------ .github/workflows/release-check.yml | 14 +++++++++++--- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.claude/skills/release/SKILL.md b/.claude/skills/release/SKILL.md index d290dc6f09..b777fae826 100644 --- a/.claude/skills/release/SKILL.md +++ b/.claude/skills/release/SKILL.md @@ -85,6 +85,12 @@ git worktree remove It must print `X.Y.Z` exactly. If it does not, stop: delete the local tag (`git tag -d vX.Y.Z`) and do not publish. If it does, push the tag: `git push origin vX.Y.Z`. +`release.yml` repeats the check on the runner, where the checkout holds only the release's tag: +its build job runs `.github/scripts/check-release-version.sh`, which fails before the upload +unless every wheel and sdist carries the version of the tag. The `Release check` workflow +(Actions > Release check, also run on a pull request that changes the release files) builds every +package at a local tag and runs that script, without the `pypi` environment, so it cannot publish. + ## 5. Publish the GitHub release (ask first) ```bash @@ -105,5 +111,9 @@ generated notes by using the `--notes` flag"). The CHANGELOG section is not copi `release.yml` has never succeeded: of its 41 runs, 34 ended `failure`, 3 `startup_failure`, 3 `cancelled` and 1 `skipped`. The packages of 0.6.5 to 0.6.9 reached PyPI outside it, and 0.6.9 -has no Trusted Publishing provenance (AI-3561). Until AI-3561 is fixed, step 6 is unverified. If the run does not succeed, the packages are not on PyPI. Report it -on AI-3561, and do not upload by hand. +has no Trusted Publishing provenance (AI-3561). The first run of the fixed workflow is the first +check of PyPI's side, which the repo cannot read: every PyPI project of the 41 packages must list +`GetStream/Agents`, `release.yml` and the environment `pypi` as a trusted publisher, and +`vision-agents-plugins-omni` and `vision-agents-plugins-stream` are not on PyPI yet, so each needs a +pending publisher. If the run does not succeed, some packages may be on PyPI and others not. Report +it on AI-3561, and do not upload by hand. diff --git a/.github/scripts/check-release-version.sh b/.github/scripts/check-release-version.sh index 8302703c3b..bf7651a71d 100755 --- a/.github/scripts/check-release-version.sh +++ b/.github/scripts/check-release-version.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash # Fails unless the Python packages built in all carry the version of the release tag. # -# The version is read from the nearest git tag (hatch-vcs). When the tag is not visible, the -# build does not fail: it falls back to 0.0.0 (`fallback_version` in each pyproject.toml), or to -# a dev version from another tag. PyPI never accepts a version twice, so this runs before upload. +# Each package takes its version from the nearest git tag (hatch-vcs). When the checkout does not +# see the release tag, the build does not fail: it gets a dev version from another tag, or 0.0.0 +# (`fallback_version` in each pyproject.toml). PyPI never takes a version twice, so this runs +# before the upload. # # Usage: check-release-version.sh [] (tag: vX.Y.Z; dist-dir: dist) # Writes `version=X.Y.Z` to $GITHUB_OUTPUT when it is set. @@ -20,9 +21,6 @@ fail() { [[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "release tag '$tag' is not vX.Y.Z" want=${tag#v} -got=$(cd sdks/python && uvx -q --from 'hatch==1.18.2' hatch version) -[[ $got == "$want" ]] || fail "hatch version prints '$got' for release tag '$tag', expected '$want'" - shopt -s nullglob files=("$dist"/*.whl "$dist"/*.tar.gz) (( ${#files[@]} > 0 )) || fail "no wheel or sdist in $dist" diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index 82808a0a14..ada165bb95 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -64,9 +64,17 @@ jobs: fails .github/scripts/check-release-version.sh 99.0.0 dist fails .github/scripts/check-release-version.sh v99.0.0-rc1 dist wheels=(dist/*.whl) - mkdir wrong empty - cp "${wheels[0]}" "wrong/$(basename "${wheels[0]}" | sed 's/-99\.0\.0-/-99.0.1-/')" - fails .github/scripts/check-release-version.sh "$TAG" wrong + sdists=(dist/*.tar.gz) + wrong_wheel=$(basename "${wheels[0]}" | sed 's/-99\.0\.0-/-99.0.1-/') + wrong_sdist=$(basename "${sdists[0]}" | sed 's/-99\.0\.0\.tar/-99.0.1.tar/') + mkdir empty wheel-wrong sdist-wrong + # One wrong file of a kind, beside a right file of the other kind. + cp "${wheels[0]}" "wheel-wrong/$wrong_wheel" + cp "${sdists[0]}" wheel-wrong/ + cp "${sdists[0]}" "sdist-wrong/$wrong_sdist" + cp "${wheels[0]}" sdist-wrong/ + fails .github/scripts/check-release-version.sh "$TAG" wheel-wrong + fails .github/scripts/check-release-version.sh "$TAG" sdist-wrong fails .github/scripts/check-release-version.sh "$TAG" empty # Metadata PyPI refuses, such as a long description that does not render. From f43a88ab981be2a0e7405e8c1611968b46acc15c Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:46:26 +0100 Subject: [PATCH 3/5] AI-3561: release check covers rc and 4-part tags, a post version, stray files and the action output (R1.1, R1.3) Co-Authored-By: Claude Opus 5.5 --- .github/scripts/check-release-version.sh | 12 +++++++++-- .github/workflows/release-check.yml | 26 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-release-version.sh b/.github/scripts/check-release-version.sh index bf7651a71d..207169ad7c 100755 --- a/.github/scripts/check-release-version.sh +++ b/.github/scripts/check-release-version.sh @@ -21,8 +21,16 @@ fail() { [[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "release tag '$tag' is not vX.Y.Z" want=${tag#v} -shopt -s nullglob -files=("$dist"/*.whl "$dist"/*.tar.gz) +# `uv publish` uploads everything in the directory, so every file there must be checked. +shopt -s nullglob dotglob +files=() +for f in "$dist"/*; do + case $(basename "$f") in + .gitignore) ;; + *.whl | *.tar.gz) files+=("$f") ;; + *) fail "$f is neither a wheel nor an sdist, and 'uv publish' would upload it" ;; + esac +done (( ${#files[@]} > 0 )) || fail "no wheel or sdist in $dist" for f in "${files[@]}"; do name=$(basename "$f") diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index ada165bb95..61a24bafc8 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -45,10 +45,19 @@ jobs: git tag --list - name: Build all distributions + id: build uses: ./.github/actions/build-python-packages with: tag: ${{ env.TAG }} + # The action's output is what release.yml hands to the install check, so it must be the + # tag's version. This fails if the action no longer runs the version check or no longer + # reports its result. + - name: The build reports the tag's version + run: | + echo "build output: '${{ steps.build.outputs.version }}', tag: '$TAG'" + test "${{ steps.build.outputs.version }}" = "${TAG#v}" + # Each wrong input must fail the version check. If one passes, the check no longer guards # the upload. - name: A wrong tag or a wrong file version must fail the check @@ -67,7 +76,10 @@ jobs: sdists=(dist/*.tar.gz) wrong_wheel=$(basename "${wheels[0]}" | sed 's/-99\.0\.0-/-99.0.1-/') wrong_sdist=$(basename "${sdists[0]}" | sed 's/-99\.0\.0\.tar/-99.0.1.tar/') - mkdir empty wheel-wrong sdist-wrong + four_wheel=$(basename "${wheels[0]}" | sed 's/-99\.0\.0-/-99.0.0.1-/') + four_sdist=$(basename "${sdists[0]}" | sed 's/-99\.0\.0\.tar/-99.0.0.1.tar/') + post_sdist=$(basename "${sdists[0]}" | sed 's/-99\.0\.0\.tar/-99.0.0.post1.tar/') + mkdir empty wheel-wrong sdist-wrong four post stray # One wrong file of a kind, beside a right file of the other kind. cp "${wheels[0]}" "wheel-wrong/$wrong_wheel" cp "${sdists[0]}" wheel-wrong/ @@ -76,6 +88,18 @@ jobs: fails .github/scripts/check-release-version.sh "$TAG" wheel-wrong fails .github/scripts/check-release-version.sh "$TAG" sdist-wrong fails .github/scripts/check-release-version.sh "$TAG" empty + # A version that merely starts with the tag's must fail. So must a tag that is not + # vX.Y.Z even when the files carry its version: hatch-vcs builds 99.0.0.1 from v99.0.0.1. + cp "${wheels[0]}" "post/${wheels[0]##*/}" + cp "${sdists[0]}" "post/$post_sdist" + fails .github/scripts/check-release-version.sh "$TAG" post + cp "${wheels[0]}" "four/$four_wheel" + cp "${sdists[0]}" "four/$four_sdist" + fails .github/scripts/check-release-version.sh v99.0.0.1 four + # `uv publish` uploads every file in dist, so a file that is no wheel or sdist must fail. + cp "${wheels[0]}" "${sdists[0]}" stray/ + touch stray/notes.zip + fails .github/scripts/check-release-version.sh "$TAG" stray # Metadata PyPI refuses, such as a long description that does not render. - name: Check the package metadata From 8884e081d575f5af287611fda6f87aba626db751 Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:46:26 +0100 Subject: [PATCH 4/5] AI-3561: the OIDC build job skips uv sync, uv build needs no dev environment (R1.5) Co-Authored-By: Claude Opus 5.5 --- .github/actions/build-python-packages/action.yml | 2 ++ .github/actions/python-uv-setup/action.yml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.github/actions/build-python-packages/action.yml b/.github/actions/build-python-packages/action.yml index 5336128902..c19ae5b33e 100644 --- a/.github/actions/build-python-packages/action.yml +++ b/.github/actions/build-python-packages/action.yml @@ -16,6 +16,8 @@ runs: - uses: ./.github/actions/python-uv-setup with: enable-cache: "false" + # `uv build` makes its own build environments and needs none of the dev dependencies. + sync: "false" - name: Clean dist directory shell: bash diff --git a/.github/actions/python-uv-setup/action.yml b/.github/actions/python-uv-setup/action.yml index 5bdd365dba..e8c12edd67 100644 --- a/.github/actions/python-uv-setup/action.yml +++ b/.github/actions/python-uv-setup/action.yml @@ -17,6 +17,10 @@ inputs: description: Restore and save uv's download cache; "false" in a job that holds an OIDC token required: false default: "true" + sync: + description: Run uv sync; "false" in a job that only builds, with `uv build`, and needs no environment + required: false + default: "true" cpu-torch: description: Install the CPU build of torch, without the CUDA packages its PyPI build needs on Linux required: false @@ -43,6 +47,7 @@ runs: echo "uv download cache hit: ${{ steps.setup_uv.outputs['cache-hit'] }}" - name: Install the project dependencies + if: inputs.sync == 'true' shell: bash working-directory: ${{ inputs.working-directory }} env: From 4015c708a71f83cf83a8dbebb062bf899a84d3a2 Mon Sep 17 00:00:00 2001 From: Kanat Date: Mon, 23 Nov 2026 16:46:26 +0100 Subject: [PATCH 5/5] AI-3561: release step 6 checks the build and install jobs, integration is not a gate (R1.2) Co-Authored-By: Claude Opus 5.5 --- .claude/skills/release/SKILL.md | 8 ++++++-- .github/workflows/release.yml | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.claude/skills/release/SKILL.md b/.claude/skills/release/SKILL.md index b777fae826..b21d9430d5 100644 --- a/.claude/skills/release/SKILL.md +++ b/.claude/skills/release/SKILL.md @@ -105,8 +105,12 @@ generated notes by using the `--notes` flag"). The CHANGELOG section is not copi ## 6. Check what was published -- `gh run list -R GetStream/Agents --workflow release.yml --limit 1` must show the new tag with - `success`. +- `gh run list -R GetStream/Agents --workflow release.yml --limit 1` shows the run of the new tag. + Do not read its conclusion: the `integration` job is in the same run and does not gate the + publish (a provider outage must not hold back a release), so a good publish can end `failure`. + `gh run view -R GetStream/Agents --json jobs --jq '.jobs[] | [.name, .conclusion]'` must + show `success` for `Build & Test Core SDK` (build, version check and upload) and for + `Verify PIP install works`. - `curl -s https://pypi.org/pypi/vision-agents/json | jq -r .info.version` must print `X.Y.Z`. `release.yml` has never succeeded: of its 41 runs, 34 ended `failure`, 3 `startup_failure`, 3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1102714a59..ab717b52a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,8 @@ jobs: if: startsWith(github.event.release.tag_name, 'v') runs-on: ubuntu-latest environment: pypi + # Not gated on `integration`, by decision: a provider outage must not hold back a release, so + # this run can end `failure` after a good publish. Check this job, not the run's conclusion. # The OIDC token is this job's alone, so the integration job, which holds every # provider secret, cannot mint one. permissions: