From ae525fc6aec6d5e71cb5f9bf877b17b3ac0d4016 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 17 Jun 2026 07:18:19 -0700 Subject: [PATCH] ci: cancel superseded runs + per-job timeouts on test.yml & e2e.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ports the GH-Actions hygiene gbrain already uses in heavy-tests.yml to the two hot-path workflows. concurrency cancels a superseded run (keyed on PR number for pull_request events — fork-safe — with github.ref fallback for push/scheduled); frees runners and stops a stale-SHA run reporting a flaky failure on an obsolete commit. Per-job timeout-minutes (test matrix 15, verify 12, serial 15, slow-* 12, e2e tier1 20 / tier2 30, trivial jobs 5-10) convert a wedged job from a 6-hour zombie (GitHub's default) into a fast legible fail. fail-fast:false already set. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/e2e.yml | 9 +++++++++ .github/workflows/test.yml | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 556afcf42..3857043ba 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -12,10 +12,18 @@ on: permissions: contents: read +# Cancel a superseded run when a newer commit lands on the same PR/branch. +# PR number for pull_request events (fork-safe), github.ref fallback for +# push/scheduled runs. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: tier1: name: Tier 1 (Mechanical) runs-on: ubuntu-latest + timeout-minutes: 20 services: postgres: image: pgvector/pgvector:pg16 @@ -49,6 +57,7 @@ jobs: # from repo/org secrets. Nightly + manual triggers still supported via # the workflow-level `on:` list. needs: tier1 + timeout-minutes: 30 services: postgres: image: pgvector/pgvector:pg16 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f548af4c2..6a80e4b77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,15 @@ on: permissions: contents: read +# Cancel a superseded run when a newer commit lands on the same PR/branch. +# Keyed on the PR number for pull_request events (unique per PR, so two PRs +# from forks sharing a branch name don't cancel each other) and falls back to +# github.ref for push/scheduled runs. Mirrors heavy-tests.yml; frees runners +# and stops a stale-SHA run from reporting a flaky failure on an obsolete commit. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: # ────────────────────────────────────────────────────────────────────── # cache-check: runs first, computes the content hash of every tracked @@ -29,6 +38,7 @@ jobs: # ────────────────────────────────────────────────────────────────────── cache-check: runs-on: ubuntu-latest + timeout-minutes: 10 outputs: hit: ${{ steps.lookup.outputs.cache-hit }} hash: ${{ steps.compute.outputs.hash }} @@ -72,6 +82,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: @@ -90,6 +101,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 12 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 @@ -110,6 +122,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 @@ -134,6 +147,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 12 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 @@ -156,6 +170,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 12 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 @@ -191,6 +206,7 @@ jobs: needs: cache-check if: needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 15 strategy: fail-fast: false matrix: @@ -220,6 +236,7 @@ jobs: needs: [cache-check, gitleaks, verify, serial-tests, slow-eval-longmemeval, slow-entity-resolve-perf, test] if: success() && needs.cache-check.outputs.hit != 'true' runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Create cache marker run: | @@ -242,6 +259,7 @@ jobs: needs: [cache-check, gitleaks, verify, serial-tests, slow-eval-longmemeval, slow-entity-resolve-perf, test] if: always() runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Aggregate result run: |