fix(pr): enforce serial merge order in PR completion queue#339
Merged
Conversation
PRs must be merged into the base branch one at a time in DAG order. Merging in parallel causes cascading conflicts since each merge changes main and all subsequent PRs need the updated state. Force completion queue concurrency to 1 and remove the configurable concurrency parameter — serial execution is always required for correctness.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #339 +/- ##
==========================================
- Coverage 93.23% 93.23% -0.01%
==========================================
Files 193 193
Lines 19573 19571 -2
Branches 3087 3086 -1
==========================================
- Hits 18249 18247 -2
Misses 1290 1290
Partials 34 34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When cadre resumes with multiple existing open PRs (e.g., Wave 0: #16, #18, #19, #22), they all attempt to merge into main in parallel. Since each merge changes main, all the other concurrent PRs immediately conflict with the updated base — even after conflict resolution, the retry sees stale dirty state from the other parallel merges.
Root Cause
The completion queue used
p-limit(maxParallelIssues)(typically 8), allowing multiple PRs to merge concurrently. But merging into a shared base branch is inherently sequential: each merge changes the base, and the next PR must see that updated state.Fix
p-limit(1)) — this is always correct for merging into a shared base branchconcurrencyconstructor parameter since it should always be 1ensureExecution(), now they also respect the implicit ordering that merging into main requires