fix(source-control): report a babysit merge GitHub queued as queued, and confirm it later - #6148
Conversation
…and confirm it later gh pr merge routes every merge on a merge-queue base into the queue, --auto or not, and exits 0, so a queue the branch-rules read missed was reported as autoMergeEnabled or merged. The gate now reads isInMergeQueue and mergeQueueEntry back after every successful gh pr merge and reports action enqueue with the entry's state and position. With --state-dir an enqueue from either path is recorded, and later runs report it still queued, merged at the vetted head, or dequeued. Closes #5953 Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
Codex Review SummaryThis 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 finished @kyle-sexton's task in 3m 18s —— View job Security review —
|
|
Claude finished @kyle-sexton's task in 7m 26s —— View job Code review complete
SummaryReviewed the diff ( Traced the new queue-handling logic end-to-end:
The logic holds up against the documented contract in One minor doc/code mismatch, posted inline on VerificationI read the changed source and test files and the diff directly; I was not able to execute Not done / out of scope
|
|
claude-security-review has reviewed this pull request through f5f3e7a; a later push is reviewed from there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5f3e7a9a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-review has reviewed this pull request through f5f3e7a; a later push is reviewed from there. |
… not shown yet A successful gh pr merge on a merge-queue base can read back as neither queued, armed, nor merged for a moment. The gate now re-reads it a few times at the async poll interval, then reports merge-pending with ready false and mergeQueue.unconfirmed, and records it under --state-dir as an unconfirmed queue entry. Later runs confirm it (queued, armed, merged) without sending another merge, and the second later run that still sees nothing reports it dequeued so the next run gates it again. Also fixes the queueing typo in a test comment. Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
…e entry Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
…ed entry Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
Summary
On a merge-queue base,
gh pr mergeadds the pull request to the queue (with or without--auto) and exits 0. When the gate's branch-rules read did not report the queue, babysit read that exit code asautoMergeEnabled: true(the--autoarm) ormerged: true(the directgh pr mergepath). gh prints its "will be added to the merge queue" line only on a terminal, so the output text cannot be relied on. An enqueue was also treated as final, so no later run checked whether the queued PR merged or left the queue.Fix
gh pr merge, the gate readsisInMergeQueue,isMergeQueueEnabled,mergeQueueEntry { state position }andautoMergeRequestback over GraphQL (REST exposes neither queue membership nor position).action: enqueue,enqueued: true,autoMergeEnabled: false,merged: false,mergeQueue { state, position }.action: auto-merge,mergeQueue.entersWhenReady: true.action: merge-pending,ready: false,mergeQueue.unconfirmed: true, exit 10, and recorded under--state-diras an unconfirmed queue entry. A failed re-read never turns into a merge.merge.queueReadError.--state-dir, an enqueue from either the async API orgh pr mergeis recorded with the vetted head. Every later run reads it first and sends no new merge:merge-pendingwith the positionmerge-pendingwithmergeQueue.entersWhenReadymerged: truedequeueddequeued: true, record cleared, and the next run gates it again (matchingorchestration.md's "goes back through the gate")safety.md,orchestration.mdandSKILL.mddocument the new fields, with a dated claim record citing the merge-queue docs, thegh pr mergemanual and source, and the GraphQLPullRequestobject. One documented behavior changes: a later--state-dirrun on an already-queued PR now holds asmerge-pending(exit 10) instead of re-enqueueing and reportingenqueued.Verification
pytest plugins/source-control/skills/babysit-prs/scripts/tests: 900 passed, 357 subtests passed (re-run after merging origin/main). The new queue cases fail againstorigin/main'sbabysit_merge.py(17 at the first head) and the 8 unconfirmed-read cases also fail against this PR's previous head; the non-queue controls pass on both.scripts/affected-tests.shselects passes. Clean:run-ruff.sh check,typoson the changed files, markdownlint, andcheck-changelog-parity.sh(--check,--check-order,--check-bump,--check-preserved).read_merge_queueagainst PRs in this repository (ci(issue-triage-label): record why the reusable stays on ci-workflows v0.27.1 #6141, fix(rules): drop the unmatched types glob from the mod-authoring rule #6142, docs(conventions): add the pr-pipeline convention, config schema and lane ADRs #6139) parsedisMergeQueueEnabled: trueand the correct merged state; a nonexistent PR number came back asreadError.Sources: Merging a pull request with a merge queue,
gh pr merge, ghmerge.go,PullRequestGraphQL object.Related
Closes #5953
Follows #5935 (async merge and merge-queue enqueue).