Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ git worktree remove <scratch dir>
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
Expand All @@ -99,11 +105,19 @@ 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 <run id> -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
`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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Should fix] R1.2 Publishing is not gated on the integration job, and that is decided: provider suites being red must not block a release. But two things do not match this decision yet:

  • Step 6 of this skill (line 108) still says gh run list ... --workflow release.yml must show success. The integration job runs in the same workflow and has been red in every past run, so a release that published correctly ends failure.
  • The PR body still asks this as Question 1, and release.yml build-core (line 22) does not say that the missing needs: integration is deliberate.

Fix: step 6 checks the Build & Test Core SDK and Verify PIP install works jobs (gh run view <id> --json jobs) and says that the integration result is reported but does not gate. Add a one-line comment at build-core in release.yml. In the body, turn the question into the decision.

@kanat kanat Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 4015c70: skill step 6 now reads the jobs Build & Test Core SDK and Verify PIP install works via gh run view <id> --json jobs, says the run conclusion is not to be read and that integration is not a gate; release.yml has a comment at build-core; the PR body states the decision and Question 1 is removed.

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.
40 changes: 40 additions & 0 deletions .github/actions/build-python-packages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Nit] R1.5 This step runs a full uv sync --all-extras --dev --frozen (all extras, torch included) inside the job that holds id-token: write. uv build --all does not need it, because each build gets its own isolated env with the constrained backends. This was already there before the PR, so ticket: the job would install uv and Python only.

@kanat kanat Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8884e08: python-uv-setup gets a sync input (default true), the build action passes sync: "false". The dispatch run 45208993646 shows Install the project dependencies skipped and uv build --all plus the version check green (82 files at 99.0.0).

with:
enable-cache: "false"
# `uv build` makes its own build environments and needs none of the dev dependencies.
sync: "false"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Nit] S1.1 enable-cache: "false" and sync: "false" keep the OIDC job free of a restored cache and of the full dependency install. Nothing in release-check.yml asserts either one, so a later edit can flip them and every check stays green. Fix: after Build all distributions in release-check.yml, add test ! -e .venv (uv sync creates it, and setup-uv does not without activate-environment) and a check that this action still passes 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
5 changes: 5 additions & 0 deletions .github/actions/python-uv-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
49 changes: 49 additions & 0 deletions .github/scripts/check-release-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Fails unless the Python packages built in <dist-dir> all carry the version of the release tag.
#
# 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> [<dist-dir>] (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 <tag> [<dist-dir>]}
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}

# `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")
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
120 changes: 120 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
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
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Should fix] R1.1 Three mutants of the version guard survive this controls step, so the check can break and the Release check stays green:

  • check-release-version.sh:21 without the $: the tag v99.0.0rc1 or v99.0.0.1 passes the regex, and hatch-vcs builds exactly that version (probe: tag the commit v99.0.0rc1, uv build --package vision-agents --wheel gives vision_agents-99.0.0rc1-py3-none-any.whl; v99.0.0.1 gives 99.0.0.1). So a non-vX.Y.Z release would publish. The existing v99.0.0-rc1 row does not catch it, because the files in dist are at 99.0.0, so the file compare fails anyway.
  • :35 as a prefix match ([[ $version == "$want"* ]]): a file at 99.0.0.post1 passes.
  • The check step at build-python-packages/action.yml:32-38 removed, or its GITHUB_OUTPUT write at :40 removed: this job stays green, because the controls call the script directly and nothing reads the action's output. release.yml would then upload unchecked files, or test-core-index would install vision-agents==.

Rows to add (each one checked: it fails as expected on the head and passes under its mutant):
(a) a dir with one wheel and one sdist renamed to -99.0.0.1- / -99.0.0.1.tar.gz: fails .github/scripts/check-release-version.sh v99.0.0.1 <dir>
(b) a dir with a right wheel and an sdist renamed to 99.0.0.post1: fails .github/scripts/check-release-version.sh "$TAG" <dir>
(c) id: build on the build step at :47, and a step test "${{ steps.build.outputs.version }}" = "${TAG#v}".
The PR body calls the $ mutant equivalent. It is not, so update that line too.

@kanat kanat Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in f43a88a (rows) / 4015c70 head: release-check.yml now has row (a) fails ... v99.0.0.1 four (files renamed 99.0.0.1), row (b) fails ... "$TAG" post (right wheel + sdist 99.0.0.post1), and (c) id: build plus step test "${{ steps.build.outputs.version }}" = "${TAG#v}". Local mutations: M3 ($ dropped) killed by the four row, M10 (prefix compare) killed by the post row, simulated GITHUB_OUTPUT removal fails the (c) step. On GitHub, dispatch run https://github.com/GetStream/Agents/actions/runs/45208993646 is green (log: build output: '99.0.0', tag: 'v99.0.0'); with the action check step removed (throwaway branch, deleted) the job is red: https://github.com/GetStream/Agents/actions/runs/45209042497 (build output: '').

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)
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/')
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/
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
# 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
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
36 changes: 13 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,31 @@ 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:
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
Expand Down
Loading