Repository navigation
Description
Bug Description
devops pr monitor <n> reported a pull request as ready while one of its checks had failed. The last poll read no check at all (Checks: 0/0 passed (0/0 done)), and the monitor took the empty list as success:
ℹ [427s] Checks: 25/27 passed (25/27 done)
ℹ [508s] Checks: 0/0 passed (0/0 done)
✓ PR #4916 is 100% READY FOR MERGING: All checks passed, reviews complete, 0 unresolved threads.
At that time the check run DevContainer Image of the head commit had the conclusion failure (27 check runs: 23 success, 3 skipped, 1 failure). The monitor exited with status 0.
Suspected cause: _judge_checks in src/devops_cli/github/merge_readiness.py returns with no blocker when head_sha is empty. get_pr_monitoring_status in src/devops_cli/github/pr_monitor.py sets head_sha to "" when the pull request read gives no head.sha. Then the verdict reads no check and has no blocker, and _settled_result reports the pull request as ready. A read that gives no check must fail closed, as CHECKS_UNREAD does for a failed check read.
Steps to Reproduce
- Open a pull request with a check that fails.
- Run
devops pr monitor <n> --timeout 1800while the GitHub API is slow. - A poll reads the pull request with no head commit, or reads no check.
- See
Checks: 0/0 passedand the ready message with exit status 0.
Expected Behavior
A poll that reads no head commit or no check is a poll with no data: the monitor says so and polls again, or fails closed. It never reports ready while a check of the head commit failed.
Existing Tool Considered
No new tool is needed. The fix is in the readiness verdict of devops_cli.github.merge_readiness.
Source: #4916
Alternatives check of 2026-11-15: none.
Tool: none found.
Proposed design
Problem statement
devops pr monitor reports a pull request ready when a poll reads no head commit or no check. _judge_checks returns with no blocker when the head SHA is empty, and an empty check list adds no blocker. The monitor then prints Checks: 0/0 passed and exits 0 while a check of the head commit failed. The fix makes both cases fail closed with a checks_unread blocker, as a failed check read already does.
Acceptance criteria
Requirement: Block on a poll with no head commit
assess_merge_readiness SHALL hold a checks_unread blocker when the pull request payload gives no head commit SHA.
Scenario: Payload with no head SHA
- WHEN the payload of the pull request holds no
head.sha - THEN
MergeReadiness.kindsholdsBlockerKind.CHECKS_UNREADandMergeReadiness.is_readyis False
Requirement: Block on a check read that gives no check
assess_merge_readiness SHALL hold a checks_unread blocker when the read of the head commit gives no check and no unread reason.
Scenario: Head commit with an empty check read
- WHEN the check read of the head commit returns zero items with no
unread_reason - THEN
MergeReadiness.blockersholds one text that starts withPR #<n> check verification failed closed:
Requirement: Keep a failing check as a blocker
assess_merge_readiness SHALL hold a checks_failing blocker when a check run of the head commit has the conclusion failure.
Scenario: One failing check run
- WHEN the head commit holds a non-empty SHA and one check run in the FAIL bucket
- THEN
MergeReadiness.kindsholdsBlockerKind.CHECKS_FAILINGandMergeReadiness.is_readyis False
Requirement: Monitor reports a poll with no check data as not ready
The monitor SHALL report a poll that reads no head commit as not ready, with checks_failed set and exit code 1.
Scenario: Monitor poll with no head SHA
- WHEN
get_pr_monitoring_statusreads a pull request payload with nohead.sha - THEN the status holds
checks_failedTrue and a non-emptyblockers, and the settled result holdssuccessFalse andexit_code1
Existing Tool Considered
No open, maintained tool covers this need. The alternatives check of 2026-11-15 returned the verdict none and found no library that gives a merge-readiness verdict over the check runs of the head commit, or that fails closed on an empty read. The fix stays in the project's own devops_cli.github.merge_readiness. Written cost of that own code: about 20,000 tokens to build, keep and fix the guard and its tests, and about 1 hour of elapsed time.
Key questions
- Why does the monitor report ready when a poll reads no check?:
assess_merge_readinessbuildshead_shafrom thehead.shaof the payload, and_judge_checksreturns with no blocker when it is empty. The verdict then holds no check and no blocker, soMergeReadiness.is_readyis True. [sources: src/devops_cli/github/merge_readiness.py:259, src/devops_cli/github/merge_readiness.py, src/devops_cli/github/pr_monitor.py:523] - Where must the fail-closed guard live?: Put the guard in
_judge_checks.assess_merge_readinessis the one verdict thatdevops pr check-readiness,devops pr readyanddevops pr monitorshare, so each of them fails closed. (best practice) [sources: src/devops_cli/github/merge_readiness.py, src/devops_cli/github/pr_monitor.py:523]- Chosen: Guard in
_judge_checks. Every caller ofassess_merge_readinessgets the same fail-closed verdict. - Rejected: Guard in
get_pr_monitoring_status. It fixes the monitor only, anddevops pr readykeeps the fail-open path. - Rejected: Guard in
_settled_result. The verdict still calls the pull request ready, and only the monitor changes.
- Chosen: Guard in
- Which blocker kind does an empty head SHA or an empty check read use?: Use
BlockerKind.CHECKS_UNREAD, the kind a failed check read uses.CHECK_FAILURE_KINDSalready holds it, soPRMonitorStatus.checks_failedis True and the monitor exits 1 with no other change. (best practice) [sources: src/devops_cli/github/merge_readiness.py:94, src/devops_cli/github/pr_monitor.py]- Chosen:
BlockerKind.CHECKS_UNREAD. It already means a check read that gave no verdict, and each caller maps it to a failure. - Rejected: A new
BlockerKind.CHECKS_EMPTY. Each caller maps blocker kinds to its own exit codes, so a new kind needs a mapping in each caller. - Rejected:
BlockerKind.CHECKS_FAILING. No check failed in this case: the poll read no check.
- Chosen:
- Does a poll that reads no check fail closed or poll again?: Fail closed. The poll gives the
checks_unreadblocker and the monitor exits 1. A pull request with no check data is not merge ready. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, src/devops_cli/github/pr_monitor.py:587]- Chosen: Fail closed with
checks_unread. ADR 0004 refuses a merge with missing CI runs, so a poll with no check data is not ready. - Rejected: Poll again until the timeout. The poll loop has no marker that tells a read with no data from a read with no checks, so the loop can run to the timeout.
- Rejected: Report ready. That is the defect.
- Chosen: Fail closed with
- Which test files cover the guard?: Add the verdict cases to
tests/github/test_merge_readiness.pyand the monitor case totests/github/test_pr_monitor_empty_checks.py. [sources: tests/github/test_merge_readiness.py, tests/github/test_pr_monitor_empty_checks.py, tests/github/test_github_pr_monitor.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(github)scope of the title gives the scope.The monitor can report a PR as ready while a check on the head commit has failed, which defeats the tool's core purpose.A false ready verdict can cause a merge with failing checks, removing the safety the monitor exists to provide.The fix is a guard in one function, _judge_checks, to fail closed when head_sha is empty, as the body already identifies the location.Both address the monitor treating absent checks as success, but #769 fixes a failed API read while the candidate fixes an empty head_sha that skips the check read entirely.dan-petty commentedon Nov 12, 2026
One more occurrence on 2026-11-12:
devops pr monitor 4952 --timeout 1800printed[92s] Checks: 30/31 passed (30/31 done), then[176s] Checks: 0/0 passed (0/0 done), and then reported the pull request ready. The check runs API for the head commit, read after it, gave 27 success and 5 skipped, so the outcome was correct this time. The ready line still came from a poll that read no check.devops-cli-service commentedon Nov 15, 2026
Alternatives check: none
Reason: The searches for a tool that monitors pull-request check runs with a fail-closed readiness verdict returned only unrelated documentation pages, and no open, maintained library covers that verdict. The issue itself asks for no tool: the fix is a guard in the project's own
_judge_checks/_settled_resultso an empty head SHA or an empty check list fails closed.Tool: none found
Lacks:
devops_cli.github.merge_readinessandpr_monitorcode, which an outside tool does not replaceSearches run:
Sources:
Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.
refactor(github): one pull request verdict for all monitors (#5021)
refactor(github): one pull request verdict for all monitors (#5889)
devops-cli-service commentedon Nov 16, 2026
Status set to Ready at fccb781 (see proposed design in issue body).
devops-cli-service commentedon Nov 18, 2026
Released in v0.177.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.177.0
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 16:28 UTC