fix(ci): report why a PR could not be woken instead of guessing - #76
Merged
Conversation
The wake path read `mergeable` from the cached `gh pr list` payload. GitHub computes that lazily and invalidates it whenever the base moves — which is precisely when this workflow runs — so it is often UNKNOWN. A conflicted PR therefore slipped past the CONFLICTING branch and was told it was "already current with main", pointing at close/reopen, which would not have helped. That is this file's own bug class: a skip line that reads plausible and sends the reader somewhere useless. So on failure, ask GitHub for the real mergeable state and name the actual reason — conflict, or genuinely current. One extra API call on a path that only runs when a wake has already failed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #75.
The bug
The wake path decided whether a PR was conflicted by reading
mergeablefrom the cachedgh pr listpayload. GitHub computes that field lazily and invalidates it every time the base branch moves — which is exactly when this workflow runs. The file already documents this trap for the merge path:The wake path did not honour it. A conflicted, check-less PR whose
mergeablereadUNKNOWNskipped theCONFLICTINGbranch, attemptedupdate-branch, failed, and was told:Close/reopen would not have helped — the branch conflicts. That is this file's own bug class: a skip line that reads plausible and sends the reader somewhere useless.
The fix
On failure, ask GitHub for the real
mergeablestate and name the actual reason:main— resolve the conflict (or@dependabot recreate)"main— close/reopen it to force checks"One extra API call, on a path that only runs when a wake has already failed.
Verification
bash -nclean.Githubicon.🤖 Generated with Claude Code