Stop gstack-pr-wait, the land gate and the release cut from calling a head green while a check on it failed (GST-2252) (#4257)

* Make gstack-pr-wait, gstack-ci-gate and the release cut count a failed check hidden behind an empty rerun (GST-2252)

GitHub rollup and default check-runs list hold only each check suite latest attempt, so a rerun attempt with no jobs hid the failed run before it, and a workflow run that failed before any job never appeared. All three readers now add CI at the commit as the merge queue reads it (ciAtHead via lib/ci-head-checks.ts) and keep the worse bucket per check. Tests reuse the gstack-evals#303 recording from #4235.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Have the release cut read every check attempt only for commits that pass its named checks (GST-2252)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Say in the changelog that the release cut now counts failed commit statuses (GST-2252)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Let the release cut set its own jobs aside in the every-attempt check read too (GST-2252)

After #4297 the cut sets aside check runs from its own workflow and the Windows nightly by job id, but the rows from lib/ci-head-checks.ts skipped that filter, so the cut waited on its own run. headCheckRows now takes the set-aside check run and workflow run ids and removes them from every list before ciAtHead reads it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-17 10:03:19 +00:00
1 parent 2af3822f94
commit 83cc10acd2
15 files changed
+307 -43

No files matched your search

+10 -3
View File
@@ -13,6 +13,7 @@
* gstack's gh runner shape (lib/ci-gate.ts).
*/
import type { GhResult, GhRunner } from './ci-gate';
import { headCheckRows } from './ci-head-checks';
import { parseHeadChecks, parsePullState, rateLimitKind, type PullState } from './gh-poll';
export class GhError extends Error {
@@ -179,14 +180,20 @@ function restList(env: GhEnv, path: string, key: string): unknown[] {
/**
* Every check on the head commit by name, from REST check runs and commit
* statuses (the same rows `gh pr checks` reads through GraphQL), duplicates
* collapsed to the worst bucket.
* statuses (the same rows `gh pr checks` reads through GraphQL) plus CI at the
* head as gstack-ship-queue ready reads it (lib/ci-head-checks.ts: a failed
* check whose rerun attempt created no jobs, a workflow run that failed with
* no jobs), duplicates collapsed to the worst bucket. An unknown read is a
* transient GhError, so the poll loop tries again.
*/
export function fetchChecks(env: GhEnv, repo: string, head: string): Map<string, Check> {
const rows = parseHeadChecks(
const listed = parseHeadChecks(
restList(env, `repos/${repo}/commits/${head}/check-runs?per_page=100`, 'check_runs'),
restList(env, `repos/${repo}/commits/${head}/status?per_page=100`, 'statuses'),
);
const ci = headCheckRows(args => runGh(env, args), repo, head);
if ('error' in ci) throw new GhError(ci.error, true);
const rows = [...listed, ...ci.rows.map(row => ({ ...row, link: '', description: '' }))];
const checks = new Map<string, Check>();
for (const row of rows) {
const current = checks.get(row.name);