Repository navigation
fix(smoke): bind the listener waits to the run they dispatched - #1485
Merged
Merged
Conversation
c-vigo
force-pushed
the
bugfix/1477-bind-wait-to-dispatched-run
branch
from
August 13, 2026 08:05
e594c99 to
37d89e1
Compare
c-vigo
force-pushed
the
bugfix/1477-bind-wait-to-dispatched-run
branch
from
August 13, 2026 08:20
37d89e1 to
a5238c4
Compare
This was referenced Aug 13, 2026
c-vigo
added a commit
to vig-os/devkit-smoke-test
that referenced
this pull request
Aug 13, 2026
## Description Hot-deploy of the dispatch-listener fix from [vig-os/devkit#1477](vig-os/devkit#1477) (devkit PR [#1485](vig-os/devkit#1485), merged to `dev` as `55a4190b`). `repository_dispatch` executes this workflow from **this repo's default branch**, so the upstream asset change does not take effect here until it is copied onto `main` by hand. Without this PR the fix ships in the next devkit release but never runs, and the defect fires again on the next **final**. ## The defect The three "trigger a workflow, then wait for it" sites (prepare-release, release, promote-release) accepted any run that was `completed` and newer than a pre-dispatch id baseline. The dispatched run takes a moment to appear in the API, so the first poll could return a **previous** run — already completed, still newer than a stale baseline — and the wait exited success having observed nothing. On the 1.8.0 final ([listener run 31603474367](https://github.com/vig-os/devkit-smoke-test/actions/runs/31603474367)) `Trigger and wait for release workflow` returned success **1.5 seconds** after starting, matching the rc4 release run from 47 minutes earlier. `trigger-promote-release` then fired against a repo that had no `1.8.0` release yet and failed with `ERROR: No GitHub Release for tag 1.8.0`, so the cross-repo gate reported a false negative — the worst failure mode for a gate. It is silent on candidates (promote is skipped for RCs), which is why it hid across rc1–rc4, and fires on **every** final. ## What changed - each trigger step stamps a `DISPATCH_TS` immediately **before** `gh workflow run` (backdated 60 s against runner/server clock skew); - the wait accepts a run only if `createdAt >= DISPATCH_TS` **and** `databaseId > BEFORE_RUN_ID` — both guards must hold; - capture and poll now use identical `--workflow` / `--branch` / `--event workflow_dispatch` filters, so the baseline describes the population being polled; - the oldest matching run is taken and **locked on**, so a later run cannot hijack the wait; its id and URL are logged and named in both terminal messages; - the loop can never exit success without a bound run — without one it polls to its timeout and fails loudly. ## Provenance The file this replaces was **byte-identical** to devkit's pre-fix asset at `4ec1c803`, and the new content is **byte-identical** to the asset on devkit `dev`. Exactly one upstream commit (`a5238c4f`) touched that asset in the range, so this diff is precisely the upstream change — no local drift in either direction. `actionlint` is clean on the result. ## Testing - [x] `actionlint .github/workflows/repository-dispatch.yml` -> exit 0 - [x] Upstream: 25 tests in `tests/test_smoke_dispatch_wait.py`, which execute each wait step's real bash against a stubbed `gh` modelling the API visibility lag and replay the 1.8.0 timeline. The pre-fix bash exits 0 on the stale run; the fixed bash keeps waiting and binds to the correct run. Live proof is the next **final** release dispatch — this workflow only runs on `repository_dispatch` from devkit. Refs: [#1477](vig-os/devkit#1477)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The smoke listener's "trigger a workflow, then wait for it" pattern could match a
stale, unrelated run and report success without the dispatched run having
started. On the 1.8.0 final it made
Trigger and wait for release workflowreturnsuccess in 1.5 seconds — matching rc4's release run from 47 minutes earlier —
and promote-release was then fired against a repo that had no
1.8.0release yet.Silent on candidates (promote is skipped for RCs, so the defect hid across
rc1–rc4); fires on every final. The cross-repo gate then reports a false
negative, which is the worst failure mode for a gate.
Type of Change
fix-- Bug fixChanges Made
The old guard assumed the newest run on
${WORKFLOW_REF}at capture time was thenewest the poll would ever see other than the dispatched one. It is not: the
dispatched run needs a moment to appear in the API, and if the first poll lands in
that window,
--limit 1returns a previous, already-completedrun that is stillnewer than a stale baseline.
All three call sites (prepare-release, release, promote-release) are fixed
identically and kept textually in lockstep:
DISPATCH_TSimmediately beforegh workflow run;createdAt >= DISPATCH_TSanddatabaseId > BEFORE_RUN_ID— both guards must hold;--workflow/--branch/--event workflow_dispatchfilters, so the baseline describes the populationbeing polled;
and the id is locked on, so a later run cannot hijack the wait;
failure and now says no matching run was ever observed;
DISPATCH_TSis backdated 60 s: the stamp comes from the runner's clock and iscompared against a server-side
createdAt, so skew in the wrong direction wouldfilter the dispatched run out of its own wait and turn every release into a
timeout. 60 s is ~47x smaller than the gap to the stale run that actually bit.
Two pre-existing bats tests asserted the defective guard verbatim, so they were
retargeted at the new shape (one now asserts the old guard is absent). Net test
count unchanged: 505 before, 505 after.
Changelog Entry
(full entry with sub-bullets is in
CHANGELOG.md)Testing
uv run pytest tests/test_smoke_dispatch_wait.py-> 24 failed / 1 passed before, 25 passed afteruv run pytest tests/(minus image/integration) -> 683 passed, identical before and after the bats editjust test-bats-> 505 ok, 0 not okactionlinton the modified workflow -> exit 0zizmor --offline-> identical finding profile before and after (61/48 suppressed, all pre-existing)prek run --all-files-> onlycheck-expirationsfails;.vulnixignoreis byte-identical todevon this branch. Fixed by fix(security): renew the glibc exception block to 2026-09-02 #1482 — merge that first.Manual Testing Details
The new test module is not only shape assertions: it executes each wait step's real
bash against a stubbed
ghthat models the API visibility lag, replaying the 1.8.0timeline.
test_stale_completed_run_is_never_acceptedruns the pre-fix bashagainst those exact numbers and gets
exit 0+ "completed successfully"; the fixedbash keeps waiting and binds to run
31604068811once it appears.Important
The listener executes from
devkit-smoke-test's DEFAULT branch. Merging thisdoes not deploy it. It needs a manual redeploy to smoke-test
mainbefore the nextfinal, or the fix ships without ever running and #1477 fires again. Precedents for
that hotfix path: smoke-test#345, #353.
Closes #1477, closes #1475
Refs: #1477