Skip to content

fix(ci): branch release/X.Y.Z from post-freeze dev SHA - #618

Merged
c-vigo merged 1 commit into
devfrom
bugfix/617-prepare-release-branch-race
Jun 22, 2026
Merged

c-vigo merged 1 commit into
devfrom
bugfix/617-prepare-release-branch-race

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a read-after-write race in prepare-release that can create the
release/X.Y.Z branch at the pre-freeze dev SHA, so the release branch lacks
## [X.Y.Z] - TBD and the downstream Release workflow fails validation
(does not contain '## [X.Y.Z] - TBD'). Surfaced on the 0.3.8 release.

Type of Change

  • ci -- CI/CD pipeline changes (fix)

Root cause

Within a successful Prepare Release run, the "Create release branch from dev"
step re-reads dev's ref and branches from whatever it returns:

DEV_SHA=$(retry ... gh api ".../git/ref/heads/dev" --jq '.object.sha')

GitHub's REST ref read is not strongly consistent immediately after a write —
~1s after commit-action pushes the freeze, the read can still return the
pre-freeze SHA. retry only retries on failure, so a stale-but-successful
read passes through and the release branch is cut without the freeze. The failure
only surfaces two steps later in Release.

Evidence (run 27949666239): capture pre-prepare dev SHA a1e787c (11:34:42) →
commit freeze 0a9334d (11:34:44) → create branch re-read dev → a1e787c
(11:34:45) → release/0.3.8 cut at the pre-freeze SHA.

Changes

Poll dev until its SHA differs from the captured prepare_start_sha (with
backoff), and hard-fail if it never advances; branch from that confirmed
post-freeze SHA. Applied to both copies of the identical step:

  • .github/workflows/prepare-release.yml
  • assets/workspace/.github/workflows/prepare-release.yml

Changelog Entry

Fixed

  • Prevent prepare-release from branching release/X.Y.Z at the pre-freeze dev SHA (#617)
    • The "Create release branch from dev" step now polls dev until it advances past the captured pre-freeze SHA before branching, and hard-fails if it never does, closing a read-after-write race that could create a release branch missing the ## [X.Y.Z] - TBD freeze

Testing

  • pre-commit run passes (yamllint/shellcheck/generate-docs/etc.).
  • Logic traced against the failing 0.3.8 run; the guard would have looped until
    dev showed 0a9334d (or failed loudly) instead of branching at a1e787c.

Notes

Separate root cause from #612 (smoke-test dispatch idempotency) — this is the
devcontainer's own release branch-creation step. The already-stale release/0.3.8
still needs a one-off recovery (fast-forward to dev + re-run Release); this PR
prevents recurrence.

Refs: #617

The 'Create release branch from dev' step re-read dev's ref and trusted the
result. GitHub's REST ref read is not strongly consistent right after a write,
so ~1s after commit-action pushes the freeze the read can still return the
pre-freeze SHA; retry only retries on failure, so the stale-but-successful read
slipped through and release/X.Y.Z was branched without the freeze, failing
downstream release validation (missing '## [X.Y.Z] - TBD').

Poll dev until it advances past the captured pre-freeze SHA before branching,
and hard-fail if it never does. Applied to this repo's workflow and the synced
assets/workspace template.

Refs: #617
@c-vigo
c-vigo merged commit d70e8e1 into dev Jun 22, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/617-prepare-release-branch-race branch June 22, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant