Repository navigation
fix(smoke): reclaim deploy PRs by branch so a partial create stays recoverable - #1505
Merged
Merged
Conversation
c-vigo
enabled auto-merge
August 14, 2026 07:33
c-vigo
added a commit
to vig-os/devkit-smoke-test
that referenced
this pull request
Aug 14, 2026
…erable (#373) Hot-deploy of the listener fix from [vig-os/devkit#1505](vig-os/devkit#1505) directly to `main`, since the `repository_dispatch` listener executes from this repo's **default branch** — a fix that only rides the normal deploy path (next train's deploy PR to `dev`, then release to `main`) would not protect the very trains that fail. ## What it fixes On the 1.9.0 rc1 train the `deploy` job failed on a transient GraphQL 500 reading **`pull request update failed`** — *update*, not *create*. `gh pr create --label` creates the PR and labels it in a **second** mutation: the create had succeeded ([#367](#367) existed), the labelling is what 500'd, and the step exited 1. So `pr_url` never reached `GITHUB_OUTPUT` (every downstream job skipped) and an **unlabelled** deploy PR was left open — invisible to a `Close stale deploy PRs` that selected on `--label deploy` alone. Re-running the failed jobs then deadlocked on *"a pull request already exists"* until the label was added by hand. ## Changes 1. Stale deploy PRs are reclaimed by **head branch** (`chore/deploy-*`) as well as by label. The branch name is deterministic and pushed before the PR exists, so no partial failure can lose it. 2. `Create or adopt deploy PR` adopts an open PR already on the deploy branch instead of failing on it, and records `pr_url` before anything else can fail. 3. Labelling moved to its own step: three attempts with backoff, non-fatal (the cleanup reclaims by branch, so an unlabelled PR stays recoverable). 4. `notify-failure` retries `gh issue create` — it died to the same transient 20 s later, so no upstream incident issue was filed at all and vig-os/devkit#1499 had to be written by hand. ## Provenance The file is a byte-exact copy of the fixed devkit asset (`assets/smoke-test/.github/workflows/repository-dispatch.yml` on vig-os/devkit#1505), so the next scaffold deploy converges rather than reverts. Before this change the live listener on `main` was byte-identical to the devkit asset, so this PR carries only that fix — the same 72/15 diff. `dev` is intentionally **not** patched: the next train's deploy PR carries the fixed asset from the devkit release tag and converges `dev` with identical content. Tested upstream by `tests/test_smoke_deploy_pr_reclaim.py` (12 tests), which executes these steps' real bash against a stubbed `gh` — including the rc1 replay: an unlabelled deploy PR gets closed, and a labelling failure leaves `pr_url` recorded and the job green. Refs: [#1499](vig-os/devkit#1499)
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
On the 1.9.0 rc1 train the smoke listener's
deployjob failed on a transient GraphQL 500 whose wording waspull request update failed— update, not create.gh pr create --labelcreates the PR and then labels it in a second mutation: the create had succeeded (devkit-smoke-test#367 existed), the labelling is what 500'd, and the step exited 1.Two consequences:
pr_urlnever reachedGITHUB_OUTPUT, so every downstream job skipped; and an unlabelled deploy PR was left open.Close stale deploy PRsselected candidates with--label deployonly, so that orphan was invisible to it — the documented recovery (re-run the failed jobs) re-entered the create and failed with "a pull request already exists" until a human added the label by hand.The structural point: the one step whose partial success is most likely was the one the cleanup could not reclaim.
Type of Change
fix-- Bug fixModifiers
!) -- This change breaks backward compatibilityChanges Made
All in
assets/smoke-test/.github/workflows/repository-dispatch.yml(the SSoT for the listener):Close stale deploy PRsnow selects every open PR onchore/deploy-*as well as any carrying thedeploylabel (onegh pr list --json number,headRefName,labels --limit 100call). The branch name is deterministic and is pushed before the PR exists, so unlike the label it cannot be lost to a partial failure.Create or adopt deploy PRfirst looks for an open PR on${BRANCH_NAME}and adopts it instead of dying on "already exists", and writespr_urltoGITHUB_OUTPUTimmediately — before anything else can fail.Label deploy PRretriesgh pr edit --add-label deploythree times with backoff and is non-fatal: now that the cleanup reclaims by branch, an unlabelled PR is still recoverable, so a label transient must not strandpr_url.notify-failureretries. The same transient class killed itsgh issue create20 s later, so no upstream incident issue was filed at all and [BUG] A partially-created deploy PR is invisible to the smoke listener's stale-PR cleanup, so re-run recovery fails #1499 had to be written by hand. It now retries three times and fails loudly if the issue never lands.Changelog Entry
Testing
New suite
tests/test_smoke_deploy_pr_reclaim.py(12 tests), following the harness pattern established by #1477'stests/test_smoke_dispatch_wait.py:headRefNameand the label; the create step no longer passes--label;pr_urlis recorded before a separate label step that consumes it; the label step contains noexit 1; notify retries.gh(and a no-opsleep), replaying the rc1 timeline.--jqfilters run through the realjq, so the selector under test is the one that runs:chore/deploy-1-9-0-rc1is closed, a labelled legacy deploy PR is still closed, an unrelatedfeature/*PR is never touchedpr_urlstill reachesGITHUB_OUTPUTand the job stays greengh pr createis never called and the adopted url is recordedgh pr editcalls, exit 0gh issue createcalls; exhausted retries fail the stepManual Testing Details
Run locally in a worktree:
prek run --all-files— full hook suite green (includesyamllint,shellcheck,actionlint,typos,sync-manifest)uv run pytest tests --ignore=tests/test_image.py --ignore=tests/test_integration.py --ignore=tests/test_flake_checks.py— 740 passed, 1 skipped (container/image andnix flake checksuites are CI-only; they need the built image)bats tests/bats/just.bats— 57 passed, including the existing smoke-listener contract assertionsactionlint assets/smoke-test/.github/workflows/repository-dispatch.yml— clean (the hook only auto-discovers this repo's own.github/workflows/, so the asset was linted explicitly)Checklist
CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
This PR does not make the fix live.
repository_dispatchalways runs the listener from the smoke-test repo's default branch, so the asset here reachesdevkit-smoke-testmainonly through that repo's own release cycle (docs/CROSS_REPO_RELEASE_GATE.md§Contract dependencies). A mirror hotfix ondevkit-smoke-testmainfollows this merge, so the next train is covered and the next scaffold deploy converges rather than reverts — same dance as devkit-smoke-test#345 / #353.docs/CROSS_REPO_RELEASE_GATE.mdgains the reclaim invariant plus a Failure Signals entry forpull request update failed, including what to do on a listener version that predates this fix (add the label by hand before re-running).Refs: #1499