Skip to content

fix(ci): auto-sync concurrency + cleanup follow-ups - #2210

Merged
hongmingwang-moleculeai merged 1 commit into
stagingfrom
fix/auto-sync-concurrency-and-cleanup
Apr 28, 2026
Merged

fix(ci): auto-sync concurrency + cleanup follow-ups#2210
hongmingwang-moleculeai merged 1 commit into
stagingfrom
fix/auto-sync-concurrency-and-cleanup

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Self-review follow-ups for #2209. Three small fixes:

  1. Required: concurrency group. Two pushes to main in rapid succession would otherwise race two auto-sync runs; second push fails non-fast-forward and lights up CI red. Adds:
    ```yaml
    concurrency:
    group: auto-sync-main-to-staging
    cancel-in-progress: false
    ```

  2. Hygiene: `git merge --abort` on conflict. Leaves the work tree clean before exiting 1 — easier debugging if anyone shells into the runner.

  3. Doc accuracy: "Loop safety" comment. Updated to reflect the actual mechanism — `GITHUB_TOKEN`-authored pushes don't trigger downstream workflows, so the loop is impossible by construction.

Plus a step-name nit: "Fast-forward staging → main" → "Fast-forward staging to main" (workflow direction is main → staging; step name was misleading).

🤖 Generated with Claude Code

Three small fixes from the self-review of #2209:

1. **Required: concurrency group.** Two pushes to main in quick
   succession (manual UI merge then auto-promote-staging's ff-push,
   or any back-to-back main pushes) would race two auto-sync runs
   against the same staging branch — second `git push origin staging`
   fails non-fast-forward, surfacing as a red CI alert for what should
   be a no-op. Add `concurrency: { group: auto-sync-main-to-staging,
   cancel-in-progress: false }` so the second run waits for the first
   and sees its result.

2. **Hygiene: `git merge --abort` on conflict.** The conflict-error
   path exits 1 with the work tree in a half-merged state. Doesn't
   affect future runs (each gets a fresh checkout) but is an
   unpleasant artifact for anyone who shells into the runner. Abort
   first, then exit.

3. **Doc accuracy: "Loop safety" comment.** The original said the
   chain terminates because "main is either a no-op or advances
   further." That's true but understates the actual safety: GitHub
   Actions explicitly does NOT trigger downstream workflow runs from
   `GITHUB_TOKEN`-authored pushes. So the loop is impossible by
   construction, not just by happy coincidence of ref state. Updated
   the comment to reflect the actual mechanism.

Plus a step-name nit: "Fast-forward staging → main" reads as if main
is the target. Renamed to "Fast-forward staging to main" for
consistency with the workflow's name (main → staging).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged via the queue into staging with commit 81634e0 Apr 28, 2026
21 checks passed
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