Skip to content

fix(ci): stop sync-develop.yml from racing itself into duplicate PRs - #418

Merged
neuromechanist merged 3 commits into
developfrom
fix/sync-develop-double-trigger
Sep 19, 2026
Merged

neuromechanist merged 3 commits into
developfrom
fix/sync-develop-double-trigger

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Closes #417. tag-release.yml fires twice per release (once on the release PR's merge commit to main, still .dev-suffixed and a no-op; once on ensure-stable-version.yml's strip commit, which actually tags). Both completions trigger sync-develop.yml, and its only existing guard (check for an open PR by branch name) has a race window: the first run can merge and close its PR before the second run's check even executes, so the second run creates a fresh branch/PR instead of finding one to reuse. This produced two competing PRs on both the 09-17 and v0.8.10 (09-19) releases - the second one always ends up CONFLICTING.

  • concurrency: group: sync-develop serializes the two triggered runs so the second only starts after the first fully finishes.
  • A ground-truth git merge-base --is-ancestor origin/main origin/develop check, re-fetching develop fresh at that point, added to the existing "Fetch main and validate version" step. Once serialized, the second run's fresh fetch correctly sees the sync already happened and exits cleanly.

Test plan

  • YAML validated (python3 -c "import yaml; yaml.safe_load(...)")
  • Extracted and shellchecked every run: block - no new findings (the one pre-existing SC2296 hit is a false positive on GH Actions' ${{ }} template syntax in an untouched step)
  • Not exercised against a live two-trigger release yet (can't simulate workflow_run locally) - the next real release will be the first live test; the logic traces cleanly either way (concurrency alone would already prevent the race, and the ancestry check is a second, independent line of defense if concurrency behaves unexpectedly)

Tag and Release fires twice per release (issue #417): once for the release
PR's merge commit into main (still .dev-suffixed, so it no-ops but still
reports success), and once for ensure-stable-version.yml's strip commit
that actually creates the tag. Both trigger this workflow via workflow_run,
and its only existing guard (check for an open PR with the sync branch
name) races: the first run can merge and close its PR before the second
run's check even runs, so the second run creates a fresh branch/PR instead
of finding nothing to reuse - producing two competing PRs (#415, #416 on
the v0.8.10 release; same pattern on the prior 09-17 release too).

Adds two layers:
- concurrency: group: sync-develop serializes the two triggered runs
  instead of letting them race, so the second only starts once the first
  has fully finished.
- A ground-truth ancestry check (git merge-base --is-ancestor origin/main
  origin/develop) added to "Fetch main and validate version", re-fetching
  develop fresh at that point rather than trusting the earlier checkout.
  Once the first run's serialized, the second run's fresh fetch correctly
  sees main is already merged and exits cleanly - no PR, no branch push.
Same root cause as the sync-develop.yml fix (issue #417): two commits touch
main within seconds during every release, so this fires twice, sending the
documentation repo two osa-updated dispatches for what's semantically one
release. Unlike sync-develop.yml, this job has no stateful git work to
protect - it's a single idempotent repository_dispatch call - so
cancel-in-progress: true is the right choice: a stale in-flight dispatch
for an older commit gets cancelled when a newer push arrives, and only the
latest commit's notification actually goes out.
Review of the previous commit found a real gap: the ancestry check
re-fetches origin/develop fresh, but the merge step right after it still
operated on the local develop branch checked out several steps earlier
(before Python/uv setup and git-identity config ran) - never re-pointed at
that fresh fetch. So the check and the merge could observe two different
states of develop if any commit landed on it in that window, undermining
the freshness the previous commit's comment claimed. `git reset --hard
origin/develop` right before the merge closes that gap: the merge now
always operates on exactly what the ancestry check just validated.
@neuromechanist
neuromechanist merged commit bd95912 into develop Sep 19, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the fix/sync-develop-double-trigger branch September 19, 2026 21:23
neuromechanist added a commit that referenced this pull request Sep 30, 2026
The file had sections for 0.8.10, 0.8.12, 0.8.14 and 0.8.15 only. The
three missing releases are written from the pull requests between their
tags (0.8.13: #438, #440, #441, #443; 0.8.11: #418; 0.8.9: #351 to #355
and #359 and #367), so the last seven releases are now all present.

Tested: docs only; each entry checked against its pull request's body.
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