Repository navigation
Conversation
Merge one PR at a time per target branch. A merge command issued while another merge is in progress on the same target branch is queued (label "bot merge queued") and starts when that merge finishes, whether it succeeds or fails, instead of preparing a branch whose tests will have to run again once the first merge lands. A merge holds the queue while its merge bot branch exists, its PR is open with the "bot is merging" label, and the branch is more recent than MERGE_BOT_QUEUE_TIMEOUT hours (default 12), so branches left behind by failed merges do not block the queue. A periodic task restarts queues that nothing restarted. The queue can be disabled with the merge_bot_queue switch. When the final push is rejected because the target branch moved in the meantime (fetch first, cannot lock ref), retry the merge instead of failing.
mileo
marked this pull request as ready for review
November 27, 2026 21:51
Member
Author
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.
Summary
When several
/ocabot mergecommands are issued on the same target branch, each one prepares a merge bot branch from the same tip and runs the CI in parallel. Only the first can land. Every other one is prepared again on the new tip and runs the whole CI again ("It looks like something changed on18.0in the meantime"). When two finish close together, the second push is rejected and that merge fails for good.This PR merges one PR at a time per target branch:
A merge holds the queue while its merge bot branch exists, its PR is open with the
bot is merginglabel, and the branch is more recent thanMERGE_BOT_QUEUE_TIMEOUThours (12 by default). The branches left behind by failed merges (OCA/l10n-brazil has 10 right now) therefore do not block it. The queue order comes from a hidden marker in the bot's own "queued" comment, so nobody can queue a merge on behalf of someone else, and permissions are checked again when the merge starts. A task every 15 minutes restarts the queues in case a webhook is lost. Two commands issued within seconds, before either branch exists, can still start together; they fall back to the current retry.Evidence
(fetch first)orcannot lock ref), for instance [16.0][FIX] l10n_br_sped_efd_icms_ipi: Registro0150: don't blow if street_name is null l10n-brazil#4962 and [16.0] l10n_br_fiscal, l10n_br_fiscal_edi, l10n_br_account, l10n_br_nfe, l10n_br_cte, l10n_br_mdfe: generic document import wizard - manual FWP #3546 - no file move l10n-brazil#4157, after the wheel was uploaded.After: each queued PR runs the CI once, starting when the previous merge lands. A batch takes the same time or less, since today the second PR already runs its tests again after the first one lands.
New tests:
The whole suite passes. The behaviour against GitHub itself was not exercised, it needs a running bot.
Merge Danger
Door: two-way
Revert, or add
merge_bot_queuetoBOT_TASKS_DISABLED. PRs left with thebot merge queuedlabel then need the merge command issued again. The queue is enabled by default here; happy to make it opt-in if you prefer.Blast Radius: merge-bot
All repositories using the bot. A bug in the queue would make a queued PR wait (until the 15 minute task, the 12 hour timeout or a new merge command), but the target branch is not at risk: what is pushed is still exactly what was tested. The
bot is merginglabel is now added before the merge bot branch is pushed instead of after.