Repository navigation
fix(pr-pipeline): hold a native stack layer before the unattended pin and enqueue - #17685
Conversation
… and enqueue
On a merge-queue base the unattended gate posted its pin comment and called
GraphQL enqueuePullRequest on a native stack layer every sweep, and GitHub
refused each time ("This pull request is part of a stack and must be enqueued
using the asynchronous merge REST API"). unattended_enqueue now reads the
`stack` field of the REST pull record the policy already holds and, on a
stack layer, holds with no pin and no enqueue. enable-auto-merge.mjs keeps
the person handoff for the bottom layer.
Refs: #15410
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #17685I found no security issues. What changed. In Trust-control check.
No trust control is widened, no token scope changes, no merge hold is weakened, and no new untrusted text reaches a lane. No plugin manifest or instruction surface is touched. Spend. No new spend: the change removes about 5 API calls per stack layer per sweep and adds none. critical-findings: 0 |
|
claude-review reviewed Code review: PR #17685, hold a native stack layer before the unattended pin and enqueueNo blocking or advisory findings. I read all 4 changed files in full in the diff: the changelog fragment, What I checked
Loosened checks. The change tightens the merge gate and loosens no check. Loosened checks would be marked: fail (default; the prompt gave no Verifier dropped 0 of 0 candidates. |
Refs: #15410
Summary
On a merge-queue base, the unattended merge gate (
babysit_merge.py --unattended --merge, theunattended_enqueuepath) posted its pin comment and called GraphQLenqueuePullRequeston a native stack layer on every sweep. GitHub refuses that call every time: "This pull request is part of a stack and must be enqueued using the asynchronous merge REST API." (sandbox run 44776470784, job Merge, groupPR #398 at 7c2f3ca8…: exit 10; #15410 comment). The cause: the gate reads stack membership only under--stacked-prs, which the pr-merge lane does not pass.Fix
plugins/source-control/skills/babysit-prs/scripts/babysit_merge.pyunattended_enqueue: right after the "already queued or merged" hold, the gate checks whether the PR is a native stack layer. If it is, it holds withunattended merge refused: native-stack-layer: …. It posts no pin comment and calls noenqueuePullRequest.stackfrominputs["pr"], the REST pull record the policy already read (babysit_merge_policy.pull_request,GET repos/{o}/{r}/pulls/{n}). That is the fieldpull_request_stackreads from the same endpoint. Whenstackis null (no stack), the PR enqueues as before.enable-auto-merge.mjsin the same pr-merge run already hands a ready bottom layer to a person: its refusal comment plus the human-gated label. A layer above the bottom getsnone, with no comment, from that script. The gate's hold posts nothing, so the two paths cannot post twice, and no new person request is added.plugins/source-control/reference/stacked-prs.mdnow says the unattended merge path never pins or enqueues a stack layer. The module docstring says the same.source-controlpatch.API calls saved per sweep per stack layer
Counted from the code path skipped after the new check (
unattended_enqueue):POST issues/{n}/commentsGET pulls/{n}for the node id (enqueue_pull_request)enqueuePullRequest(refused)recheck_lane_issue)branch_rules(..., shared=False)per shared base)So each stack layer saves at least 5 calls per sweep (2 writes, at least 3 reads). That happens twice an hour on the :11/:41 sweeps. The merge-base check reads the local clone and makes no API call.
#15410 done-when item 1, as the owner revised it (Q112 A)
The item reads: 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. It posts the refusal comment and
needs-human. A person's enqueue lands the layer.enable-auto-merge.mjs(#17541) on the bottom layer. Upper layers getnone. The gate now holds every stack layer (native-stack-layer), so the gate's half is this PR.enqueuePullRequest, refused in run 44776470784, and the pin comment that preceded it. Tests:test_a_native_stack_layer_gets_no_pin_and_no_enqueueandtest_the_lane_neither_pins_nor_enqueues_a_native_stack_layer.needs-humannote(..., clears: "person"), shown on sandbox PR 398 (run 44680029102). The gate posts nothing more, so the person gets one comment.The one async merge
enable-auto-merge.mjssends per bottom layer (the call GitHub refused in run 44680029102) is #17541's design under the item. This PR does not change it.Verification
python3 plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_merge_unattended.py -k stack: 5 pass. New tests:EachRefusalMakesNoMergeCall.test_a_native_stack_layer_gets_no_pin_and_no_enqueue: exit 10, nogh_capturewrite at all, and thenative-stack-layerblocker.EachRefusalMakesNoMergeCall.test_a_null_stack_still_enqueues: pin, then enqueue.LaneMode.test_the_lane_neither_pins_nor_enqueues_a_native_stack_layer: the same hold under--authority pr-merge.babysit_merge.pychange stashed, both stack-layer tests fail (0 != 10)."stack": nullby default, as GitHub sends it for a PR in no stack. Every existing enqueue test therefore also covers the null case.mainin this environment (AttachEdits,HeadFileFailure,LaneEvidenceReadToken,LaneEvidenceReadTokenOutage, which are lane-evidence token reads). None of them touch this path.bash scripts/check-affected.sh: 19 passed, 1 skipped over the 4 changed files.Remaining
Refs, notCloses.native-stack-layerhold, with no pin comment and noenqueuePullRequestgroup.babysit_merge.pymain()under--stacked-prson a merge-queue base: a stack member goes toasync_merge(merge_action="merge_queue"), which sends GraphQLenqueuePullRequest, and GitHub refuses that for a stack layer. Whether that path should use RESTmerge-asyncfor a person's token is not decided here.Related
enable-auto-merge.mjs(refusal comment plus human-gated label).main.🤖 Generated with Claude Code