Skip to content

DEVEX-780: fix race condition in php-common-bump workflow#103

Merged
pdodgen-revparts merged 1 commit intomainfrom
DEVEX-780-fix-common-bump-race-condition
Feb 27, 2026
Merged

DEVEX-780: fix race condition in php-common-bump workflow#103
pdodgen-revparts merged 1 commit intomainfrom
DEVEX-780-fix-common-bump-race-condition

Conversation

@pdodgen-revparts
Copy link
Contributor

Description

Fix race condition in php-common-bump.yaml that causes workflow failures when main branch moves during execution.

Jira Issue: https://revolutionparts.atlassian.net/browse/DEVEX-780

Background

The upgrade-common workflow in downstream repos (like batch) was consistently failing with errors like:

! [remote rejected] main -> main (cannot lock ref 'refs/heads/main': is at <sha1> but expected <sha2>)

Root cause: The workflow does a simple git push origin main which fails if another commit lands on main between checkout and push (typically ~1 minute window). This happens frequently when:

  • Multiple PRs merge to main in quick succession
  • Each merge triggers an upgrade-common workflow
  • The workflows race to push their common bump commits

Fix: Added fetch + rebase before pushing, with retry logic (up to 5 attempts) to handle concurrent pushes.

Testing Information

  • Verified the shell script logic handles:
    • No changes case (exits early without push)
    • Successful push on first attempt
    • Retry on push failure after rebase
    • Rebase conflict handling (abort and retry)
  • The fix follows the same retry pattern already used in the workflow for composer install and composer require

The php-common-bump workflow was failing when main moved during execution.
This adds fetch + rebase before pushing with retry logic to handle concurrent
pushes to main.
@pdodgen-revparts pdodgen-revparts marked this pull request as ready for review February 23, 2026 22:59
@pdodgen-revparts pdodgen-revparts requested a review from a team as a code owner February 23, 2026 22:59
@cursor
Copy link

cursor bot commented Feb 23, 2026

PR Summary

Low Risk
CI-only workflow scripting change with limited blast radius; main risk is unexpected rebase/push behavior causing workflow failures or repeated retries.

Overview
Hardens the php-common-bump.yaml workflow against concurrent updates to main.

The commit step now exits early when there are no changes (still emitting the current SHA), and replaces the direct git push with a fetch+rebase loop that retries up to 5 times and aborts/recovers from failed rebases before retrying.

Written by Cursor Bugbot for commit 076d0ad. This will update automatically on new commits. Configure here.

Copy link
Contributor

@aspencer aspencer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount of logic in this github workflow made me raise my eyebrow. Makes me wonder if there's some sort of way to test these things.

But... I guess it's fine?

@pdodgen-revparts pdodgen-revparts merged commit 56af105 into main Feb 27, 2026
2 checks passed
@pdodgen-revparts pdodgen-revparts deleted the DEVEX-780-fix-common-bump-race-condition branch February 27, 2026 16:47
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.

2 participants