Skip to content

A skipped CI run no longer blocks reusing a passing run on the same commit (GST-3514) - #4695

Merged
capy-ai[bot] merged 3 commits into
mainfrom
ci-reuse-skipped-run-no-veto
Nov 22, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
ci-reuse-skipped-run-no-veto

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

When one commit gets two runs of the same workflow and the newer one skipped every job, the passing run can now be reused, and the CI wait no longer reports that commit red.
gbrain hit this when a pull request run that skipped all its jobs, created in the same second as a passing manual run, blocked that passing run.
Nothing to do: a newer failed, cancelled or still-running run still blocks reuse exactly as before.

What changed

  • The newer-run check in verifyRun (lib/run-evidence.ts) now ignores a newer run whose conclusion is skipped, just as it already ignored a newer green run. A skipped run ran no job, so it says nothing about the commit's tree.
  • waitForRun (lib/ci-carry.ts), which gstack-ci-carry wait and gstack-ship-release accept use, now passes over a newer skipped run and waits on the run before it. When every run on the commit was skipped, it still reports red, as before.
  • docs/pregate.md says which newer runs block reuse and which don't, and the changelog entry covers both commands.

Why

A run that never ran a job isn't evidence against the tree, but it was treated like a failure. A newer red or running run of any event still blocks reuse, including the documented case where a red pull request run blocks reusing a manual run (docs/pregate.md, the CI tree reuse section).

Blast radius

Only the CI reuse check and the CI wait read the change. Both still refuse a commit whose newer run failed, was cancelled or is still running, so a red run can't be reused.

Pre-Landing Review

One review pass on the whole change: a combined specialist reader (testing, security, state machines, red team) and a second adversarial reader. The specialist reader found that the CI wait still read a newer skipped run as red, so accept would have stopped in the same case this PR fixes. That is fixed with a test that failed first, and a second read of just the fix found nothing. The adversarial reader found nothing blocking; its three notes are below.

Review notes

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

  • INFORMATIONAL lib/ci-carry.ts:179 When every run on the head is skipped, waitForRun still returns red with an empty failing list (pre-existing; the fallback keeps it).
  • INFORMATIONAL [ADVISORY] docs/pregate.md:907 The docs and changelog describe only verifyRun's veto; the wait now passes over a skipped newest run to an older run, which they don't mention.
  • INFORMATIONAL lib/ci-carry.ts:78 findCarry cuts HEAD's runs to CANDIDATES before skipped runs are dropped, so a burst of skipped runs could push the green run out of the window (pre-existing).

Documentation

Scope: base 0b4f0ceee to head 0fbc61d89 on branch ci-reuse-skipped-run-no-veto (3 commits, 6 files), with no staged, unstaged or untracked changes. I ran Steps 1, 1.5, 2–4 and 6. The banned-terms check returned none because main keeps no list.

Result: the docs are current and I made no edits. The branch stops a newer skipped run from triggering newer_run_vetoes in lib/run-evidence.ts, and waitForRun in lib/ci-carry.ts now passes over completed skipped runs when it picks the newest run.

  • docs/pregate.md §run evidence (~l.907) already says newer skipped runs don't veto, which matches the code.
  • The same-tree-commits paragraph (~l.1158) says "a newer red or running run vetoes", which is still accurate.
  • The newer_run text at l.1752 belongs to the flaky-exception check in lib/pregate/flaky-exception.ts, which the branch doesn't touch, so it isn't stale.
  • The verdict-reuse section of docs/TESTING_INTERNALS.md describes a different mechanism and isn't affected.
  • The changelog fragment is accurate and stays unchanged, as the brief requires.

Debt: none found.

Tests

  • New case in test/run-evidence.test.ts: a same-second skipped pull request run and a skipped manual run no longer block reuse. Negative controls: a newer failed or running manual run still does. The case failed with newer_run_vetoes before the fix.
  • New case in test/ci-carry.test.ts: the wait passes over a newer skipped run to the green run before it, a newer skipped run beside a failed one is still red, and a lone skipped run is still red. It failed before the fix.
  • test/run-evidence, test/ci-carry, test/ci-tree-reuse and test/ship-ci-carry: 130 pass, 0 fail. The full free suite ran in CI (Free Tests run 45003784713), green at this head.
Agent notes

Refs GST-3514. Reported from GBRA-742 (gbrain run 44996312498 vetoed by skipped run 44996312697). The second clause of the issue, about a run whose event the profile doesn't accept never blocking reuse, was dropped by GStack Minder's ruling, because it would undo the documented red pull_request veto in scripts/ci-tree-reuse.ts.

Approvals

No approvals recorded for branch ci-reuse-skipped-run-no-veto.
Plan: exempt: bug fix with a failing-first test (GST-3514)
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=3 fixed=1 scope=frozen ledgers_read=4 fix_checks=1 dispatches=1

{
  "schema_version": 1,
  "pr": 4695,
  "head": "0fbc61d89040e694333f393ff2c4d27a0b8dbb02",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1745,
      "fail": 0,
      "skip": 0
    },
    "focused": {
      "pass": 130,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 45003784713,
      "attempt": 1,
      "tree": "2510f2622a8dd85096aadd200c55c7970a2d491e"
    }
  ],
  "calls": 33,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/ship-ci-reuse-skipped-run-no-veto",
  "head_tree": "2510f2622a8dd85096aadd200c55c7970a2d491e",
  "product_patch_id": "45c3119b0262ca579252da57f2f9dcc0ef19ef4f",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 11,
    "rules": "630fd3101899e28e",
    "base": "0b4f0ceeec19fef62480db6c8eb00c4015380a39",
    "registry": "0b4f0ceeec19fef62480db6c8eb00c4015380a39",
    "gate_scan": {
      "tagged": 0,
      "head": "0fbc61d89040e694333f393ff2c4d27a0b8dbb02"
    },
    "reasons": [
      "runtime=11"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @2510f2622a8d (8 checks, current for 0fbc61d89040)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45003784713/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45003784782/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=2510f2622a8d tests=38834 skipped=72 runs=45003784713/1 profiles=ci-reuse/free-tests heads=0fbc61d89040 verified=2026-11-22T09:12:56.148Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (docs/pregate.md run-evidence and same-tree sections, docs/TESTING_INTERNALS.md, the changelog.d fragment)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 3,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 1,
    "ledgers_read": 4,
    "dispatches": {
      "specialist": 1
    }
  },
  "gate_dispositions": []
}

Open in Capy

…ommit (GST-3514)

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

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 22, 2026 08:25
gstack-ci-carry wait and ship-release accept picked the newest run on the head, so a same-second pull_request run with every job skipped read as red even though verifyRun now accepts the green dispatch beside it. The wait now takes the newest run that was not skipped; a lone skipped run is still red.

Review-Finding: p1/specialist-batched#1 reader=red-team
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>
@capy-ai
capy-ai Bot merged commit 7530280 into main Nov 22, 2026
53 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 22, 2026
…call checks clear only at the exact commit (GST-3554) (#4713)

A newer CI run that concluded `neutral` no longer blocks reusing a
passing run on the same commit, and a check that only runs inside
another workflow (`workflow_call`) now clears only from a run that
tested your exact commit.

Why: gbrain kept hitting `newer_run_vetoes` on passing runs (#9827,
#10058, #10021), and a calling workflow's green run from any commit
could clear such a check.

Nothing to do: gbrain's skipped-run case was already fixed on main by
#4695; this adds `neutral`, the exact-commit rule and regression tests
built from gbrain's real runs.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/outside-voice#1 reader=outside-voice
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