Skip to content

perf(pr-merge): skip re-reading a queue-ejected head while it stands unchanged - #17644

Merged
kyle-sexton merged 1 commit into
mainfrom
perf/eam-skip-ejected-head
Nov 20, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
perf/eam-skip-ejected-head

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

No related issue: owner-approved GitHub Optimization item (EAM ejected-head skip, hub D465), recorded in the lane's ledger

Summary

The pr-merge lane's enable-auto-merge.mjs re-reads a lanes App pull request on every sweep, even when the merge queue ejected its head up to merge.max-queue-ejections. Until the head changes, the decision for that head stays the same: "pr-merge's gate would not enqueue it again (queue-ejected:…)". Skip-unchanged now keeps that refusal. While the gate's ejection comment stays unchanged and the skip key matches, later reader runs leave the pull request refused without the verifier read.

Fix

  • .github/scripts/pr-merge/enable-auto-merge.mjs:
    • SKIPPABLE gains pr-merge's gate would not enqueue it again (queue-ejected:. The gate's count-at-cap refusal (babysit_merge.py queue_ejection_refusal) starts with queue-ejected:. The unread-count refusal ("the merge queue's removals of this head are unreadable") does not match, so a failed queue read is never kept.
    • The record gate no longer excludes a refusal that carries the gate's marked comment. It still requires that the run wrote nothing for that pull request, so a run that posts or edits the ejection comment keeps no record.
    • New laneBegan() holds the refusal start-time logic that unarmedStatus() used inline. The marked comment is timed from its last change; the lane comment from its LANE_SINCE line. The skip record's until and the failing-status escalation now read one function, so they cannot disagree. An older lane risk comment at the same head no longer times the ejection hold.
    • EJECTION_HOLD names the reason prefix that ejectionHold() writes and SKIPPABLE matches.
  • .github/scripts/pr-merge/enable-auto-merge.test.mjs: four new tests:
    • an unchanged ejection hold is skipped with 0 detail reads, and a push is read again;
    • a posted or edited comment keeps no record, and neither does an unread, error or missing count;
    • a forged record carrying the unread reason skips nothing;
    • escalation is timed from the gate's comment, not an older lane comment.
  • .changes/pr-pipeline/: a patch fragment.
  • Not changed: babysit_merge_skip.py's SKIPPABLE, which is the Python gate's own skip set and outside this decision.

Verification

  • Before: run 44508309807 (2026-11-19 10:46Z schedule) logged 5 left: pr-merge's gate would not enqueue it again (queue-ejected:…) lines with no refusal write after them. Those five heads took 121 of the run's 146 API requests (the profile's per-PR split of the job log). Run 44559265914 spent 88 requests on 4 ejected heads.
  • Expected after: once a record exists, up to max-skips (3) of the next sweeps leave each ejected head with no read, within max-minutes (60). On 2026-11-19 that is about 500 requests saved (estimate: 0.5 × ~92 verifier-counted calls × 10 runs, plus about 30). The saving only occurs while ejected heads exist; the 2026-11-20 samples so far have none.
  • Merge latency (R1): a skip only repeats a refusal and never arms. A push, a label, a comment, a check or status change, a review, a main-code or config change, or an arm puts the head back into the key and it is read on the next run. The one input outside the key is the gate's infra classification of a removal (babysit_merge.py _infra_removal), where a failed read counts the removal. A refusal that a later read would excuse stands for at most max-minutes (60) or max-skips (3) runs. The owner approved this bound (D13, "Go w/ recommendations" on option b).
  • node --test --test-concurrency=4 .github/scripts/pr-merge/*.test.mjs: 1,011 tests, 1,011 pass, 0 fail.
  • On the unchanged source, the two positive new tests fail (an unchanged queue-ejection hold is left…, …timed from the gate's comment). The guard tests pass both before and after.
  • scripts/check-changelog-fragments.sh --check: all fragments valid.
  • Post-merge check: left, unchanged since … pr-merge's gate would not enqueue it again (queue-ejected: lines in the arm step, and fewer requests per run on sweeps with ejected heads.

Related

  • The Python gate's own skip (babysit_merge_skip.py) keeps its separate refusal set; it is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgdbwavfuWZGmKnMhWX

…unchanged

enable-auto-merge's skip-unchanged now keeps a head at the merge-queue
ejection cap, timed from the gate's ejection comment, so later reader runs
leave it refused without the verifier read until the head or another key
input changes or the skip expires. An unread ejection count is never kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgdbwavfuWZGmKnMhWX
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 20, 2026 14:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T14:09:48.304305Z dc0f794 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed dc0f794787c911c7e9765121bdb93e8935868d90: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no findings

I read every hunk of all three changed files: the changelog fragment, enable-auto-merge.mjs and its test file. enable-auto-merge.mjs is a trusted path and a merge-hold control, so I also read the code that uses skip records.

What the change does. Skip-unchanged can now also keep a refusal that starts with pr-merge's gate would not enqueue it again (queue-ejected:, the hold for a head the merge queue ejected up to its cap. The record gate no longer excludes refusals that carry the gate's marked comment. The start-time logic moves into the new helper laneBegan(), which the skip record's until and the failing-status escalation in unarmedStatus() now both call.

Merge hold: not weakened. A skipped pull request is only ever left refused. The skip path at enable-auto-merge.mjs#L2268-L2273 calls leave(pull, \refused: ${prior.reason}`)andcontinue`s; it has no path that arms. So a skip record, kept or forged, can only repeat a hold. It can never let a pull request through. Checks on the change:

  • Unread ejection count. The skippable prefix is queue-ejected:, so the unread-count refusal ("…removals of this head are unreadable") is not kept. The load filter at L1720 enforces the same prefix on records read back from the artifact.
  • Comment written this run. A record is still kept only when the run wrote nothing for that pull request (sent === sentBefore && failed === failedBefore, L2504). A run that posts or edits the ejection comment keeps nothing.
  • Escalation timing. until is capped at the escalation time from laneBegan(), the same function unarmedStatus() now uses. The failing pr-merge/unarmed status is still reached on time: the skip can delay it by at most max-minutes/max-skips, and it cannot suppress it.

Other surfaces. No token scope, secret handling, trusted-actor, kill-switch or untrusted-text path is touched. There are no workflow or manifest changes.

Spend. The change reduces GitHub API reads per pr-merge sweep and adds no billable resource.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed dc0f794787c911c7e9765121bdb93e8935868d90: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings.

This PR lets enable-auto-merge.mjs skip re-reading a head the merge queue has ejected up to its cap, while the gate's ejection comment stays unchanged. I read all three changed files in full, along with the unchanged code they call: ejectionHold, decide's ejection branch, refusalWrites, sinceAt, loadSkips, skipKey and the skip-record block in main.

  • Record gate: dropping typeof comment !== "string" only affects the ejection hold. It is the only refusal that carries a gate comment (decide, L1601). Risk and pr-unblock holds keep their earlier behaviour.
  • Edited or newly posted comment: refusalWrites writes the comment whenever the marked body differs, so sent === sentBefore keeps any record from being stored for that run.
  • Unread ejection count: the refusal "its merge-queue ejections could not be read" gets no clears: "lane". The "removals … are unreadable" refusal does not match the new queue-ejected: prefix. So neither can be kept, and loadSkips re-checks the prefix, which rejects a forged record too.
  • Timing: laneBegan gives the skip record's until and unarmedStatus the same start time (the comment's updatedAt, or LANE_SINCE). The skip therefore ends when the failing status is due. The inline expression moved into laneBegan behaves exactly as before.
  • Bounds: a skip only repeats a refusal and never arms. It is capped by max-minutes and max-skips, and the skip key covers comment ids and edit times. So this is not a loosened check: it never lets the merge gate accept more.
  • Tests: the four new tests cover a skipped run, a run after a push, a posted or edited comment, unread, errored or missing counts, a forged record, and escalation timing. The author's test run and before/after results are their claim; I could not run them (no shell).

Closing issue: none. The PR says it comes from an owner-approved optimization item, so there are no acceptance criteria to check.

Cost: none. The change only reduces GitHub API requests per pr-merge sweep.

Loosened checks would be marked: fail (default: no loosened_check_verdict:/loosened_check_patterns: lines in the prompt); patterns: 0. There was no loosened_check_decision_record: line either, so the citation requirement was not checked.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 003ed62 Nov 20, 2026
93 checks passed
@kyle-sexton
kyle-sexton deleted the perf/eam-skip-ejected-head branch November 20, 2026 14:25
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant