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

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.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=red-team
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 12:24:05 +00:00
1 parent 25bf93c4e2
commit 7530280407
6 files changed
+27 -3

No files matched your search

+9
View File
@@ -137,6 +137,15 @@ describe('waitForRun', () => {
expect((await o([run(4, { status: 'in_progress', conclusion: null })])).state).toBe('running');
expect((await o([])).state).toBe('none');
});
// Value: protects=the wait agrees with verifyRun (GST-3514): a newer skipped run leaves the green dispatch green; fails_when=the skipped run is read as red
test('a newer skipped run is passed over for the run before it; a lone skipped run is still red', async () => {
const o = (runs: ApiRun[]) => waitForRun(source(runs).deps, { workflow: 'free-tests.yml', events: PROFILE.events, head: HEAD, timeoutMs: 60_000, intervalMs: 20_000, ...clockAt() });
const skipped = run(5, { event: 'pull_request', conclusion: 'skipped', created_at: run(4).created_at });
expect(await o([run(4), skipped])).toMatchObject({ state: 'green', run: { id: 4 } });
expect((await o([run(4, { conclusion: 'failure' }), skipped])).state).toBe('red');
expect(await o([skipped])).toMatchObject({ state: 'red', run: { id: 5 } });
});
});
describe('ship_lanes_from config and the ci_carried receipt field', () => {
+9
View File
@@ -102,6 +102,15 @@ describe('verifyRun', () => {
expect(reason(world({ run: { ...w.run, run_started_at: '2026-10-29T12:00:00Z' }, others: [newer('completed', 'failure')] }))).toBe('newer_run_vetoes');
});
test('a skipped run cannot veto: a pull_request run created in the same second with every job skipped leaves the dispatch green (GST-3514)', () => {
const w = world();
const skipped = (over: Partial<ApiRun> = {}): ApiRun => ({ ...w.run, id: 101, event: 'pull_request', status: 'completed', conclusion: 'skipped', ...over });
expect(reason(world({ others: [skipped()] }))).toBe('ok');
expect(reason(world({ others: [skipped({ event: 'workflow_dispatch' })] }))).toBe('ok');
expect(reason(world({ others: [skipped({ event: 'workflow_dispatch', conclusion: 'failure' })] }))).toBe('newer_run_vetoes');
expect(reason(world({ others: [skipped({ event: 'workflow_dispatch', status: 'in_progress', conclusion: null })] }))).toBe('newer_run_vetoes');
});
test('a newer failure on another head the consumer names (same tree, the lane\'s own head) vetoes too', () => {
const w = world();
const other = 'e'.repeat(40);