Repository navigation
fix(source-control): stop the merge gate failing its force-push read on other timeline items - #15895
Conversation
GitHub's timelineItems totalCount counts every timeline item, whatever itemTypes names, so _force_pushed_heads raised "unread or incomplete" on any lane-source pull request with a timeline item that is not a force push. The listing is now whole only when its last page says hasNextPage: false; a missing or malformed pagination answer raises. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMa43yD6ENjKAwDyeHp3bc
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 #15895, head 41d56e1 (incremental since ce41198)I found no security issues. This was an incremental review, and I read the whole incremental diff for the one file in scope: What changed. One two-line comment in Scope checks.
Prior findings. This lane already reviewed an earlier head ( critical-findings: 0 |
|
claude-review reviewed Code review: no blocking findings. This lane already reviewed an earlier head, so this pass reports blocking findings only. What changed since Not verified by me. I have no shell and ran nothing, so the test results are the author's claim. Closing issue. The PR closes no issue, so there are no acceptance criteria to check. Verifier dropped 0 of 0 candidates. |
A node that is not an object or has no beforeCommit key was skipped as if its old commit were gone, dropping a replaced head whose recorded CRITICAL count the gate must carry. It now raises; a real beforeCommit: null still names no head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMa43yD6ENjKAwDyeHp3bc
The comment described what the code did before the fix; it now states the rule the test pins. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMa43yD6ENjKAwDyeHp3bc
No related issue: lane-merge defect found on #15846 by the hub's hourly sweep 2026-11-13 (the merge gate's force-push read fails on any pull request with other timeline items)
session: GitHub Support
Summary
pr-merge held #15846 (green, reviewed, CLEAN) unarmed with "risk score (unreadable: RuntimeError: #15846 force pushes: unread or incomplete)".
_force_pushed_headsinbabysit_merge.pycompared the force-push nodes it read with the connection'stotalCount. OntimelineItems(itemTypes:[HEAD_REF_FORCE_PUSHED_EVENT]),totalCountcounts every timeline item on the pull request, not only force pushes. So the check raised on every pull request that reaches this read and has any timeline item that is not a force push.Before this fix, a pull request that changes a lane source needing a main-run review could never be armed by the gate; after it, such a pull request arms when its recorded reviews bind, which is the designed behavior.
Fix
_FORCE_PUSHES_QUERYno longer asks fortotalCount, and_force_pushed_headsno longer compares a count with the nodes.hasNextPage: false. A page whosehasNextPageis missing, null or not a boolean now raises. Before, the code treated that as the last page and relied on the count check to catch a short read.beforeCommitkey, now raises "force pushes: unread". Before, the code skipped it as if its old commit were gone. A dropped replaced head loosens the gate, because_main_reviewstakes the highest CRITICAL count across heads. A real{"beforeCommit": null}(the old commit is gone) is still accepted and names no head._FORCE_PUSH_PAGES(10).filteredCountmatched the force-push node count in both samples (0 and 1). It is not used, because the docs describe it as applying only thebefore/afterfilters.scripts/shared-copies.txthas no entry for this file, and it is the onlybabysit_merge.pyin the tree. No SKILL.md or agent body changed, and no eval case loads this script's text (a grep ofplugins/source-control/evalsfinds neitherbabysit_mergenor the error text).Verification
Docs. GraphQL introspection of
PullRequestTimelineItemsConnectiongives these descriptions, which match https://docs.github.com/en/graphql/reference/pulls:totalCount: "Identifies the total count of items in the connection."filteredCount: "Identifies the count of items after applyingbeforeandafterfilters."pageCount: "Identifies the count of items after applyingbefore/afterfilters andfirst/last/skipslicing."itemTypesargument: "Filter timeline items by type."None of these says that a count honors
itemTypes. The fix therefore relies on no count, only on pagination.Measured (owner token, same query shape plus
filteredCountandpageCount), as total / filtered / page count / nodes, with the unfilteredtimelineItems{totalCount}beside it:hasNextPagefalse,endCursornull.HeadRefForcePushedEventwhosebeforeCommit.oidis aa6d097.When the path is reached.
_main_reviewscalls_force_pushed_headsonly whenneeds_main_reviewis true (babysit_review_evidence.py:522). That means the pull request changes a lane source thatreadonly_workflowdoes not clear. Lane sources are paths under.github/workflows/,docs/review/,docs/standards/,.claude-lane/and similar, a.claudepath segment, or a file namedAGENTS.md,CLAUDE.md,.mcp.jsonand the like (LANE_SOURCE_PREFIXESandLANE_SOURCE_NAMES). docs(contracts): add the ecosystem-resolution contract, ADR 0101 and the review rules #15846 changesdocs/review/skills-and-agents.md.Why merges worked before. fix: Add the whole-page sensitivity-control clause to the four cut-proof rules #15845 and fix(scripts): read both generated-region marker forms #15859 change no lane source, so they never reached this read. refactor(ci): simplify pr-review-main.yml workflow (part 2 of 2) #15847 and refactor(ci): simplify pr-require-checks.yml workflow (part 1 of 4) #15870 change workflows, but the owner merged them, not the gate. This is a long-standing bug on a rarely reached path, not a change in GitHub's behavior:
AGENTS.md,CLAUDE.md) failed with "unread or past one page" on 2026-11-01. It has 11 timeline items and 0 force pushes, so it failed on the same mismatch. fix(source-control): page the merge gate's force-push read #11850 treated that as more than 100 force pushes and added paging.totalCountequal to its node count, so no test saw a real answer.Tests, run with
scripts/run-test-file.sh plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_merge.py:test_other_timeline_items_and_no_force_push_read_as_none(docs(contracts): add the ecosystem-resolution contract, ADR 0101 and the review rules #15846, expects[]),test_a_force_push_among_other_items_names_its_head(chore(release): release 77 plugins #15860),test_a_page_with_no_pagination_answer_raises,test_a_page_that_is_not_an_array_raises,test_a_malformed_node_raises, andtest_a_force_push_whose_old_commit_is_gone_names_no_head. The docs(contracts): add the ecosystem-resolution contract, ADR 0101 and the review rules #15846 and chore(release): release 77 plugins #15860 fixtures are the recorded answers, and they keep the extra count fields (totalCount,filteredCount,pageCount) that the hub's measurement query added.test_other_timeline_items_and_no_force_push_read_as_none.test_a_force_push_among_other_items_names_its_head.test_a_page_with_no_pagination_answer_raises, one per subtest.test_names_each_replaced_headandtest_reads_every_page_by_its_cursor, whose fixtures no longer carry a matchingtotalCount.test_a_malformed_node_raises, one per subtest:null,{}, and a string node.test_a_page_that_is_not_an_array_raisesandtest_a_force_push_whose_old_commit_is_gone_names_no_headcover behavior the fix leaves unchanged, so they pass on both versions.test_a_count_the_pages_do_not_reach_raisesis replaced bytest_a_page_with_no_pagination_answer_raises, because the count it tested is the check this fix removes.scripts/run-ruff.sh checkpasses.typosis clean.Live proof to watch: the next pr-merge run on docs(contracts): add the ecosystem-resolution contract, ADR 0101 and the review rules #15846 arms it, and its comment no longer names "force pushes: unread or incomplete".
Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01RMa43yD6ENjKAwDyeHp3bc