Skip to content

fix(pstack): accept PRs without checks - #316

Closed
liush2yuxjtu wants to merge 3 commits into
cursor:mainfrom
liush2yuxjtu:fix/watch-pr-zero-checks
Closed

fix(pstack): accept PRs without checks#316
liush2yuxjtu wants to merge 3 commits into
cursor:mainfrom
liush2yuxjtu:fix/watch-pr-zero-checks

Conversation

@liush2yuxjtu

@liush2yuxjtu liush2yuxjtu commented Sep 4, 2026

Copy link
Copy Markdown

Why

watch-pr --status-only retries forever when a mergeable pull request has no configured checks. gh pr checks reports that no checks exist, and the GraphQL rollup is empty, but resolveChecks treats every empty result as a query failure.

Scope

  • Adds failing coverage for empty fast-path and GraphQL check results.
  • Lets CheckRead.checks and CiBase.all represent a valid empty check set.
  • Accepts empty checks only when the fast path returns valid empty JSON or gh returns its exact no-checks message, and the GraphQL rollup is also empty.
  • Preserves fail-closed behavior for credential and unrelated exit-1 errors.

Tradeoffs

The no-checks detection depends on the current gh stderr message. If gh changes 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-pr passed 42 tests.
  • bun run typecheck passed.
  • A live watch-pr --status-only run against liush2yuxjtu/pi-debug-mode#2 returned a status table instead of RETRY before a later GitHub API TLS timeout made the external check unavailable.
  • git diff --check passed.

Note

Medium Risk
Behavior for zero-check PRs and new heads after prior CI changed; empty detection depends on a fixed gh stderr string, so a message change would fail closed rather than silently mark CI clean.

Overview
Fixes watch-pr --status-only looping on mergeable PRs that have no CI checks: when both gh pr checks and the GraphQL rollup are empty, the watcher now treats that as a valid empty check set instead of raising ChecksUnavailable.

resolveChecks returns 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.checks and snapshot ci.all are typed as ordinary arrays so ci-clean can carry [].

readSnapshot adds a guard: if the head has no checks but an older commit had passing rollup CI, it throws ChecksUnavailable so 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread pstack/skills/poteto-mode/scripts/watch-pr/github.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

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"
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 09591fc. Configure here.

@liush2yuxjtu

Copy link
Copy Markdown
Author

关闭此 PR。修复和测试已保留在分支 fix/watch-pr-zero-checks;如需继续合并,可重新打开或创建新 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant