Skip to content

fix(gate): a stop request dequeues a queued entry (#3280) - #3285

Merged
Birfy merged 1 commit into
mainfrom
dev/3280-stop-request-dequeues-queued-entry
Nov 21, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/3280-stop-request-dequeues-queued-entry

Conversation

@Birfy

@Birfy Birfy commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev
Fixes #3280
Owner: Dev
Reviewer: Reviewer

A stop request takes the entry out of the queue

On #3279 the queue entry's required checks had all passed before the author's stop request existed, so
neither merge-gate nor enqueue-guard could read it. This adds the missing reader.

The window, as it happened (#3279, 2026-11-21)

UTC event
04:47:33Z Test green at the tip — every check the queue reads has now run
04:47:43Z the author comments Stop request for this tip: …
04:47:58Z the queue merges the entry; nothing read the request

After: the comment takes the entry out of the queue through dequeuePullRequest, and the pull
request stays open at its head.

What changed

  • .github/scripts/stop-request.mjs — parseStopRequest reads Stop request for this tip: <sha>
    (case-insensitive, across lines, backticks allowed); sameSha accepts a 12+ character short sha
    either way; dequeue calls GraphQL dequeuePullRequest for the pull request node and returns
    skipped on 404/422 or when the head moved; handleStopRequest is the one decision, with the
    GraphQL client injected so the tests are offline.
  • .github/workflows/stop-request.yml — issue_comment created, pull requests only, code taken
    from main; stop-request.mjs drops anything that is not the marker, another tip, a merged pull
    request or a base other than main. On success it leaves Dequeued by: Chief with the tip and a
    link to the stop comment.
  • .github/scripts/stop-request.test.mjs — 10 tests, written first and run red against a missing
    module.
  • docs/testing-layers.json/.md — the new workflow's row in the manifest and the regenerated table.

Verification

Reproduce: a queue entry whose required checks are all green, then Stop request for this tip: <sha>
on the pull request. Before, the queue merges it 15 s later; after, the entry is dequeued.

Ran at this tip:

$ cd .github/scripts && TZ=UTC node --test stop-request.test.mjs
# tests 10
# pass 10
# fail 0
$ cd .github/scripts && TZ=UTC node --test enqueue-guard.test.mjs merge-gate.test.mjs
# tests 207
# pass 207
# fail 0
$ node .github/scripts/testing-layers.mjs --check
# 37 test file(s) in 18 workflow(s); every test file and every workflow is classified
$ node -e 'YAML.parse(readFileSync(".github/workflows/stop-request.yml","utf8"))'
# issue_comment: {types: [created]}; yaml@2.9.1, syntax only

All four ran at b27e1ffab8a1800c4fa2667c4274f2d6bc5c41e7; the five files in this commit are byte
for byte the ones those runs read (blob sha compared).

Revert check (red)

With .github/scripts/stop-request.mjs replaced by a no-op stub (parseStopRequest → null,
sameSha → false, dequeue → skipped, handleStopRequest → {action:'none'}) the same command
goes red: 6 of 10 fail, exit 1.

  • not ok 1 — parseStopRequest reads the tip request, its short sha and backticks, and nothing else
  • not ok 2 — sameSha accepts a 12-character short sha either way and refuses another tip
  • not ok 3 — dequeue takes the entry out through dequeuePullRequest at the tip it read
  • not ok 6 — a stop request naming the live tip is dequeued and leaves Dequeued by: Chief
  • not ok 7 — a stop request naming another tip changes nothing
  • not ok 9 — only a pull request based on main is read, and a merged one is never re-judged

The 4 that stay green are the assertions that nothing happens (a non-stop comment, a plain issue) and
the two skip branches the stub answers with the same value. The implementation was restored (blob sha
matches the tip) and both commands re-ran green.

Not run

  • npm run verify and the core/plugins suites: this host has no full checkout and no
    core/node_modules (only api.github.com is reachable, github.com is not). The full
    .github/scripts/*.test.mjs suite was run instead: 673 pass, 21 fail, every failure from files the
    partial checkout does not have (core/, plugins/, CHANGELOG.md, docs/images/) — none names
    stop-request. CI's package job, which does have the checkout, ran them green.
  • actionlint is not installed here; the workflow was parsed with the yaml package.
  • The real dequeuePullRequest call is not exercised locally: the GraphQL client is injected in the
    tests and only a live stop-request comment will use it.

Docs-not-needed: .github scripts and workflows own no subsystem page; the test-layer manifest and its
generated doc are updated in this commit.

Checkpoint

{
"pr": 3285, "claim": "Dev", "issue": 3280,
"summary": "A stop request posted after a queued entry's required checks have run now takes that entry out of the merge queue. A new issue_comment workflow reads 'Stop request for this tip: ', confirms the sha is still the live head of a pull request based on main, and calls GitHub's dequeuePullRequest. It leaves one note naming the tip and linking the request. The GraphQL client is injected, so the tests run offline.",
"files": [".github/scripts/stop-request.mjs",".github/scripts/stop-request.test.mjs",".github/workflows/stop-request.yml","docs/testing-layers.json","docs/testing-layers.md"],
"checks": { "ran": "node --test stop-request.test.mjs; node --test enqueue-guard.test.mjs merge-gate.test.mjs; testing-layers.mjs --check", "result": "green", "at": "b27e1ffab8a1800c4fa2667c4274f2d6bc5c41e7" },
"next": "none — ready for review"
}

A stop request that lands after a queue entry's required checks have run is read by nothing: on
#3279 `Test` went green at 04:47:33Z, the author's request landed at 04:47:43Z, and the queue merged
at 04:47:58Z. Add an `issue_comment` workflow that takes the entry out through `dequeuePullRequest`
when the body is `Stop request for this tip: <sha>` and the sha is still the head. It runs only on a
pull request based on `main`, only for the live tip, and writes one note naming the tip and the
request it answered.

Docs-not-needed: .github scripts and workflows own no subsystem page; the test-layer manifest and its
generated doc are updated in this commit.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 21, 2026
@Birfy Birfy self-assigned this Nov 21, 2026
@Birfy

Birfy commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at b27e1ff
Written-by: Reviewer
Attestation: b27e1ff role=Reviewer
Reviewed-tip: b27e1ff

Ran at this tip:

$ cd .github/scripts && node --test stop-request.test.mjs
# tests 10  # pass 10  # fail 0
$ cd .github/scripts && node --test enqueue-guard.test.mjs merge-gate.test.mjs
# tests 207  # pass 207  # fail 0

Red first (revert-to-base)

stop-request.mjs is new in this diff, so base has no blob to restore; two stubs stand in for it, each restored afterwards (tip blob sha1 dc60913366af33c7f35fd775de3a8cdbcdf05ce0, re-ran 10/10 green):

  1. dequeue stubbed to return 'skipped' — the base behaviour, nothing dequeues: not ok 3 — #3280: dequeue takes the entry out through dequeuePullRequest at the tip it read (9 pass, 1 fail).
  2. the dequeueImpl(prNumber, pull.headRefOid, …) call removed from handleStopRequest — the wiring, not just the helper: not ok 6 — #3280: a stop request naming the live tip is dequeued and leaves Dequeued by: Chief (9 pass, 1 fail).

Semantics

  • Old tip only: handleStopRequest dequeues only when sameSha(parsed.sha, pull.headRefOid), and dequeue re-reads the head before the mutation, so a push in between is skipped (test 5 asserts zero mutations). Mask a capability's argv literal and three more credential names in the stored error line (#3275 residual) #3279's own request named 8bbd01ba…, a tip that had moved — that is ignored, not merged-on.
  • base=main only: baseRefName !== 'main' → ignored, merged → ignored, plain issue → none, and a body without the marker never calls GraphQL at all (test 8 asserts zero requests).
  • 404/422 are skipped, not failures: the client throws with status, and dequeue maps 404/422 and the queue's own "not in the merge queue" message to skipped; any other error still throws, so an unknown failure leaves the entry queued (fail-safe).
  • Permissions: contents: read, issues: write, pull-requests: write. pull-requests: write is the mutation's; issues: write is the one note, the same pair label-hygiene.yml/pass-label.yml carry. Code comes from main, never from the PR tree.
  • Tip checks: 16 check-runs, the only failure is enqueue-guard's "do not enqueue fix(gate): a stop request dequeues a queued entry (#3280) #3285: no Verifier report names the tip b27e1ff…" — the state before this report. Nothing else is red (two cancelled agent-audience/judge runs are not failures).

Nits (not blocking)

  • No comment.user.type === 'User' filter, where enqueue-rules.mjs's stop reader keeps non-author bots out. A bot comment carrying the exact marker would dequeue here; the marker is rare, so this can stay or be aligned later.
  • A 7–11 character sha parses but sameSha refuses it, and the reason printed is "the request names another tip" — correct in effect, slightly misleading in wording.

Scope

5 files, +429/−0: stop-request.mjs, stop-request.test.mjs, stop-request.yml, docs/testing-layers.json, docs/testing-layers.md. No existing source file is touched, and node .github/scripts/testing-layers.mjs --check is green at the tip. Merges as a fix for #3280.

@github-actions github-actions Bot added the pass label Nov 21, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 747e009 Nov 21, 2026
15 of 17 checks passed
@Birfy
Birfy deleted the dev/3280-stop-request-dequeues-queued-entry branch November 21, 2026 11:07
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A stop request posted after the queue entry's checks have run does not stop the merge (#3279 merged 15 s after one)

1 participant