fix(pstack): accept PRs without checks - #316
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 09591fc. Configure here.
| else if (checks.checks.length === 0 && merge.hadPreviousPassingCi) | ||
| throw new ChecksUnavailable( | ||
| "PR head has no checks yet after a previously checked commit" | ||
| ); |
There was a problem hiding this comment.
Prior SUCCESS fail-closes empty checks
Medium Severity · Logic Bug
readSnapshot throws ChecksUnavailable for a confirmed-empty check list whenever any non-head commit rollup is SUCCESS. Settled heads with no runs after skipped or path-filtered workflows match that predicate, so pollUntilTerminal retries and then emits a status-query BLOCKER instead of ci-clean. --status-only never prints a table.
Reviewed by Cursor Bugbot for commit 09591fc. Configure here.
|
关闭此 PR。修复和测试已保留在分支 fix/watch-pr-zero-checks;如需继续合并,可重新打开或创建新 PR。 |


Why
watch-pr --status-onlyretries forever when a mergeable pull request has no configured checks.gh pr checksreports that no checks exist, and the GraphQL rollup is empty, butresolveCheckstreats every empty result as a query failure.Scope
CheckRead.checksandCiBase.allrepresent a valid empty check set.ghreturns its exact no-checks message, and the GraphQL rollup is also empty.Tradeoffs
The no-checks detection depends on the current
ghstderr message. Ifghchanges that text, the watcher fails closed and reports a query blocker instead of treating an error as clean CI.Blast Radius
The change affects PRs with zero checks. PRs with passing, pending, failed, or hidden GitHub rollups keep the existing paths. No plugin prompt or workflow text changes.
Verification
Before the fix, three focused tests failed with
ChecksUnavailable.After the fix:
bun test watch-prpassed 42 tests.bun run typecheckpassed.watch-pr --status-onlyrun againstliush2yuxjtu/pi-debug-mode#2returned a status table instead ofRETRYbefore a later GitHub API TLS timeout made the external check unavailable.git diff --checkpassed.Note
Medium Risk
Behavior for zero-check PRs and new heads after prior CI changed; empty detection depends on a fixed
ghstderr string, so a message change would fail closed rather than silently mark CI clean.Overview
Fixes
watch-pr --status-onlylooping on mergeable PRs that have no CI checks: when bothgh pr checksand the GraphQL rollup are empty, the watcher now treats that as a valid empty check set instead of raisingChecksUnavailable.resolveChecksreturns an empty list only if the fast path is valid empty JSON or exit code 1 with GitHub’s exact “no checks reported on the … branch” stderr and the rollup paginates to zero checks; unrelated exit-1 errors (e.g. integration access) still fail closed.CheckRead.checksand snapshotci.allare typed as ordinary arrays soci-cleancan carry[].readSnapshotadds a guard: if the head has no checks but an older commit had passing rollup CI, it throwsChecksUnavailableso a fresh push is waited on rather than marked clean. New tests cover empty-check acceptance, unrelated fast-path failures, no-check PR classification, and the post-push wait case.Reviewed by Cursor Bugbot for commit 09591fc. Bugbot is set up for automated code reviews on this repo. Configure here.