From 7be660813d6fb3b5bd43ee02436ebf084f1b4231 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:09:09 -0700 Subject: [PATCH] ci(staging): do not post staging-smoke for a run that was cancelled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The status step ran under `always()`, so a run superseded by cancel-in-progress reached it with job.status=cancelled, skipped the smoke block, and posted the default STATE=failure for a SHA it never deployed. Both cancelled runs at 820b4938c did exactly that before cac4d6570 deployed. Two guards, one invariant. The step condition becomes `!cancelled()`, which is already the idiom in deploy-dev, and the script returns early when job.status is cancelled — that second one covers a job cancelled while the run is not, where cancelled() is false. Posting nothing is the safe direction: the promote path requires staging-smoke=success, so an absent status blocks promotion exactly like a red one without claiming a smoke ran and failed. Fixes #2460 Co-Authored-By: Claude Opus 5 Co-authored-by: nova Agent-Model: claude/claude-opus-5/high --- .github/workflows/deploy-staging.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index be270ccb2b..ed61c939ad 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -193,8 +193,13 @@ jobs: # non-failing notice — this sets a commit status that must be truthful, and # a failed smoke fails the staging deploy. A reachability probe is the # fallback until the stranger-journey CronJob exists in the staging release. + # `!cancelled()` rather than `always()`: a run superseded by cancel-in-progress + # reaches this step with job.status=cancelled, skips the smoke block below, and + # posts the default STATE=failure — a staging-smoke=failure on a SHA that was + # never deployed (observed 2026-10-23: runs 39897767827 and 39897776573 both + # posted one for 820b4938c before cac4d6570 actually deployed). - name: Stranger smoke + staging-smoke commit status - if: always() + if: ${{ !cancelled() }} env: TAG: ${{ steps.tag.outputs.tag }} SHA: ${{ steps.tag.outputs.sha }} @@ -202,6 +207,16 @@ jobs: GH_TOKEN: ${{ github.token }} run: | set -uo pipefail + # A cancelled job deployed nothing, so it has nothing truthful to say about + # this SHA. The step condition already skips a cancelled RUN; this covers a + # job cancelled while the run is not, where cancelled() is false and + # job.status is already 'cancelled'. Posting NOTHING is the correct outcome: + # the promote path requires staging-smoke=success, so an absent status blocks + # promotion exactly like a red one, without claiming the smoke ran and failed. + if [ "${JOB_STATUS:-}" = "cancelled" ]; then + echo "job cancelled; leaving staging-smoke unset for $SHA ($TAG)" + exit 0 + fi STATE=failure DESC="staging deploy + stranger smoke ($TAG)" if [ "$JOB_STATUS" = "success" ]; then