Repository navigation
Description
Summary
The repository documents one way onto main: the merge queue. In practice two ways are in use. Since 10 October, 83 of 123 merged PRs have no merge-queue event; 80 of those merged before at least one required check had reported its first result, and 4 merged with a required check already failed or cancelled. Two regressions reached main that way and were reported by the PR's own checks after it had merged. Each direct merge also moves the base of every group waiting in the queue, so queued PRs are rebuilt: #4849 went through nine merge groups in 2.5 hours.
This issue collects the numbers and the options. It does not say which path is right and proposes no change. It asks the team to decide what the intended paths are, because right now the documented rule and the observed practice differ.
What the repository says
.agents/repo.md:171-176: "Land through the merge queue … never bypass the queue with an admin merge. A PR's own CI is the fast tier (format, lint, types, knip, unit, commitlint, SAST); E2E, Build, CLI, UI, Browser and backend integration run only in the queue.".github/CI.md:963-995(### Merge queue): ruleset Tale required CI, squash merges, groups of up to five, all-green grouping, a 360-minute timeout; "Most validation runs only in the queue"; its rationale cites "about 75 merges a day".- The ruleset (id 24697330) has the
merge_queuerule and the sevenCI ready (…)contexts as required checks,bypass_actors: []at rest andcurrent_user_can_bypass: never. - The ruleset's history (admin view) shows 76 short windows since 10 October in which a bypass entry (repository role admin, mode
pull_request) was present, a median of about five seconds each (maximum 69 s). That is close to the number of direct merges below; it is not matched PR by PR.
What happens
Merged to main from 2026-10-10 00:00 UTC to 2026-10-12 about 16:25 UTC. "Direct" means the PR's timeline has a merged event and no added-to-merge-queue event.
| Day (UTC) | through the queue | direct |
|---|---|---|
| 10-10 | 2 | 33 |
| 10-11 | 20 | 30 |
| 10-12 | 18 | 20 |
| total | 40 (33%) | 83 (67%) |
For the 83 direct merges, from the check runs of each PR's head commit:
- 80 merged before at least one of the seven required checks had reported its first result. The last required check reported a median of 11 minutes after the merge (p90 40 minutes, maximum 85 minutes).
- 4 merged while a required check had already failed or been cancelled (test(sandbox): synchronize background mirror pull assertions #4663, fix(cli): allow reviewed advisory workflow warnings #4737, ci: serialize daily release admission #4821, docs: publish Tale v0.5.87 release notes #4848).
Two regressions reached main this way; in both cases the PR's own checks reported the problem after the PR had merged:
| PR | merged (UTC) | what its own checks reported afterwards | effect on main |
|---|---|---|---|
| #4846 | 11:15:00 | Knip failed at 11:18, Unit (platform 2/2) at 11:23 | Knip reported scripts/publish-package.ts unused on main until #4851 merged at 12:38: 83 minutes in which any PR run on top of main failed Knip with the same finding (seen on #4849 and #4850) |
| #4855 | 13:14:56 | Unit (workspaces) failed at 13:25 | The CLI target guard failed on main. A merge group built on it failed CLI and #4849 was removed from the queue at 13:32. It stayed red until #4857 merged at 14:00:45: 46 minutes |
What it does to queued PRs
The queue builds each group on the current tip of main. When main moves, the groups are rebuilt on the new tip: a new temporary branch and seven new workflow runs. The 400 most recent merge_group runs (2026-10-11 23:22Z to 2026-10-12 14:54Z) cover 57 groups for 21 PRs. Of the 330 of them that had settled by 14:35 UTC, 247 succeeded, 18 failed and 65 ended cancelled.
PRs that saw main stay still built one group: #4844 (enqueue to merge 14 minutes) and #4851 (10 minutes). #4849 built nine between 13:03 and 14:54 and merged at 15:30, together with #4853, which had built six:
| UTC | event |
|---|---|
| 13:03 | #4849 enters the queue; group 1 |
| 13:12 | #4854 merged directly |
| 13:13 | group 2 |
| 13:14 | #4855 merged directly |
| 13:15 | group 3 |
| 13:32 | #4849 removed from the queue (failed_checks: the CLI guard #4855 broke) |
| 13:51 | #4849 added again; group 4 |
| 14:00 | #4857 merged directly (it fixes the CLI guard) |
| 14:01 | group 5 |
| 14:04 | group 6 |
| 14:21 | #4858 merged directly; group 7 |
| 14:47 | #4861 merged directly |
| 14:48 | group 8 |
| 14:53 | #4862 merged directly |
| 14:54 | group 9 |
| 15:30 | #4849 and #4853 merged |
Six of the nine builds started within two minutes of a direct merge. Two are the first build and the re-entry; one (14:04) I cannot tie to an event.
Direct merges are not the only cause of waiting. #4384, #4325 and #4682 merged 128 to 171 minutes after their last enqueue with no direct merge in between, each after two removals. Across the 40 queue-merged PRs the removals were: failed_checks 39, manual 51, merge_conflict 3, queue_cleared 2.
On the runner side, .github/CI.md:968 states the budget: the free plan "runs about 20 jobs at once across every PR and queue run, a full merge-group run needs dozens … a queued run can wait hours for a runner". At 14:34 UTC the Commitlint run of #4849's live group, whose one job takes about half a minute when it runs, had been queued for 13 minutes. See #4874 for the runs of dissolved groups.
What this issue does not claim
- That direct merges are wrong. They are fast, and the queue's latency is real (10 to 14 minutes on a quiet
main, 95 to 99 minutes whilemainmoved). - Why each direct merge happened. Every merge in the period, queued or direct, was made by the repository owner's account.
- That the failing checks at merge time were all caused by the PR: fix(platform): say retention values and bound changes in words #4850's Knip failure at 12:17 was the same
scripts/publish-package.tsfinding, inherited frommain.
Options (not exhaustive, no preference stated)
- One path. Every change, documentation and tests included, goes through the queue. Latency stays at the numbers above unless
mainis quiet; the rebuild churn disappears when nothing else lands onmain. - Two defined paths. Name the class of change that may merge directly (for example documentation or test-only) or the condition (every required PR check green, local checks run), write it into
.agents/repo.mdand CI.md, and express it in the ruleset so that no hand-edited bypass is needed. - Make a queue attempt cheaper. Retire dissolved groups' runs automatically (ci: runs of merge groups the queue dissolved are not reliably cancelled and compete with the live group for runners #4874), put fewer jobs in a group, or add runner capacity (the free plan's ~20 concurrent jobs is the stated budget).
- Validate after the merge. Run the full tier on
mainitself and fix forward. This is how the repository worked before the queue; it needs themainpush runs to finish, and they cancel each other under the current concurrency setting (checks.yml:23-25,cancel-in-progresstrue for pushes). - Record the path. Whatever is chosen, label or note direct merges so their share can be measured without a script.
Questions
- Is the direct path intended, and for what? Who may use it?
- What time-to-land is acceptable for a queued PR?
- Should a PR be allowed to merge before its own required checks have reported?
Reproduce
Both scripts need an authenticated gh. The ruleset history needs admin access: gh api repos/tale-project/tale/rulesets/24697330/history.
Routes, and what the required checks had done at merge (merge-route-stats.py 2026-10-10)
#!/usr/bin/env python3
"""How did pull requests reach main, and what had their required checks done when they merged?
usage: python3 merge-route-stats.py 2026-10-10 (needs an authenticated `gh`)
A PR "went through the queue" when its timeline has an AddedToMergeQueueEvent; otherwise it is a "direct" merge.
For each direct merge the check runs of the PR's head commit are read (all runs, not only the latest), and each of the
seven required `CI ready (...)` contexts is compared with the merge time.
"""
import collections
import datetime as dt
import json
import statistics
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor
REPO = 'tale-project/tale'
REQUIRED = [f'CI ready ({name})' for name in ('Commitlint', 'SAST', 'E2E', 'CLI', 'Security', 'Checks', 'Build')]
SINCE = sys.argv[1] if len(sys.argv) > 1 else '2026-10-10'
def gh(*args):
return subprocess.run(['gh', *args], capture_output=True, text=True, check=True).stdout
def when(text):
return dt.datetime.fromisoformat(text.replace('Z', '+00:00')) if text else None
QUERY = '''query($q:String!, $after:String) { search(query:$q, type:ISSUE, first:100, after:$after) {
pageInfo { hasNextPage endCursor }
nodes { ... on PullRequest { number title mergedAt headRefOid
timelineItems(first:50, itemTypes:[ADDED_TO_MERGE_QUEUE_EVENT, REMOVED_FROM_MERGE_QUEUE_EVENT]) {
nodes { __typename ... on RemovedFromMergeQueueEvent { reason } } } } } } }'''
prs, after = [], None
while True:
args = ['api', 'graphql', '-f', f'query={QUERY}', '-f', f'q=repo:{REPO} is:pr is:merged base:main merged:>={SINCE}']
if after:
args += ['-f', f'after={after}']
page = json.loads(gh(*args))['data']['search']
prs += page['nodes']
if not page['pageInfo']['hasNextPage']:
break
after = page['pageInfo']['endCursor']
for pr in prs:
events = pr['timelineItems']['nodes']
pr['merged'] = when(pr['mergedAt'])
pr['queued'] = any(e['__typename'] == 'AddedToMergeQueueEvent' for e in events)
pr['removals'] = [e['reason'] for e in events if e['__typename'] == 'RemovedFromMergeQueueEvent']
prs.sort(key=lambda pr: pr['merged'])
direct = [pr for pr in prs if not pr['queued']]
queued = [pr for pr in prs if pr['queued']]
print(f"merged to main since {SINCE}: {len(prs)}; through the queue: {len(queued)}; without a queue event: {len(direct)}")
per_day = collections.defaultdict(lambda: [0, 0])
for pr in prs:
per_day[pr['merged'].date().isoformat()][0 if pr['queued'] else 1] += 1
for day, (via_queue, not_queued) in sorted(per_day.items()):
print(f" {day}: queue {via_queue:3d} direct {not_queued:3d}")
print('removals from the queue among queue-merged PRs:',
dict(collections.Counter(reason for pr in queued for reason in pr['removals'])))
def check_state(pr):
runs, page = [], 1
while True:
batch = json.loads(gh('api', f"repos/{REPO}/commits/{pr['headRefOid']}/check-runs?filter=all&per_page=100&page={page}"))['check_runs']
runs += batch
if len(batch) < 100:
break
page += 1
unfinished, failed_before, last_lag = [], [], None
for name in REQUIRED:
completed = sorted((run for run in runs if run['name'] == name and run['completed_at']), key=lambda run: run['completed_at'])
if not completed:
continue
# The first result of this context against the merge: positive = it arrived after the PR had merged.
lag = (when(completed[0]['completed_at']) - pr['merged']).total_seconds()
last_lag = lag if last_lag is None else max(last_lag, lag)
if lag > 0:
unfinished.append(name)
before = [run for run in completed if when(run['completed_at']) <= pr['merged']]
if before and before[-1]['conclusion'] in ('failure', 'cancelled', 'timed_out'):
failed_before.append(name)
return pr['number'], unfinished, failed_before, last_lag
with ThreadPoolExecutor(max_workers=8) as pool:
states = list(pool.map(check_state, direct))
unfinished = [s for s in states if s[1]]
failed = [s for s in states if s[2]]
lags = sorted(s[3] for s in states if s[3] is not None and s[3] > 0)
print(f"\ndirect merges: {len(direct)}")
print(f" at least one required check had not reported its first result when the PR merged: {len(unfinished)}")
if lags:
print(f" seconds from the merge until the last required check reported its first result: median {statistics.median(lags):.0f}, "
f"p90 {lags[int(len(lags) * 0.9)]:.0f}, max {lags[-1]:.0f}")
print(f" at least one required check had failed or been cancelled when the PR merged: {len(failed)} "
f"({', '.join('#' + str(s[0]) for s in failed)})")Merge groups per PR (merge-group-stats.py)
#!/usr/bin/env python3
"""How many merge groups does a queued PR go through, and how many merge-group runs end cancelled?
usage: python3 merge-group-stats.py (needs an authenticated `gh`)
A merge group is built on a temporary branch `gh-readonly-queue/main/pr-<number>-<sha>`; the queue builds a new one
(a new branch, seven new workflow runs) whenever the base moves or the entries ahead change.
"""
import collections
import json
import subprocess
REPO = 'tale-project/tale'
def gh(*args):
return subprocess.run(['gh', *args], capture_output=True, text=True, check=True).stdout
runs = []
for page in range(1, 5):
out = gh('api', f'repos/{REPO}/actions/runs?event=merge_group&per_page=100&page={page}',
'--jq', '.workflow_runs[] | {head_branch, created_at, status, conclusion}')
runs += [json.loads(line) for line in out.splitlines() if line.strip()]
groups = collections.defaultdict(lambda: collections.defaultdict(list))
for run in runs:
_, number, sha = run['head_branch'].rsplit('/', 1)[-1].split('-', 2)
groups[number][sha].append(run)
print(f"{len(runs)} merge_group runs, {min(r['created_at'] for r in runs)} .. {max(r['created_at'] for r in runs)}")
print('outcomes:', dict(collections.Counter(r['conclusion'] or r['status'] for r in runs)))
print(f"{sum(len(g) for g in groups.values())} merge groups for {len(groups)} pull requests")
print('\nPR groups first build -> last build (UTC)')
for number in sorted(groups, key=int, reverse=True):
built = sorted(min(r['created_at'] for r in rs) for rs in groups[number].values())
print(f"#{number} {len(built):5d} {built[0][5:16]} -> {built[-1][5:16]}")Observed at main a83e645e27; counts as of 2026-10-12 about 16:25 UTC.
Activity
yannickmonney commentedon Oct 13, 2026
One more data point for the question above, from 2026-10-13 (UTC), as the queue timeline of six pull requests shows it. It does not say which path is right.
failed_checks; 19:47:29failed_checksfailed_checksfailed_checksfailed_checksmanualmanualmanualexits of feat(platform): connect a coding agent in the setup wizard #4967 and feat(platform): connect a coding agent on the MCP settings page #4968 were their author's dequeue, needed because a merge request for a pull request that sits in the queue is refused ("Pull Request is in the merge queue", HTTP 405).failed_checksexits of fix(platform): repair review access retargeting #4396 came 102 and 60 seconds after the cancellation times reported in ci: runs of merge groups the queue dissolved are not reliably cancelled and compete with the live group for runners #4874 (18:37:11Z and 19:46:29Z), and the one of feat(platform): create an automation with a coding agent #4966 nine seconds after a cancelledCLIrun of its group (21:17:52Z). The queue recorded all three asfailed_checks.9cd02143,d4852361,11ddeef3and5197d946between 19:46Z and 20:51Z.main;main's tree was afterwards checked to equal that tree.