Skip to content

fix(pr): enforce serial merge order in PR completion queue#339

Merged
jafreck merged 1 commit intomainfrom
fix/serial-completion-queue-merge
Mar 4, 2026
Merged

fix(pr): enforce serial merge order in PR completion queue#339
jafreck merged 1 commit intomainfrom
fix/serial-completion-queue-merge

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Mar 4, 2026

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

  • Force completion queue to serial execution (p-limit(1)) — this is always correct for merging into a shared base branch
  • Remove the configurable concurrency constructor parameter since it should always be 1
  • PRs still respect DAG dependency ordering via ensureExecution(), now they also respect the implicit ordering that merging into main requires

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.
@jafreck jafreck merged commit 730ed0b into main Mar 4, 2026
2 checks passed
@jafreck jafreck deleted the fix/serial-completion-queue-merge branch March 4, 2026 00:30
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (444eb3c) to head (2e7f853).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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