Skip to content

Stop the merge queue from calling a head green while a check on it failed (GST-2167) - #4235

Merged
capy-ai[bot] merged 6 commits into
mainfrom
ship-queue-counts-hidden-failed-ci-runs
Nov 9, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
ship-queue-counts-hidden-failed-ci-runs

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

The merge queue no longer calls a pull request's CI green while one of its checks actually failed. This serves the goal of only ever merging work whose tests passed.

What changed

The queue's CI read, on three real heads where verdicts changed (from a live probe over 65 recent heads):

Before and after, as text

Before (main):

ci: green at fa756304dfe8 (passed=34 failed=0 pending=0 skipped=17)
ci: red at e9de3a9d8be1 (passed=9 failed=1 pending=0 skipped=0)
ci: none at 1cc98fc92ecb (passed=0 failed=0 pending=0 skipped=0)

After (this branch):

ci: red at fa756304dfe8 (passed=34 failed=1 pending=0 skipped=17)
ci: red at e9de3a9d8be1 (passed=9 failed=6 pending=0 skipped=0)
ci: red at 1cc98fc92ecb (passed=0 failed=7 pending=0 skipped=0)

Why

gstack-evals#303 went READY at 6b30aae with passed=1 failed=0 while its checks job had failed. The queue now sees failed runs that GitHub's default list hides, so a head like that stays red and land refuses it.

Blast radius

ready, land, train land, wave and the post-merge watch all read CI through ciAtHead in lib/ship-queue.ts, so they all change together and nothing else does. A live probe ran the old and new read over 65 real heads, and only three verdicts changed, each to a correct red (script ran).

Summary

GitHub's check-runs list shows only each workflow run's newest attempt by default. On #303 the ci run was rerun, the second attempt created no jobs, and the failed checks run from the first attempt dropped out of the list. The read now asks for every attempt, judges each check suite by its latest attempt that ran jobs, and keeps the newest run per check name as before.

A workflow run that ends before starting any job has no check run at all. The read now also lists the head's workflow runs. A failed run with no jobs counts as a failed check named <workflow> (run <id>, no jobs) unless a later run of the same workflow replaced it. A run cancelled before any job isn't counted. An unreadable list makes the result unknown, never green. docs/ship-policy.md now describes this.

Test Coverage

New ready cases use the #303 shape and its cancelled, timed_out and action_required versions. They also cover a jobless failure with and without a later run, a run cancelled before any job, a stale matrix job, an empty failed rerun and an unreadable runs list. Hold cases check that a green head, a pending check, a skipped check and a rerun that later passed read as before. A land case shows land --pin merged the #303 shape before this change and now refuses with QUEUE_LAND_CHECKS.
Regression proof: the #303 fixture read green and merged on main b51925e. The stale-matrix fixture read ci: red at 1d506e90fa40 (passed=2 failed=1 …) and the empty-failed-rerun fixture read ci: green at e208720cb0a6 (passed=2 failed=0 …) on 7036ee1. All pass after the fix.
Tests: 218 pass, 0 fail across 9 focused files.
Tests ran: tests 1655

Pre-Landing Review

Round 1 found one blocking defect (a run cancelled before any job read as failed), which was fixed with its test. Round 2 and the Step 11 voices found nothing blocking. One granted fix-check found nothing. After review, one scoped reader checked the docs/ship-policy.md edit and found it clean.
REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=3 fixed=3 scope=frozen unbound=3 fix_checks=1 dispatches=8
Gate edits: UNAVAILABLE — this run's record did not keep Step 9's line.
Outside review: GPT-6.1 Sol outside voice completed; its notes are listed below.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL lib/ship-queue.ts:167 No test pins that a completed-cancelled jobless rerun does not replace an earlier jobless failure.
  • INFORMATIONAL lib/ship-queue.ts:169 A workflow run not finished and with no jobs yet adds nothing to the verdict (neither pending nor failed); same as main before this PR.
  • INFORMATIONAL lib/ship-queue.ts:158 A run cancelled before any job at the judged PR head is dropped rather than read as not-run; main before this PR also never saw it.
  • INFORMATIONAL A jobless skipped or neutral run can act as a replacement.
  • INFORMATIONAL Replacement is ordered by created_at, which a rerun keeps.
  • INFORMATIONAL New unknown paths: Actions read scope, the 1000-run cap, and a third strict list.
  • INFORMATIONAL Three paged API calls per poll instead of two.

Exploratory QA

Not run: no user-facing surface. The live probe over 65 real heads stands in for it.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Issues

Refs v1/outside-voice#1
Refs v1/outside-voice#2

Verification Results

Not run: no Step 8.1 obligations were declared for this bug fix.

TODOS

No TODO items completed in this PR.

Documentation

Scope: repair re-audit (attempt 2) of attempt 1's blocker, the ci: counting paragraph in docs/ship-policy.md, checked against lib/ship-queue.ts ciAtHead at a6a32e3.

Result: updated. The paragraph now says ci: reads every attempt of each check suite, judges a suite by its latest attempt that has jobs (earlier attempts only when the latest has none), and keeps the newest run per check name with the existing tie-break, two-apps and commit-status rules. A workflow run that failed with no jobs counts as a failed check <workflow> (run <id>, no jobs) unless a later run of the same workflow replaced it, a run cancelled before any job is not counted, and an unreadable list is unknown, never green.

Debt: none known from this edit. The unreadable-list wording was taken from the brief and not traced in code this round.

Test plan

  • bun run test: CI free-tests run 42707259055 passed (1655 test files) at 718218b
Agent notes

Approvals

Approved: yes (record r-5a351186a754). The full approval record stays private.
Plan: exempt: bug fix
Plan check: exempt bug fix

REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=3 fixed=3 scope=frozen unbound=3 fix_checks=1 dispatches=8

Refs GST-2167

{
  "schema_version": 1,
  "pr": 4235,
  "head": "718218b20096a7f83bbdee4c07aa599df7b37c19",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 1655,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 42707259055,
      "attempt": 1,
      "tree": "27679311dda992ec57ad0f60a9711ff084d0b6d0"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "27679311dda992ec57ad0f60a9711ff084d0b6d0",
  "product_patch_id": "a6ddcb18aae0cdcf8b5c27478b69f9e4a3dd5a52",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 68,
    "rules": "66e5174161eecc2c",
    "base": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "registry": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "gate_scan": {
      "tagged": 0,
      "head": "718218b20096a7f83bbdee4c07aa599df7b37c19"
    },
    "reasons": [
      "gate-class",
      "runtime=68"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @27679311dda9 (8 checks, current for 718218b20096)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42707259055/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=27679311dda9 tests=36883 skipped=68 runs=42707259055/1 profiles=ci-reuse/free-tests heads=718218b20096 verified=2026-11-09T22:17:49.506Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ship-policy.md ci: counting paragraph (checked against lib/ship-queue.ts ciAtHead)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 3,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "unbound": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  }
}

…iled (GST-2167)

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

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 9, 2026 19:10
…, and keep a jobless failure counted until its replacement starts (GST-2167)

A concurrency group cancels a pending run when a newer one at another SHA arrives, so the main backstop at 526f604 and 5fdfa14 would have read red forever. A replacing run that is still queued with no jobs no longer hides the failure before it. Adds a test that an unreadable workflow-runs list is unknown.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 3 commits November 9, 2026 21:06
…n clears a dropped matrix failure and an empty failed rerun stays red (GST-2167)

ciAtHead now reads check runs with the default filter and with filter=all. A suite the default list names is judged by that list alone; a suite only filter=all names is judged by its earlier attempts, and its workflow run counts as a failed check with no jobs when it failed and nothing in the suite already counts the failure.

Review-Finding: v1/outside-voice#1 reader=outside-voice
Review-Finding: v1/outside-voice#2 reader=outside-voice
Review-Finding: v1/adversarial-native#1 reader=adversarial-native
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nce in it (GST-2167)

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit a5bcbc4 into main Nov 9, 2026
77 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 17, 2026
… 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>
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