Skip to content

pr-pipeline: merge and issue lanes for native stack layers #15410

Closed

Description

@kyle-sexton

Problem

Owner decision Q40 (2026-11-11) lets the lanes accept a layer of a native GitHub stack whose stack base is main (#15400 for the trust gate, #15406 for merge counting). Two lane paths still cannot carry a stack end to end:

  1. Merge lane. .github/scripts/pr-merge/enable-auto-merge.mjs:295 lists only PRs into main and arms native auto-merge. In melodic-software/pr-pipeline-sandbox, gh pr merge 327 --squash on a bottom layer into main answered GraphQL: Auto-merge is not supported for stacked pull requests. (enablePullRequestAutoMerge). So no stack member can be armed, bottom layer included. A stack lands only through the asynchronous merge API (Merge a pull request asynchronously, which "includes all open downstack pull requests") or gh stack merge. After the bottom layer merges alone, the next layer retargets to main (sandbox feat: make missing hook prerequisites skip visibly (10 plugins) #328: base.ref became main, base.sha the new tip).
  2. Issue lane. .github/scripts/work-resolve-issue/report-outcome.mjs:2638-2641 and :2806 open the lane's PR on the default branch only, and .github/scripts/work-resolve-issue/check-blockers.mjs:142 skips an issue while its blocker is open. The intended change: when the blocker has an open PR, build on that PR's branch and open the new PR as a stack layer on it.

Open design points

  • Merge lane: which layer it merges (bottom only, so each layer passes its own holds, or a contiguous group, which lands every lower layer all-or-nothing and needs every lower layer's holds checked: do-not-merge, body holds, human wait comments), when it enqueues (async merge does not wait for checks the way auto-merge does), and whether the lanes App token can call the async merge endpoint (contents write per the docs).

  • Issue lane: the blocker's open PR must pass the same trust checks as any lane input before the lane builds on it (same repository, listed author or the lanes App, base main or a layer on main, no do-not-merge); creating a stack needs the stack API gh stack link calls, not the extension, in the runner; whether an App token can create a stack is unverified.

  • A PR opened into another branch before it joins a stack gets no branches: [main] workflows (ci-status) until a new event (sandbox ci: bump do-not-merge-gate pin to the gh-CLI-free revision #332 had no ci-status until a draft toggle), so the lane must link the stack before or at PR creation.

  • Write lanes (pr-refine, fix-ci, address-feedback) that push to a middle layer leave the layers above needing a restack; no lane restacks them.

  • The run activity's diff base for a layer is the stack base on main (pr-run-activity-read.yml:1394, :2078, pr-run-activity-write.yml:2089 read steps.trusted-base.outputs.commit), so a layer's activity sees the lower layers' changes too. Not a trust issue; it can hit size caps. pr-review-main already diffs a layer against its own base (feat(pr-pipeline): accept native stack layers that target main #15400, gate output pr-base-sha).

Done when

  • The merge lane holds a ready stack layer for a person, with every lower layer's holds checked: it makes no enqueue or auto-merge attempt the lanes App cannot complete, posts the refusal comment and needs-human, and a person's "Enqueue pull request" then lands the layer into main. GitHub refuses all three lanes App routes on a stack layer (async merge, native auto-merge, GraphQL enqueue; pr-pipeline: merge and issue lanes for native stack layers #15410 (comment)). Owner, 2026-11-20, on reworking this item to that: "go w/ recommendations".
  • The issue lane opens a stacked layer on an open blocker PR that passes the trust checks, and still skips when it does not.

Refs: #15400

Activity

  1. added
    needs-triage
    on Nov 11, 2026
  2. github-actions commented on Nov 11, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the pr-merge lane scripts and their tests under .github/scripts/pr-merge, plus the PRs that lane handles in this repository; no issue-lane code changes.
    Reversible: yes; revert the change. A layer already landed through the async merge stays merged.
    Open questions: none
    Decision recorded by kyle-sexton (#15410 (comment)):

    Decision recorded. Build stack support in the merge lane only now; issue-lane stacking is split into its own issue (option B, not the refinement's recommendation for both lanes).

    Chosen: B. The owner answered the batch on 2026-11-17, typed in an agent session, verbatim: "Go with recommendations."

    [quote truncated; the full decision is at the link]

    This settles the open design points. The merge lane lands only the bottom layer, through the async merge after a green ci-status pinned to the layer's head, with no new credential. Issue-lane stacking is out of scope here and gets its own issue. The sandbox run in melodic-software/pr-pipeline-sandbox needs a host session. It is routed through the host-run label and does not hold triage. I found no duplicate among the open issues. #15400 and #15406 are the earlier stack work this builds on.

    Automated triage. A maintainer reviews it.

  3. added
    needs-owner-decision
    on Nov 11, 2026
  4. melodic-automation-lanes commented on Nov 11, 2026

    @melodic-automation-lanes
    Contributor

    The latest triage verdict holds nothing: admission moved the issue to status: confirmed; its comment says why.

  5. melodic-automation-lanes commented on Nov 11, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: The merge lane lands only the bottom stack layer into main through the async merge API once ci-status is green and its holds are clear, and the issue lane stacks a new PR on a trusted open blocker PR.

    Related work

    Open questions

    1. Which layer does the merge lane land: only the bottom layer, or a contiguous group of layers?
      RECOMMENDED: Bottom only, so each layer passes its own holds and all-or-nothing group landing is avoided. Basis: The issue's own reasoning that group landing needs every lower layer's holds checked, and triage item 1.
    2. When does the merge lane call the async merge endpoint, since it does not wait for checks?
      RECOMMENDED: Only once ci-status is green on the layer's head and no hold applies, pinned to that head SHA. Basis: .github/scripts/pr-merge/enable-auto-merge.mjs:154 pins the head already; triage item 2.
    3. If the lanes App token cannot call the async merge endpoint, should the lane leave the layer for a person or use another credential?
      RECOMMENDED: Leave the layer unarmed with an explanatory comment and add no credential. Basis: .github/scripts/pr-merge/enable-auto-merge.mjs:981 shows the existing unarmed-with-comment behaviour.
    4. If an App token cannot create a stack through the stack API, should the issue lane open a plain PR on main or skip the issue?
      RECOMMENDED: Skip and keep agent-ready, so the issue is re-fired once the blocker merges. Basis: .github/scripts/work-resolve-issue/check-blockers.mjs:142 already skips and keeps agent-ready while a blocker is open.

    Sources read

    • context.json: issue 15410 lists design points but picks none, no Decision recorded comment exists
    • /home/runner/work/claude-code-plugins/claude-code-plugins/.base/.github/scripts/work-resolve-issue/check-blockers.mjs:141: skips the run and keeps agent-ready while any blocker is pending
    • /home/runner/work/claude-code-plugins/claude-code-plugins/.base/.github/scripts/pr-merge/enable-auto-merge.mjs:2: native auto-merge enabler for the lanes, no async merge path

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  6. kyle-sexton commented on Nov 17, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Build stack support in the merge lane only now; issue-lane stacking is split into its own issue (option B, not the refinement's recommendation for both lanes).

    Question as put to the owner (Q34): "Lanes for stacked pull requests."

    • A: both lanes.
    • B (recommended): merge lane only now; issue-lane stacking is split into its own issue.
    • C: defer.

    Chosen: B. The owner answered the batch on 2026-11-17, typed in an agent session, verbatim: "Go with recommendations."

    Issue-lane stacking (the second done-when line of this issue, and refinement question 4) is out of this issue's scope. The session that builds the merge-lane part files it as its own issue; that issue waits for a sandbox test of whether a lanes App token can create a stack. For the merge lane this adopts refinement questions 1 to 3: bottom layer only, async merge only after a green ci-status pinned to the layer's head, and no new credential.

    A host session builds this: its tests run in melodic-software/pr-pipeline-sandbox.

    Acceptance criteria

    • The merge lane lands only the bottom layer of a native stack whose stack base is main, through the asynchronous merge API, without arming native auto-merge.
    • It calls the merge only when ci-status is green on the layer's current head and no hold applies (do-not-merge, a body hold, a human wait comment), with the merge pinned to that head SHA.
    • It never lands a layer above the bottom one, so no lower layer lands without its own holds checked.
    • If the lanes App token cannot call the async merge endpoint, the lane leaves the layer unmerged with an explanatory comment and adds no credential.
    • Tests cover: a green bottom layer is merged, a held layer is not, a layer above the bottom is not, and a refused merge call leaves the explanatory comment. CI passes.
    • A sandbox run in melodic-software/pr-pipeline-sandbox shows a bottom layer landed by the lane, linked from the pull request body.
    • Issue-lane stacking is filed as its own issue, linked from this one, and no issue-lane code changes here.

    Posted by an agent session.

  7. added
    host-run
    on Nov 17, 2026
  8. removed
    needs-owner-decision
    on Nov 17, 2026
  9. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    A listed human released the issue's Work status hold, so it goes back to intake triage.

  10. 4 remaining items

  11. melodic-automation-lanes commented on Nov 17, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: The merge lane lands only the bottom layer of a native stack on main through the async merge API after a green ci-status and no holds, with issue-lane stacking filed separately.

    Acceptance criteria

    • The merge lane merges only the bottom layer of a native stack whose stack base is main, through the asynchronous merge REST endpoint, and never arms native auto-merge for it.
    • The merge call is made only when ci-status is green on the layer's current head and no hold applies (do-not-merge, a body hold, a human wait comment), and it is pinned to that head SHA.
    • A layer above the bottom one is never merged by the lane, so no lower layer lands without its own holds checked.
    • When the lanes App token cannot call the async merge endpoint or the call is refused, the layer stays unmerged, the lane leaves an explanatory comment, and no new credential is added.
    • Tests under the pr-merge script tests cover: a green bottom layer is merged, a held layer is not, a layer above the bottom is not, and a refused merge call leaves the explanatory comment; CI passes.
    • The pull request body links a sandbox run in melodic-software/pr-pipeline-sandbox showing a bottom layer landed by the lane.
    • Issue-lane stacking is filed as its own issue linked from this one, and no file under .github/scripts/work-resolve-issue changes.

    External state: none

    Dependencies

    • Issue-lane stacking waits on a sandbox test of whether a lanes App token can create a stack (separate issue to be filed).
    • Builds on #​15400 (trust gate) and #​15406 (merge counting for stack layers), both already merged or closed.

    Related work

    Sources read

    • .github/scripts/pr-merge/enable-auto-merge.mjs:294: lists only open PRs with baseRefName main for arming native auto-merge
    • .github/scripts/pr-merge/enable-auto-merge.mjs:340: arms enablePullRequestAutoMerge with SQUASH and expectedHeadOid, which the issue says fails for stacked PRs
    • refine-data/context.json: the owner's Decision recorded comment settles bottom layer only, async merge after green ci-status pinned to head, no new credential, issue-lane stacking split out

    Automated refinement by the lanes App. Intake triages the issue again with it.

  12. kyle-sexton commented on Nov 19, 2026

    @kyle-sexton
    MemberAuthor

    Issue-lane stacking, split out by the owner's option B decision above, is filed as #17539.

    The merge-lane part is in draft #17541 (Refs: #15410). Its sandbox run (done-when item 6) is not done yet: the sandbox runs enable-auto-merge.mjs from its own main, so it needs a resync with this change, and the run needs a two-layer stack the lanes App authored. #17541's ## Remaining section has the details.

    Posted by an agent session.

  13. kyle-sexton commented on Nov 20, 2026

    @kyle-sexton
    MemberAuthor

    Stack-layer merge from the lanes App: all three API routes GitHub offers are refused on a stack's bottom layer. A person's enqueue works.

    Tested in melodic-software/pr-pipeline-sandbox on PR 398, the bottom layer of stack 401 (base main, every check green):

    Route (lanes App installation token) GitHub's answer Where
    REST merge-async, merge_action=merge_queue accepted, then failed: Enqueuer is not authorized to merge run 44680029102, job Enable Auto Merge
    GraphQL enablePullRequestAutoMerge Auto-merge is not supported for stacked pull requests. run 44776470784, job Enable Auto Merge, 16:46:50Z
    GraphQL enqueuePullRequest This pull request is part of a stack and must be enqueued using the asynchronous merge REST API. ("api": "graphql", "status": "failed") run 44776470784, job Merge, group PR #398 at 7c2f3ca8…: exit 10, 16:46:49Z

    A person's "Enqueue pull request" click on the same PR (enqueued by the owner 18:23:21Z) put it in the queue, and it merged through the queue at 18:24:32Z.

    So done-when item 1 (the merge lane lands a ready stack layer into main) cannot be met by the lanes App today: GitHub sends stack layers to merge-async, and merge-async refuses the App as enqueuer. PR #17541 takes the path left: a refusal comment and needs-human, and a person enqueues the layer.

    Found while reading the run: on a merge-queue base the unattended gate (babysit_merge.py, the unattended_enqueue path) posts its pin comment and calls enqueuePullRequest on a stack layer every sweep, and GitHub refuses each time, because the stack is read only under --stacked-prs. In the sandbox that repeats every :11/:41 sweep for each lanes App stack layer.

  14. kyle-sexton commented on Nov 20, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision Q116 for this issue's merge lane. A retargeted pull request's AI reviews count again once they run after its newest retarget, and a retargeted pull request may request one whole re-review within the existing caps. Built in #17703.

    verbatim: "go w/ recommendations and then /session-flow:handoff" (Q116 A)

    Row: https://github.com/melodic-software/architecture/blob/6c602e74e88329895c98221aaefa8fef1f60d9a6/docs/owner-decisions.md#L282

    Why: GitHub retargets every upper stack layer to main when the layer below merges. Under the old rule (babysit_review_evidence.py:477-479) such a layer could never count as reviewed, so it sat held forever with no needs-human. melodic-software/pr-pipeline-sandbox#400 sat that way from 21:03Z.

  15. kyle-sexton commented on Nov 21, 2026

    @kyle-sexton
    MemberAuthor

    Item 1 evidence, sandbox PR melodic-software/pr-pipeline-sandbox#400 (a stack layer into main):

    • The merge lane's refusal: run 44857604824 logged "GitHub refused the async merge of this stack layer (its result: failed: Enqueuer is not authorized to merge)" at 2026-11-21T02:47:16Z and added needs-human at 02:47:17Z.
    • A person's enqueue: added_to_merge_queue by a listed person at 09:07:02Z (REST merge-async with merge_action: merge_queue), then merged at 09:08:34Z.

    Findings from the same test, for the second item and #17539:

    • REST merge-async into the queue works for a stack layer under a person's token, and is refused for the lanes App token. So that refusal is specific to the App; the App's installation has no merge_queues permission (gh api apps/melodic-automation-lanes). Whether adding it fixes the refusal is untested.
    • GraphQL enablePullRequestAutoMerge is refused for a stack layer under a person's token too ("Auto-merge is not supported for stacked pull requests"), so that route is GitHub's limit for everyone.
    • After a person removes needs-human, the lane adds it back on its next merge-risk pass (06:47Z and 07:47Z here), so the person's enqueue has to follow the removal within about 14 minutes.

    The issue stays open for the second item (the issue lane opening stacked layers), split out to #17539.

    🤖 Generated with Claude Code

  16. kyle-sexton commented on Nov 23, 2026

    @kyle-sexton
    MemberAuthor

    Closing: the merge-lane scope this issue keeps is delivered, and its second done-when line is tracked by #17539.

  17. removed
    host-run
    on Nov 23, 2026
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

    No labels
    No labels

    Fields

    Work status

    confirmed

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions