Skip to content
GroundboxDocs
API referenceStatusPricing
DashboardStart free
GroundboxRunners for GitHub Actions and GitLab CI, and Linux sandboxes for AI agents. One key, one bill.System status

Product

CI runnersSandboxesBuilds and cacheAgent computersUse casesPricing

Developers

DocsAPI referenceAPI explorerCLIMCP serverBenchmark

Compare

vs GitHub-hostedvs Blacksmithvs E2Bvs DaytonaAll comparisons

Company

Talk to usSupportChangelogcontact@groundbox.devGroundmail ↗
© 2026 Groundbox
TermsPrivacyllms.txt
OverviewCI in one lineFirst sandboxHand it to your agent
Sizes and labelsCachesEmail when a run failsFast checkoutBuild cachesMigrateGroundbox or GitHub firstWhen GitHub's runners are stuckCI checkupRuns, logs and insightsci waitTerminal on a jobDr. GroundbotWebhooksSlackPublic repositoriesAuto sizeAuto size: own runnersFlexCI tune-upMerge queueSplit tests by timeAndroid buildsmacOS buildsWindows buildsArm64 LinuxDocker buildsGitLab CIForgejo and GiteaGitCafeBitbucket PipelinesAzure DevOps
Start, exec, filesCommands as rootFrom a Docker imagePrivate imagesCommandsForkTime machineSnapshotsPause and resumeStop and startIdle pause and wakeScheduled runsPreviewsSecretsSecret bindingsSandbox webhooksEgress allowlistFlex sandboxesTemplatesVolumes
Push and pullIn GitHub ActionsStorage and retention
Desktop and actionsLive view in your appHuman handoffSign in onceAgent loop example
BucketsAccess keysMount a bucket
Move from Runloop
OmnaraConnect with Groundbox
REST APIAPI explorerOpenAPI referenceCLIMCP serverSDKsKeys and capsBilling and usageBefore the free minutes run outSupport ticketsLeave or delete a team
  1. CI runners
  2. Merge queue
Markdown
Open in
ClaudeChatGPT
On this page

    Merge queue

    The merge queue tests each pull request on top of main and the pull requests that land before it, and merges only the code that passed. It is included on the $20 plan and is not on the Free plan; the CI runs it starts are billed like any other job.

    Why: two green pull requests can make a red main

    CI on a pull request tests its branch against main as it was when the branch was made. Two pull requests can each pass and still break main together: both add migration 0024, or one renames a function the other starts calling. Each was green; main, with both, is red, and the next person to branch off it finds out.

    The queue tests the code main will actually have after each merge, before the merge happens.

    How it works

    • Candidates. For each pull request in line the queue builds a candidate: main, plus every pull request ahead of it, plus this one. It is pushed as the branch groundbox-queue/<number>, which starts your workflows once. Their jobs run on Groundbox like any other.
    • Depth. The first 3 pull requests in line (up to 10) are tested at the same time, each on top of the ones ahead. The rest wait for a slot. More at once is faster when many pull requests wait, and costs more CI minutes when one fails.
    • Landing the tested code. When a candidate's required jobs pass and every pull request ahead has landed, the queue merges the pull request with GitHub's merge API, pinned to the head commit that was tested, and checks that main's tree is now the candidate's tree. If it is not, the queue pauses for a person to look.
    • Blame only after those ahead pass. A failure ahead fails every candidate behind it too, so a pull request is blamed only once every entry ahead of it has passed. The one that failed leaves the line with a comment saying which job failed and with what; the ones behind it are rebuilt without it and tested again.
    • Main moving outside the queue. A push to main that the queue did not make (a merge by hand, say) changes main's tree, so every candidate is rebuilt on the new main before anything lands.
    • Each pull request gets a Groundbox merge queue status that links to the queue page in the dashboard.

    Turn it on

    1. Accept the App's permissions. The Groundbox GitHub App needs these on the repo's installation, and an owner of the GitHub account accepts them once. Until then the queue waits, and its page links to the place on GitHub to accept them.
    GitHub App permissions the merge queue needs
    PermissionAccessFor
    contentswritePush candidate branches and merge
    pull_requestswriteMerge and comment on the pull request
    statuseswriteThe "Groundbox merge queue" status on each pull request
    checksreadRead every check on a candidate, GitHub-hosted jobs too
    issuesreadReceive /merge comments: GitHub sends comment events only to Apps with it

    It also listens for the pull_request, pull_request_review, issue_comment, push and check_run events.

    1. Run CI on the queue's branches. Add "groundbox-queue/**" to on: push: branches in every workflow with a job that must pass. Without it a candidate starts no jobs and the pull request leaves the line as timed out. In the repo, groundbox queue trigger makes the change (--dry-run shows it first).
    .github/workflows/ci.yml
    on:
      push:
        branches:
          - main
          - "groundbox-queue/**"
      pull_request:
    1. Choose how it merges and turn it on, on the Merge queue page in the dashboard, with groundbox queue on, or with PUT /v1/ci/merge-queue/settings. A team owner or admin, or a key with ci:write.
    Merge queue settings
    SettingDefaultWhat it does
    depth3Pull requests tested at once, 1 to 10
    methodsquashsquash, merge or rebase
    required_jobsevery jobJob names that must pass, up to 50; others are ignored. null: every job a candidate starts must pass, and a skipped job counts as passed.
    timeout_minutes60How long a candidate may test before its pull request leaves the line, 5 to 360
    auto_queueci_passesHow pull requests join on their own: manual, ci_passes or approved. Joining on their own
    full_testsbothWhere the full tests run: both (on the pull request and in the queue) or queue (in the queue only). Run the full tests once
    pausedfalsetrue stops new candidates and landing until false; pull requests stay in line
    enabledtruefalse turns the queue off for the repo

    Ways in

    Joining on their own

    The auto_queue setting says how pull requests against the default branch get into the line. A queue turned on today starts with ci_passes; one that was on before the setting existed stays manual until you change it, in the queue's settings on the dashboard, with groundbox queue on --auto-queue, or with auto_queue on PUT /v1/ci/merge-queue/settings.

    • manual: a pull request joins when someone comments /merge, adds the groundbox-queue label, or queues it from the dashboard, the API, the CLI, an SDK or MCP.
    • ci_passes: a pull request joins when the jobs that must pass (the queue's required_jobs; every job when none are named) pass on its newest commit.
    • approved: it joins when it also has an approving review from someone with write access, and nobody with write access is asking for changes.
    Terminal
    groundbox queue on owner/name --auto-queue approved

    Drafts, pull requests from forks and ones with merge conflicts never join on their own; mark a draft ready and it can. The ways in under manual keep working in every mode.

    • Keeping one out. The groundbox-hold label keeps a pull request out of auto-queueing, and takes it out if auto-queueing put it in line. Remove the label and it joins once its CI has passed.
    • Taking one out. /merge cancel (or removing it from the dashboard or the API) takes it out and holds it: it does not join on its own again, new commits or not, until someone comments /merge or queues it another way.
    • With Dr. Groundbot. When a candidate's CI fails and Dr. Groundbot is on, the queue holds the pull request for a few minutes while he works out why, then acts on his answer. A flaky test he reran: it waits for the rerun, and the pull request lands if it passes, keeping its place. A bug in the change, or a break together with a pull request ahead: it comes out right away, with his answer in the comment, instead of being built again for nothing. Anything else, or no answer: the retry below.
    • One retry. When a candidate's CI fails, the queue builds the same code again once and runs CI afresh, so a flaky test or a job cancelled under it does not cost the pull request its place. It comments on the pull request when it does. A second failure takes it out.
    • After a failure. A pull request the queue removed because its candidate failed, conflicted or timed out does not join again at the same commit. Push a new commit and it joins when CI passes on it, or comment /merge to try the same commit again.
    • The comment on new pull requests. When a pull request is opened against the default branch (or a draft is marked ready), the queue comments once saying how it gets in: that /merge queues it, or that it joins when CI passes or when it is approved and that the groundbox-hold label keeps it out.
    • Pull requests that were already open when you switched the setting join at their next passing CI run (or approval), not the moment you switch.

    On the pull request

    A comment with /merge on a line of its own queues the pull request, and /merge cancel takes it out. Only people with write access to the repo can. Adding the groundbox-queue label queues it too, and removing the label takes it out. New commits on a queued pull request take it out of line, so the code that lands is the code that was tested; queue it again to test the new code (with auto-queue on it joins again by itself when CI passes on them).

    Text
    /merge          joins the line
    /merge cancel   leaves it

    Dashboard

    Merge queue shows the line as a track: main with what landed last, one slot per candidate tested at once, and the pull requests waiting for a slot, with when each should land. Beside it: the breaks caught before main this week, where pull requests went, the wait to merge, what the queue's CI cost, and the settings. Each pull request has a page with the candidate it was tested in, why it left, and everything that happened to it.

    API

    Reads need a key with ci:read, changes ci:write. A signed-in member can use the same routes; changing settings needs a team owner or admin.

    Merge queue endpoints
    MethodPathWhat
    GET/v1/ci/merge-queue/reposThe team's repos with the queue on, and how many are in line
    GET/v1/ci/merge-queue?repo=Settings and the line, next to land first: each entry's state, ahead_prs and eta_seconds
    POST/v1/ci/merge-queueQueue a pull request: {repo, pr}. 201 when added, 200 when it was in line already
    DELETE/v1/ci/merge-queue?repo=&pr=Take it out of line
    GET/v1/ci/merge-queue/history?repo=&pr=&limit=Merged and removed entries, newest first, with every event
    GET/v1/ci/merge-queue/stats?repo=&days=Breaks caught, where pull requests went, waits, CI minutes and cost
    PUT/v1/ci/merge-queue/settingsTurn the queue on (the first call) or change it
    POST/v1/ci/merge-queue/full-testsThe workflow change that runs the full tests in the queue only, or puts them back, as a diff
    Terminal
    # Turn the queue on for a repo (the defaults: 3 at once, squash, every job must pass, 60 minutes)
    curl -X PUT https://api.groundbox.dev/v1/ci/merge-queue/settings \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"repo": "you/app", "depth": 3}'
    
    # Queue pull request 123, the same as a /merge comment
    curl https://api.groundbox.dev/v1/ci/merge-queue \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"repo": "you/app", "pr": 123}'
    
    # The line, next to land first, with each candidate and its ETA
    curl "https://api.groundbox.dev/v1/ci/merge-queue?repo=you/app" \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY"
    
    # Take it out again
    curl -X DELETE "https://api.groundbox.dev/v1/ci/merge-queue?repo=you/app&pr=123" \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY"
    Terminal
    curl "https://api.groundbox.dev/v1/ci/merge-queue/history?repo=you/app&limit=20" \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY"
    
    curl "https://api.groundbox.dev/v1/ci/merge-queue/stats?repo=you/app&days=7" \
      -H "Authorization: Bearer $GROUNDBOX_API_KEY"

    CLI

    groundbox queue add, remove, status, list, history, stats, on, pause and resume (and off). queue on --auto-queue manual|ci_passes|approved sets how pull requests join, and queue trigger --full-tests queue runs the full tests once. A pull request is owner/name#123, owner/name 123 or its URL.

    Terminal
    groundbox queue on owner/name --depth 3 --method squash
    groundbox queue add owner/name#123
    groundbox queue status owner/name
    groundbox queue remove owner/name#123
    groundbox queue history owner/name --pr 123
    groundbox queue stats owner/name --days 7
    groundbox queue pause owner/name
    groundbox queue resume owner/name
    groundbox queue list

    MCP

    merge_queue_info reads, with action status, history, stats or repos. merge_queue changes, with action add, remove or settings (auto_queue among them). An agent that opened a pull request queues it with merge_queue action add instead of merging it by hand; with auto-queue on it joins without that. Changes need a key with ci:write, which the key made by the MCP sign-in does not have. MCP server.

    SDKs

    enqueue_merge, dequeue_merge, get_merge_queue, get_merge_queue_history, get_merge_queue_stats, list_merge_queues, update_merge_queue_settings and merge_queue_full_tests, in TypeScript and Python.

    import { Groundbox } from "@groundbox/sdk";
    
    const gb = new Groundbox(); // GROUNDBOX_API_KEY, with ci:write
    await gb.update_merge_queue_settings({ repo: "you/app", depth: 3 });
    const entry = await gb.enqueue_merge({ repo: "you/app", pr: 123 });
    const queue = await gb.get_merge_queue("you/app");
    console.log(entry.position, queue.entries.map((e) => [e.pr, e.state, e.eta_seconds]));
    from groundbox import Groundbox
    
    gb = Groundbox()  # GROUNDBOX_API_KEY, with ci:write
    gb.update_merge_queue_settings(repo="you/app", depth=3)
    entry = gb.enqueue_merge(repo="you/app", pr=123)
    queue = gb.get_merge_queue("you/app")
    print(entry["position"], [(e["pr"], e["state"], e["eta_seconds"]) for e in queue["entries"]])

    Run the full tests once

    With a merge queue, every job runs twice for each pull request: once on the pull request, and once in the queue, on main plus the pull requests ahead of it. The second run is the one that tests the code main will really have. You can keep the first run short: quick checks on the pull request, the full tests in the queue only.

    On the Merge queue page, open Settings and find Full tests run. There are two choices:

    • On the pull request and in the queue. Every job runs both times. This is the default.
    • In the queue only. The jobs you pick stay on the pull request. The rest run once, in the queue.

    When you choose In the queue only, the dialog lists the jobs in your workflows with a box beside each: ticked, the job stays on the pull request. Jobs named like lint, typecheck, format or build start ticked; you decide. Below the list is the exact change, as a diff. Saving opens a pull request in your repo with that change, opened as you on GitHub (GitHub asks you once to allow it). Nothing changes until you merge it.

    What changes in the workflow

    Each job that moves gains one condition, github.event_name != 'pull_request'. GitHub then skips it on pull requests and still runs it on every push: the queue's candidates, and main if it ran there before. A job that already has an if: keeps it, joined with &&. No other line changes, and comments stay where they are. If the workflow does not yet run on push to groundbox-queue/**, that is added too.

    .github/workflows/ci.yml
       test:
         name: unit tests
    +    if: github.event_name != 'pull_request'
         runs-on: groundbox-auto-test
    
       e2e:
    -    if: ${{ vars.E2E != 'off' }}
    +    if: ${{ github.event_name != 'pull_request' && (vars.E2E != 'off') }}
         runs-on: groundbox-auto-e2e

    Only the jobs the queue requires can move: the names in required_jobs and the jobs those need, or every job when none are named. A job that needs a moved job is skipped on pull requests too; that is how GitHub treats needs, and the dialog says so beside the job.

    Joining the queue

    With pull requests joining when CI passes, a pull request now joins when its quick checks pass. A job that was skipped on the pull request counts as passed, never as failed or missing, but at least one job must have run. In the queue nothing is skipped: the candidate waits for every required job, and a failure there takes the pull request out of line, as before.

    Required status checks

    If your branch protection or a ruleset requires a status check, GitHub counts a job skipped by its own if: as passed, so pull requests are not held up. There is one case where that fails. A matrix job, or a job that calls a reusable workflow, reports under a single name when it is skipped, and the names of its runs (tests (1/3), deploy / build) never appear. A required check with one of those names would wait forever. Groundbox reads the branch's required checks and the queue's required jobs first, and leaves such a job on the pull request, telling you which check is in the way. Requiring one job that collects the results fixes it.

    What it will not change for you

    It never guesses. These are left as they are, each with the reason and, where there is one, the line to write yourself:

    • A job whose if: is written over several lines or in quotes, or already depends on the event or the branch.
    • A matrix job or reusable workflow that a required check is named after, or any of them when the branch's required checks cannot be read.
    • A job that runs whatever the others did (always(), !cancelled() or failure()) and reads their results. It stays on the pull request to report them. If it needs a job that moves, it would see skipped where it saw success, so no pull request is opened until it accepts that and you tick the box that says so. One way to write it:
    .github/workflows/ci.yml
      all-green:
        needs: [lint, test, e2e]
        if: always()
        runs-on: groundbox-auto-all-green
        steps:
          - env:
              RESULTS: ${{ join(needs.*.result, ' ') }}
              SKIPPED_OK: ${{ github.event_name == 'pull_request' }}
            run: |
              for result in $RESULTS; do
                [ "$result" = success ] || { [ "$result" = skipped ] && [ "$SKIPPED_OK" = true ]; } || exit 1
              done
    • A workflow that does not run on pull requests, or cannot be made to run on the queue's branches.

    Going back

    Choose On the pull request and in the queue in the same dialog. It opens the reverse pull request, which takes the condition off again and restores each if: as it was. Reverting the first pull request does the same. Keep the queue on while the full tests run in the queue only: with the queue off, nothing runs them before a merge.

    From the CLI, the API and the SDKs

    groundbox queue trigger --full-tests queue makes the same change in a checkout, for you to commit. --on-pr names the jobs that stay on the pull request, --repo reads the queue's required jobs and the branch's required checks, and --dry-run prints the diff. POST /v1/ci/merge-queue/full-tests answers with the change as a diff per file, each job and where it runs after; the SDKs call it merge_queue_full_tests. A key gets the diff and cannot open the pull request, which is opened as a person. full_tests in the settings records the choice. The MCP tools do not set it.

    Terminal
    # In the repo: see the change, then make it
    groundbox queue trigger --full-tests queue --repo owner/name --dry-run
    groundbox queue trigger --full-tests queue --repo owner/name --on-pr lint,build
    
    # Once it is merged, record the choice
    groundbox queue on owner/name --full-tests queue
    
    # Back to every job on pull requests
    groundbox queue trigger --full-tests both

    What it saves

    Once the pull request Groundbox opened is merged, the Merge queue page and the stats show the CI minutes for each push to a pull request, over the two weeks before the change and since. It is measured from the jobs that ran, and appears once there are enough pushes on both sides. A pull request opened before the change keeps running every job until it is rebased, so the figure settles over a few days.

    Why a pull request leaves the line

    • failed: a required job failed on its candidate, with every pull request ahead passed. A break caught before main.
    • conflict: git could not combine it with main and the pull requests ahead. Rebase and queue it again.
    • updated: new commits were pushed after it was queued.
    • closed: closed, or merged outside the queue.
    • timed_out: no result within the timeout, or no job started (the workflows lack the groundbox-queue/** trigger).
    • cancelled: taken out by a person, a /merge cancel comment, a key or the groundbox-hold label.
    • not_mergeable: GitHub refused the merge, for a draft or a base other than the default branch.
    • landing_mismatch: main after the merge was not the code that was tested. The queue pauses until someone looks.

    What it costs

    The queue is included on the paid plan ($20 a month): there is no fee per merge, per seat or per repo, and a team on the paid plan can use it whatever runs its CI. It is not on the Free plan: turning a queue on or queueing a pull request answers 402 paid_plan_required with a link to start the plan, and a /merge comment gets a reply on the pull request saying the same. A team that moves to the Free plan with a queue on keeps the pull requests already in line, which finish, and takes no new ones. The CI jobs that run on candidates are billed like any other job on Groundbox runners, by the second. A failure ahead means the candidates behind it run again, so a deeper queue can use more minutes when pull requests fail. The stats (dashboard, groundbox queue stats, GET /v1/ci/merge-queue/stats) show the minutes and cost on candidates and the cost per merged pull request. While the team can't run CI jobs (out of credit), the queue waits and picks up again when it can.

    Limits

    • GitHub's free plan can't protect a private repo's main, so the queue can't stop someone pressing the merge button. It notices main moving and retests every candidate on the new main before anything lands.
    • It merges into the repo's default branch only. A draft, or a pull request into another branch, can't join.
    • Up to 10 candidates at once per repo, and up to 50 required job names.
    • Jobs that run elsewhere (GitHub-hosted runners) count as long as they report a check on the candidate; the queue reads every check.
    ← PreviousCI tune-upNext →Split tests by time
    System statusSupportPricingllms.txtgroundbox.dev