Skip to content

[FEATURE] ci: merge-queue v2 step 4 - landing loop (admin merge) and closure audit #4690

Closed

Description

Proposals are welcome before implementation. For substantive changes, wait
for a responsible human maintainer to approve the scope and identify a review
contact. An automated recommendation, label alone, or silence is not approval.
See Contributing.

Is your feature request related to a problem? Please describe.
Merge-queue v2 step 3 (#4671, #4675, merged as 3466ef0) composes and proves trains, but only in shadow mode: it logs "would land #n at T_k" and never writes to main. The landing desks still merge by hand. A hand merge can land a SHA other than the proven one, and it can miss or misfire an issue closure (a quoted "Fixes" closes the wrong issue, or a real fix leaves its issue open).

Describe the solution you'd like
Merge-queue v2 step 4 adds the landing loop and a closure audit to scripts/merge_queue/. Landing is dormant by default: the runner stays shadow-only unless it is started with an explicit --land flag.

  • landing.py:
    • an elevation probe with a 2-probe lapse rule (two consecutive failed admin probes mean a lapse);
    • a lease estimate;
    • pre-merge checks that the base and head are still the proven ones;
    • gh pr merge --merge --admin --match-head-commit <proven head>, with a bounded retry on rule-violation responses;
    • a post-merge check that main's new commit has the expected parents and the tree T_k proven by train-gate;
    • HALTED handling: any mismatch, or an external merge to main during a train, stops landing and writes a HALT record. Trains keep testing.
  • closure.py:
    • before the merge, the PR's closingIssuesReferences must equal the ticket's fixes;
    • after the merge, the runner closes missed issues and reopens wrongly closed ones;
    • stacked PRs are retargeted.
  • Message hooks: one needs_input per admin lapse, and an ejection notice through the autopilot-comment skill.
  • Unit tests in tests/unit/scripts/merge_queue/ with the GitHub API mocked cover:
    • the lapse rule;
    • the match-head and tree checks;
    • HALT on an external merge;
    • resume order after a lapse;
    • the seeded closure cases.

Done when:

  • Unit tests and CI are green, and landing is off by default.
  • After activation (a separate maintainer gate, not before the v0.38.0 tag and the step-3 shadow acceptance):
    • at least 20 runner landings with 0 tree mismatches;
    • a closure audit with 0 misses (seeded: a quoted "Fixes" is reopened, and a missed close is closed);
    • a simulated lapse pauses landing while trains keep testing, and resume lands the backlog in order;
    • an external manual merge is detected and HALTs the runner.

Out of scope:

  • red handling: ejection, inherited baseline, bisect, flakes (step 5);
  • throughput features (step 6);
  • release mode (step 7);
  • skill integration (step 8);
  • cutover (step 9);
  • ruleset or merge_group edits;
  • turning landing on.

Describe alternatives you've considered
Keep the desks merging by hand and only verify trees after the fact. That catches a mismatch only after it is on main, and it keeps the admin desks as the bottleneck.

Additional context
Design: the merge-queue v2 design and plan, step 4. It depends on step 3 (#4671). Owner: [OPS] Lead, CI & Merge Queue. Review contact: Daniel Meppiel (@danielmeppiel).

Activity

  1. added
    type/feature
    on Nov 21, 2026
  2. danielmeppiel commented on Nov 21, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Merge-queue v2 step 4, landing loop and closure audit, dormant by default. Add scripts/merge_queue/landing.py (2-probe elevation lapse rule, lease estimate, pre-merge base and head checks, gh pr merge --merge --admin --match-head-commit with bounded retry on rule violations, post-merge parents and tree check against the proven T_k, HALTED on any mismatch or external merge) and closure.py (pre-merge closingIssuesReferences must equal the ticket's fixes; post-merge close or reopen; stacked retarget), plus needs_input and ejection-notice hooks. The runner lands only when started with an explicit --land flag; shadow stays the default. Unit tests in tests/unit/scripts/merge_queue/ with the GitHub API mocked.
    Done when: unit tests and CI green with landing off by default; after a separate activation gate (not before the v0.38.0 tag and step-3 acceptance): at least 20 runner landings with 0 tree mismatches; closure audit with 0 misses on seeded cases; a simulated lapse pauses landing while trains keep testing and resume lands in order; an external manual merge HALTs.
    Out of scope: red handling (step 5), throughput (step 6), release mode (step 7), skill integration (step 8), cutover (step 9), ruleset or merge_group edits, turning landing on.
    Review contact: Daniel Meppiel (@danielmeppiel)

  3. added
    status/accepted
    on Nov 21, 2026
  4. added a commit that references this issue on Nov 22, 2026
    cb2e9d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cistatus/acceptedtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions