Two CI runs that push to one shared repo race, and the loser's push is rejected with "fetch first"
Symptom#
A review ran and posted its draft, but its file never reached the notes repo. The save step logged ! [rejected] trunk -> trunk (fetch first) and error: failed to push some refs. A later publish then failed with Error: no saved review for llnl-asr/dftracer#393; run review first.
Cause#
Two workflow runs for different PRs started three seconds apart. Both checked out the notes repo at the same commit. The first push won; the second was behind by one commit and git refused it. The job-level concurrency group was keyed per PR, so it did not serialize runs on different PRs.
Fix#
In the save step, commit, then loop up to five times: git push -q && break; git pull -q --rebase -X theirs; sleep. Files unique per run never conflict. A derived file that every run rewrites (the ledger) is committed and pushed separately, and its push failure is tolerated because the next run regenerates it. rsrobo .github/workflows/review.yml, commit e6309fb.
Evidence#
rsrobo runs 36963550906 (dftracer-utils#108, 04:12:49 UTC) and 36963553744 (dftracer#393, 04:12:52 UTC) on 2026-10-02. The second run's log shows the rejected push; the notes repo on GitHub has no reviews/llnl-asr/dftracer/393/. The retry is written but has not run live yet.
Also found by searching
- ! [rejected] trunk -> trunk (fetch first) in a workflow push
- no saved review for ... run review first after assess start
- two workflow runs push to the same repo and one loses
- how do I make parallel CI jobs push to one repository safely