From 47c4fcaa3daa2aa8890d2e124677006662c974c1 Mon Sep 17 00:00:00 2001 From: San Date: Wed, 11 Nov 2026 04:30:40 -0800 Subject: [PATCH 1/4] ci(publish): a Slack post that fails shows on the run, without failing the release The awaiting-tap and failure posts used curl -sS ... || true, so a revoked webhook (403/404) or Slack being unreachable read as success. They now use curl -fsS: a post Slack refuses or never answers fails its step with an error annotation, and continue-on-error on that step keeps it from failing the release. An unset secret still logs a warning and passes. --- .github/workflows/publish.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 55d48d2..a76a244 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -220,7 +220,9 @@ jobs: # awaiting-tap: fires after build succeeds, while the environment-gated # publish job sits waiting for the human approval — so the tap request # lives in Slack, not email. failure: any red job in the pipeline. - # Both fail-safe: absent secret → logged warning, exit 0. + # Both fail-safe: absent secret → logged warning, exit 0. A post Slack + # refuses (a revoked webhook) or never answers fails its step, so the run + # shows it; continue-on-error keeps that from failing the release. notify-awaiting-tap: runs-on: ubuntu-24.04 needs: build @@ -229,12 +231,16 @@ jobs: (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'prod') steps: - name: Post to Slack + continue-on-error: true env: WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WARNING }} TEXT: ":hourglass_flowing_sand: *agentchatme (PyPI) release awaiting your approval* (`${{ github.ref_name }}` → pypi gate). Tap it here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" run: | if [ -z "$WEBHOOK" ]; then echo "::warning::SLACK_WEBHOOK_WARNING not set — skipped"; exit 0; fi - printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -sS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK" || true + if ! printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -fsS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK"; then + echo "::error::the Slack post failed (webhook revoked, or Slack unreachable)" + exit 1 + fi notify-failure: runs-on: ubuntu-24.04 @@ -242,9 +248,13 @@ jobs: if: failure() steps: - name: Post to Slack + continue-on-error: true env: WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WARNING }} TEXT: ":warning: *agentchatme (PyPI) publish pipeline failed* on `${{ github.ref_name }}` — ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" run: | if [ -z "$WEBHOOK" ]; then echo "::warning::SLACK_WEBHOOK_WARNING not set — skipped"; exit 0; fi - printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -sS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK" || true + if ! printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -fsS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK"; then + echo "::error::the Slack post failed (webhook revoked, or Slack unreachable)" + exit 1 + fi From 00805835a526b79a19bcd59d6a0e2dd32aca0613 Mon Sep 17 00:00:00 2001 From: San Date: Wed, 11 Nov 2026 04:33:10 -0800 Subject: [PATCH 2/4] ci(publish): pipefail in the Slack steps, so a payload that never built fails the step too; the comment says what a failed post looks like --- .github/workflows/publish.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a76a244..008257a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -221,8 +221,9 @@ jobs: # publish job sits waiting for the human approval — so the tap request # lives in Slack, not email. failure: any red job in the pipeline. # Both fail-safe: absent secret → logged warning, exit 0. A post Slack - # refuses (a revoked webhook) or never answers fails its step, so the run - # shows it; continue-on-error keeps that from failing the release. + # refuses (a revoked webhook) or never answers fails its step: a failed + # step and an error annotation on the run. continue-on-error keeps the job + # and the run green, so a notification never fails the release. notify-awaiting-tap: runs-on: ubuntu-24.04 needs: build @@ -236,6 +237,7 @@ jobs: WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WARNING }} TEXT: ":hourglass_flowing_sand: *agentchatme (PyPI) release awaiting your approval* (`${{ github.ref_name }}` → pypi gate). Tap it here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" run: | + set -o pipefail if [ -z "$WEBHOOK" ]; then echo "::warning::SLACK_WEBHOOK_WARNING not set — skipped"; exit 0; fi if ! printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -fsS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK"; then echo "::error::the Slack post failed (webhook revoked, or Slack unreachable)" @@ -253,6 +255,7 @@ jobs: WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WARNING }} TEXT: ":warning: *agentchatme (PyPI) publish pipeline failed* on `${{ github.ref_name }}` — ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" run: | + set -o pipefail if [ -z "$WEBHOOK" ]; then echo "::warning::SLACK_WEBHOOK_WARNING not set — skipped"; exit 0; fi if ! printf '%s' "$TEXT" | jq -Rs '{text: .}' | curl -fsS -o /dev/null --max-time 15 -H 'Content-Type: application/json' -d @- "$WEBHOOK"; then echo "::error::the Slack post failed (webhook revoked, or Slack unreachable)" From 657fa0b80091bf81ec1aba523641691bd0b674ad Mon Sep 17 00:00:00 2001 From: San Date: Wed, 11 Nov 2026 04:43:46 -0800 Subject: [PATCH 3/4] ci(publish): verify refuses a tag that origin no longer points at the commit (deleting a tag starts a push run too) --- .github/workflows/publish.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 008257a..1eb9c6a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,9 @@ name: Publish to PyPI # 1. Push a tag matching `v*` (e.g. `v1.0.2`) on a commit on `main` → # publishes to PyPI. The `verify` job refuses the release unless the # tag is exactly `v` + the version in BOTH `pyproject.toml` and -# `src/agentchatme/_version.py`, and the tagged commit is on `main`. +# `src/agentchatme/_version.py`, the tagged commit is on `main`, and +# the tag still points at it on origin (deleting a tag starts a run +# too). # # 2. Manual `workflow_dispatch` with `target=test` → uploads to TestPyPI # for a dry-run install. Use before the first real publish, or whenever @@ -79,6 +81,15 @@ jobs: exit 1 fi fi + # The tag as origin has it now. Deleting a tag starts a run too (on + # main's head), and a moved tag points elsewhere: both refused. + if [ "$EVENT" = "push" ]; then + if ! git fetch -q --no-tags origin "+refs/tags/$GITHUB_REF_NAME:refs/verify/tag" 2>/dev/null \ + || [ "$(git rev-parse 'refs/verify/tag^{commit}')" != "$GITHUB_SHA" ]; then + echo "::error::tag $GITHUB_REF_NAME on origin does not point at $GITHUB_SHA (deleted or moved); a release publishes the commit its tag points at" + exit 1 + fi + fi # Re-run the full check matrix on the tagged commit. Don't trust prior # CI status — someone could tag a feature branch directly. test: @@ -220,10 +231,10 @@ jobs: # awaiting-tap: fires after build succeeds, while the environment-gated # publish job sits waiting for the human approval — so the tap request # lives in Slack, not email. failure: any red job in the pipeline. - # Both fail-safe: absent secret → logged warning, exit 0. A post Slack - # refuses (a revoked webhook) or never answers fails its step: a failed - # step and an error annotation on the run. continue-on-error keeps the job - # and the run green, so a notification never fails the release. + # Both fail-safe: absent secret → logged warning, exit 0. A post that + # Slack refuses (a revoked webhook) or never answers fails its step, with + # an error annotation on the run; continue-on-error keeps the job and the + # run green. No publish job depends on a notify job. notify-awaiting-tap: runs-on: ubuntu-24.04 needs: build From dbac017d8b9bd3ce44155114af8d8a3d08d9a852 Mon Sep 17 00:00:00 2001 From: San Date: Wed, 11 Nov 2026 04:48:20 -0800 Subject: [PATCH 4/4] ci(publish): the tag refusal says what git saw (missing or pointing elsewhere) --- .github/workflows/publish.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1eb9c6a..3da5950 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,8 +6,8 @@ name: Publish to PyPI # publishes to PyPI. The `verify` job refuses the release unless the # tag is exactly `v` + the version in BOTH `pyproject.toml` and # `src/agentchatme/_version.py`, the tagged commit is on `main`, and -# the tag still points at it on origin (deleting a tag starts a run -# too). +# the tag still points at it on origin (a tag deletion can start a +# run too, on `main`'s head). # # 2. Manual `workflow_dispatch` with `target=test` → uploads to TestPyPI # for a dry-run install. Use before the first real publish, or whenever @@ -81,12 +81,14 @@ jobs: exit 1 fi fi - # The tag as origin has it now. Deleting a tag starts a run too (on - # main's head), and a moved tag points elsewhere: both refused. + # The tag as origin has it now: a deleted or moved tag is refused + # (a tag deletion can start a run, on main's head). if [ "$EVENT" = "push" ]; then - if ! git fetch -q --no-tags origin "+refs/tags/$GITHUB_REF_NAME:refs/verify/tag" 2>/dev/null \ - || [ "$(git rev-parse 'refs/verify/tag^{commit}')" != "$GITHUB_SHA" ]; then - echo "::error::tag $GITHUB_REF_NAME on origin does not point at $GITHUB_SHA (deleted or moved); a release publishes the commit its tag points at" + if ! fetched="$(git fetch -q --no-tags origin "+refs/tags/$GITHUB_REF_NAME:refs/verify/tag" 2>&1)"; then + echo "::error::tag $GITHUB_REF_NAME is not on origin (deleted): ${fetched//$'\n'/ }" + exit 1 + elif [ "$(git rev-parse 'refs/verify/tag^{commit}')" != "$GITHUB_SHA" ]; then + echo "::error::tag $GITHUB_REF_NAME on origin points at $(git rev-parse 'refs/verify/tag^{commit}'), not $GITHUB_SHA (moved); a release publishes the commit its tag points at" exit 1 fi fi