Repository navigation
fix(watch-pr): wait while GitHub is still computing mergeability - #848
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub reports
mergeable: UNKNOWNfor a while after a push or after the base branch moves, because it recomputes the merge in the background.watch-pronly treatsCONFLICTING(or aDIRTYmerge state) as a conflict, so a PR whose checks and threads are clean but whose mergeability is stillUNKNOWNgets a terminalREADYwithproof.mergeability: "clear". In--stackmode the whole stack clears the same way, and in--queued-stackmode the frontier gets themerge-queuewait that the babysit playbook treats as merge-ready. The playbook defines ready as "the forge agrees the PR can merge", but at that point GitHub has not decided yet, and a PR that turns out to conflict gets reported as merge-ready and the watcher stops.Single and stack decisions now return a
computing-mergeabilitydecision for an otherwise clean open PR whosemergeableisUNKNOWN. It is checked after blockers and pending checks, so conflicts, threads, failing checks, gates and pending CI keep their current precedence.runSimpleemits a non-terminalWAITINGwith reasonmergeability-unknownand polls again on the usual interval. At the deadline it returnsTIMEOUTwith that reason instead of guessing. The queued frontier wait reportsmergeability-unknowninstead ofmerge-queuefor the same state.--prettyrenders both reasons. The CI truth table formergeStateStatus: UNKNOWNis unchanged.Validation: the new
watch-pr/mergeability.test.tscovers single mode (wait, thenREADYonce GitHub settles), the deadline timeout, a stack with one PR still computing, and a queued frontier. All four tests fail onorigin/mainand pass with this change.bun run typecheckpasses, and the watch-pr suite passes exceptrequests and parses fork identity from gh before stack discovery, which hits a 2sspawnSynctimeout on this machine and fails the same way onorigin/main.node scripts/generate-pstack-harness-trees.mjs --check,node scripts/validate-plugins.mjsandgit diff --checkpass.Note
Medium Risk
Changes when automation declares PRs merge-ready across single, stack, and queued modes; incorrect behavior could still stop watchers early or delay merges, but scope is limited to watch-pr polling logic.
Overview
Fixes a false READY when GitHub still has
mergeable: UNKNOWNafter a push or base update—checks and reviews can look clean while mergeability is still being recomputed.Single/stack decisions now treat that state as
computing-mergeability(after blockers and pending CI). The watcher emits non-terminal WAITING withmergeability-unknown, keeps polling, and on timeout returns TIMEOUT instead of claiming merge-ready. Queued-stack frontiers use the same wait reason rather than a merge-queue wait that implied readiness.Types, queue evaluation keys, and
--prettyoutput were extended for the new reason;mergeability.test.tscovers wait→ready, timeout, stack hold, and queued frontier behavior.Reviewed by Cursor Bugbot for commit 99ce4e3. Bugbot is set up for automated code reviews on this repo. Configure here.