Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

ci: bound every workflow job so one hang cannot hold main's CI slot for 6h (#770) (#906)

xerj-org47feaceda4c3
diff --git a/.github/scripts/workflow-timeout-guard.py b/.github/scripts/workflow-timeout-guard.py
new file mode 100644
index 000000000..8d5f8f135
--- /dev/null
+++ b/.github/scripts/workflow-timeout-guard.py
@@ -0,0 +1,267 @@
+#!/usr/bin/env python3
+"""Every GitHub Actions job in this repo must declare its own `timeout-minutes`.
+
+Why this gate exists (#751 -> #770)
+-----------------------------------
+A job with no `timeout-minutes` inherits GitHub's default of 360 minutes. That
+default is not a safety net here, it is the blast radius: several of this repo's
+workflows serialise on a concurrency group that never auto-cancels --
+
+ ci.yml group `ci-CI-refs/heads/main`, cancel-in-progress: false
+ deploy-pages.yml group `pages-deploy`, cancel-in-progress: false
+ release-metrics group `release-metrics`, cancel-in-progress: false
+
+-- so ONE hung job holds that group's slot for hours and every later run queues
+behind it. That is not hypothetical: on 2026-08-25 the #751 engine deadlock ran
+`build-test` into the 360-minute default and was killed by it (run 32796557309,
+01:21:28 -> 07:21:44, while every other job in that run finished inside 18
+minutes), and a second hang the same morning held the slot 11:28 -> 17:03 while
+seven consecutive pushes to main were discarded having run ZERO jobs. #899 fixed
+that particular deadlock; it did not shrink the 6-hour exposure of the other 22
+jobs, which is what #770 asked for.
+
+Bounding every job turns "main has no CI verdict for six hours" into "one job
+fails in at most `MAX_TIMEOUT` minutes and `gh run rerun --failed` recovers it".
+
+The rules
+---------
+1. Every job declares a job-level `timeout-minutes`.
+2. The value is an integer in [1, MAX_TIMEOUT]. The upper bound is what makes
+ the gate mean something: a job allowed 300 minutes would satisfy rule 1 and
+ still hold a slot all afternoon.
+3. Parser self-check: every block this script treats as a job must contain
+ `runs-on:` or `uses:`. If a workflow file's shape ever drifts away from what
+ the parser below assumes, that check fails loudly instead of the guard
+ silently passing over jobs it never saw.
+
+The one exemption is a job that calls a reusable workflow (`uses:` at job
+level): GitHub rejects `timeout-minutes` on those outright, so the cap has to
+live on the jobs inside the called workflow. This repo has none today.
+
+Stdlib only, on purpose: this runs as a merge gate, and a gate that needs
+`pip install` on a hosted runner is a gate that can fail for reasons that have
+nothing to do with the tree (the same rule the SEO gate follows).
+
+Usage:
+ python3 .github/scripts/workflow-timeout-guard.py [--dir .github/workflows]
+ python3 .github/scripts/workflow-timeout-guard.py --self-test
+"""
+
+from __future__ import annotations
+
+import argparse
+import re
+import sys
+from pathlib import Path
+
+# GitHub's own default is 360. Nothing in this repo has ever legitimately needed
+# more than ~50 min: over 3 873 job executions across the last ~245 CI runs the
+# two heaviest are `Autoindex FD smoke (windows-latest)` at 49.6 and
+# `Build + Test` at 48.3, and release.yml's slowest cross-compile leg is 38.3
+# over 27 runs. 90 leaves room for a cold dependency cache on the heaviest job
+# while still being 4x below the default.
+MAX_TIMEOUT = 90
+
+# A job id: exactly two spaces of indent, a key, nothing else on the line.
+JOB_RE = re.compile(r"^ ([A-Za-z_][A-Za-z0-9_.-]*):\s*(#.*)?$")
+# A job-level key: exactly four spaces of indent. Step-level keys live at eight
+# or more, so `timeout-minutes` on a *step* can never satisfy this gate -- which
+# matters, because ci.yml already has one (build-test's 12-minute step-6 cap)
+# and it does not bound the job.
+JOB_KEY_RE = re.compile(r"^ ([A-Za-z_][A-Za-z0-9_.-]*):\s*(.*?)\s*(?:#.*)?$")
+
+
+class ParseError(Exception):
+ pass
+
+
+def parse_jobs(text: str, where: str) -> list:
+ """Return [(job_id, {job-level key: raw value})] for one workflow file.
+
+ Deliberately a small line parser rather than a YAML load: see the module
+ docstring. It relies on this repo's uniform 2-space workflow style, and
+ rule 3 above is what detects it if that ever stops holding.
+ """
+ lines = text.split("\n")
+ start = None
+ for i, ln in enumerate(lines):
+ if re.match(r"^jobs:\s*(#.*)?$", ln):
+ start = i
+ break
+ if start is None:
+ raise ParseError(f"{where}: no top-level `jobs:` block")
+
+ jobs = []
+ current = None
+ for ln in lines[start + 1 :]:
+ if not ln.strip() or ln.lstrip().startswith("#"):
+ continue
+ indent = len(ln) - len(ln.lstrip())
+ if indent == 0:
+ break # back out to the next top-level key
+ m = JOB_RE.match(ln)
+ if m:
+ current = {}
+ jobs.append((m.group(1), current))
+ continue
+ if current is None:
+ raise ParseError(f"{where}: content before the first job: {ln!r}")
+ km = JOB_KEY_RE.match(ln)
+ if km:
+ current.setdefault(km.group(1), km.group(2))
+ if not jobs:
+ raise ParseError(f"{where}: `jobs:` block contains no jobs")
+ return jobs
+
+
+def check_workflow(path: Path, text: str) -> list:
+ where = path.as_posix()
+ problems = []
+ for job_id, keys in parse_jobs(text, where):
+ # Rule 3 first: if this is not really a job, everything else is noise.
+ if "runs-on" not in keys:
+ if "uses" in keys:
+ # A job that calls a reusable workflow. GitHub REJECTS
+ # `timeout-minutes` on those ("Unexpected value"), so requiring
+ # one here would demand an invalid workflow; the cap has to go
+ # on the jobs inside the called workflow instead.
+ continue
+ problems.append(
+ f"{where}: job `{job_id}` has neither `runs-on:` nor `uses:` -- "
+ f"the guard's parser is out of step with this file; fix the "
+ f"parser rather than the workflow"
+ )
+ continue
+ raw = keys.get("timeout-minutes")
+ if raw is None:
+ problems.append(
+ f"{where}: job `{job_id}` has no `timeout-minutes:` and so "
+ f"inherits GitHub's 360-minute default (see #770)"
+ )
+ continue
+ try:
+ value = int(raw)
+ except ValueError:
+ problems.append(
+ f"{where}: job `{job_id}` has a non-integer "
+ f"`timeout-minutes: {raw}`"
+ )
+ continue
+ if not 1 <= value <= MAX_TIMEOUT:
+ problems.append(
+ f"{where}: job `{job_id}` has `timeout-minutes: {value}`, "
+ f"outside the allowed 1..{MAX_TIMEOUT}"
+ )
+ return problems
+
+
+def run(workflow_dir: Path) -> int:
+ files = sorted(p for p in workflow_dir.iterdir() if p.suffix in (".yml", ".yaml"))
+ if not files:
+ print(f"error: no workflow files under {workflow_dir}", file=sys.stderr)
+ return 1
+ problems = []
+ jobs_seen = 0
+ for path in files:
+ text = path.read_text(encoding="utf-8")
+ try:
+ jobs_seen += len(parse_jobs(text, path.as_posix()))
+ except ParseError as exc:
+ problems.append(str(exc))
+ continue
+ problems.extend(check_workflow(path, text))
+ if problems:
+ for p in problems:
+ print(f"::error::{p}")
+ print(
+ f"\n{len(problems)} problem(s) across {len(files)} workflow file(s). "
+ f"Every job needs `timeout-minutes:` (1..{MAX_TIMEOUT}); a job "
+ f"without one can hold a non-cancelling concurrency slot for 6 hours.",
+ file=sys.stderr,
+ )
+ return 1
+ print(
+ f"ok: {jobs_seen} job(s) across {len(files)} workflow file(s) "
+ f"all declare timeout-minutes <= {MAX_TIMEOUT}"
+ )
+ return 0
+
+
+# --------------------------------------------------------------------------
+# Self-test: the guard is itself load-bearing logic, so it ships with fixtures
+# for the ways it could be wrong -- missing a violation, inventing one, or
+# accepting a STEP-level timeout as if it bounded the job.
+# --------------------------------------------------------------------------
+_GOOD = """\
+name: X
+on: [push]
+jobs:
+ alpha:
+ name: A
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - run: echo hi
+ beta:
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ steps:
+ - name: s
+ timeout-minutes: 5
+ run: |
+ echo " not-a-job: true"
+"""
+
+_MISSING = _GOOD.replace(" timeout-minutes: 15\n", "")
+_STEP_ONLY = _GOOD.replace(" timeout-minutes: 60\n", "")
+_TOO_BIG = _GOOD.replace(" timeout-minutes: 15", " timeout-minutes: 300")
+_NOT_A_JOB = _GOOD.replace(" runs-on: ubuntu-latest\n timeout-minutes: 15\n", "")
+_REUSABLE = _GOOD.replace(
+ " runs-on: ubuntu-latest\n timeout-minutes: 15\n",
+ " uses: ./.github/workflows/other.yml\n",
+)
+
+
+def self_test() -> int:
+ fake = Path("fixture.yml")
+ cases = [
+ ("good", _GOOD, 0),
+ ("job missing timeout-minutes", _MISSING, 1),
+ ("only a step-level timeout-minutes", _STEP_ONLY, 1),
+ ("timeout above the cap", _TOO_BIG, 1),
+ ("block that is not a job", _NOT_A_JOB, 1),
+ ("reusable-workflow call is exempt", _REUSABLE, 0),
+ ]
+ failures = 0
+ for label, text, want in cases:
+ got = len(check_workflow(fake, text))
+ status = "ok " if got == want else "FAIL"
+ if got != want:
+ failures += 1
+ print(f"{status} {label}: expected {want} problem(s), got {got}")
+ # The parser must see exactly the two jobs, not the `run:` block's decoy.
+ ids = [j for j, _ in parse_jobs(_GOOD, "fixture.yml")]
+ if ids != ["alpha", "beta"]:
+ print(f"FAIL parser found jobs {ids}, expected ['alpha', 'beta']")
+ failures += 1
+ else:
+ print("ok parser finds exactly the real jobs")
+ print("self-test:", "PASS" if failures == 0 else f"{failures} FAILURE(S)")
+ return 1 if failures else 0
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description="Job-timeout guard for .github/workflows")
+ ap.add_argument("--dir", default=".github/workflows")
+ ap.add_argument("--self-test", action="store_true")
+ args = ap.parse_args()
+ if args.self_test:
+ return self_test()
+ return run(Path(args.dir))
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d44c25e0f..e16214a95 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,6 +36,7 @@ jobs:
cla-config:
name: CLA gate config
runs-on: ubuntu-latest
+ timeout-minutes: 15
permissions:
contents: read
pull-requests: read
@@ -77,6 +78,7 @@ jobs:
reference-coding:
name: Reference-coding toolkit
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -109,6 +111,7 @@ jobs:
landing-constants-guard:
name: Landing constants guard
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
@@ -117,6 +120,54 @@ jobs:
- name: Landing page constants agree with the newest release
run: bash .github/scripts/landing-constants-guard.sh
+ # #770. A job with no `timeout-minutes` runs against GitHub's 360-minute
+ # default, and 22 of this repo's 23 jobs had none. Three of its workflows
+ # serialise on a concurrency group that never auto-cancels
+ # (`ci-CI-refs/heads/main` here, `pages-deploy`, `release-metrics`), so one
+ # hung job holds that slot for hours and every later push queues behind it.
+ # Measured, not hypothetical: on 2026-08-25 the #751 hang ran `Build + Test`
+ # into the 360-minute default and was killed by it (run 32796557309,
+ # 01:21:28 -> 07:21:44; every other job in that run finished inside 18 min),
+ # and a second hang the same morning held the slot 11:28 -> 17:03 while seven
+ # consecutive main pushes were discarded having run ZERO jobs. #899 fixed that
+ # particular deadlock; the 6-hour exposure of every OTHER job is what #770 was
+ # still asking about, and these caps plus the guard below are what close it.
+ #
+ # The caps are sized in three tiers, from the measured duration of every
+ # successful-or-failed job execution across the last ~245 CI runs (3 873 job
+ # executions) and 27 release runs:
+ # 15 min — installs no toolchain, compiles nothing (max 2.3 min repo-wide)
+ # 30 min — installs a toolchain or a third-party
+ # binary, compiles no workspace member (max 3.8 min)
+ # 60 min — compiles workspace crates (max 48.3 min)
+ # Two jobs sit above their tier for measured reasons, each argued where it is
+ # set: `autoindex-fd-smoke` at 75 (its windows-latest leg has the heaviest
+ # tail here, max 49.6 min) and release.yml's cross-compile matrix at 75.
+ # The point is not to tune each job to its median — a cap that false-fails a
+ # slow-but-healthy run is worse than the hang it guards against, which is why
+ # #780 widened build-test's from 50 to 60. It is to put every job at least 4x
+ # below the 360-minute default so no single hang costs main an afternoon
+ # again. Job timeouts start when the job STARTS EXECUTING, not when it is
+ # queued, so runner-slot contention cannot spend any of the budget. That
+ # contention is real and larger than it looks -- over 2 835 job executions the
+ # wait from created to started is a 4-second median but a 417-second p90, a
+ # 1 661-second p99 and a 2 202-second max, with 27% of jobs waiting over a
+ # minute. It inflates a RUN's wall clock (which is what a reader mistakes for
+ # a hang) and never a job's timeout, so no cap here can false-fail because the
+ # runners were busy.
+ workflow-timeouts:
+ name: Workflow job-timeout guard
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+
+ - name: Guard's own unit tests
+ run: python3 .github/scripts/workflow-timeout-guard.py --self-test
+
+ - name: Every workflow job declares a bounded timeout-minutes
+ run: python3 .github/scripts/workflow-timeout-guard.py
+
# #474: the rc.18 release PR (#460) shipped three note-vs-tree contradictions
# with the branch 16/16 green every time - a fix credited with more than it
# did (#361), ROADMAP.md contradicting the CHANGELOG in the same commit, and
@@ -130,6 +181,7 @@ jobs:
release-notes-gate:
name: Release notes match the tree
runs-on: ubuntu-latest
+ timeout-minutes: 15
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -148,6 +200,7 @@ jobs:
lint:
name: Format + Clippy
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -184,6 +237,7 @@ jobs:
workspace-resolves:
name: Workspace resolves (links + lockfile)
runs-on: ubuntu-latest
+ timeout-minutes: 30
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -208,6 +262,7 @@ jobs:
security-audit:
name: Dependency advisory audit (cargo-audit)
runs-on: ubuntu-latest
+ timeout-minutes: 30
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -244,6 +299,7 @@ jobs:
fuzz:
name: Fuzz harnesses (cargo-fuzz)
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -405,6 +461,7 @@ jobs:
release-build:
name: Release build (fat LTO, all members link)
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -423,6 +480,7 @@ jobs:
onnx-feature:
name: ONNX feature compile + tests
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -455,6 +513,7 @@ jobs:
api-checks:
name: API smoke + liveness + benchmark
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -495,6 +554,7 @@ jobs:
conformance:
name: ES-compat YAML conformance
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -590,6 +650,7 @@ jobs:
ux-tests:
name: UX pipeline tests
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -612,6 +673,7 @@ jobs:
usecase-smoke:
name: Use-case harnesses (brain + MCP + autoindex)
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -683,6 +745,14 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
+ # Tier 3 plus 15 minutes, and the exception is measured rather than felt:
+ # the windows-latest leg has the widest spread of any job here — over 204
+ # runs, median 18.8 min, p95 37.6, max 49.6 (ubuntu 15.6, macOS 22.2). At
+ # 60 that is 1.21x its worst observed run, thinner than `Build + Test`'s
+ # 1.24x and on a much heavier tail, so a slow-but-healthy Windows runner
+ # could false-fail. 75 is 1.51x, and still 4.8x below the 360-min default
+ # that is what actually matters for slot starvation.
+ timeout-minutes: 75
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
diff --git a/.github/workflows/cla-field-report-exempt.yml b/.github/workflows/cla-field-report-exempt.yml
index fc51b7d9d..a1ab74465 100644
--- a/.github/workflows/cla-field-report-exempt.yml
+++ b/.github/workflows/cla-field-report-exempt.yml
@@ -47,6 +47,7 @@ jobs:
field-report-exempt:
name: Field-report CLA exemption
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
# Trusted base code ONLY — never the PR head. This runs under the elevated
# pull_request_target token and must not execute untrusted contributor code.
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
index 5e20b8500..da8f9e122 100644
--- a/.github/workflows/deploy-pages.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -31,6 +31,11 @@ jobs:
deploy:
name: Publish landing/ to Cloudflare Pages
runs-on: ubuntu-latest
+ # `pages-deploy` is a single non-cancelling slot shared by every deploy,
+ # so an upload that wedges blocks ALL later site deploys for as long as
+ # it runs. Measured max 0.7 min; 20 is generous for a network upload and
+ # turns a 6-hour block into a 20-minute one.
+ timeout-minutes: 20
environment:
name: production
url: https://xerj.org
diff --git a/.github/workflows/onnx-model-optimization-recipe.yml b/.github/workflows/onnx-model-optimization-recipe.yml
index 0cd9299cc..cbc7b588e 100644
--- a/.github/workflows/onnx-model-optimization-recipe.yml
+++ b/.github/workflows/onnx-model-optimization-recipe.yml
@@ -18,6 +18,7 @@ permissions:
jobs:
locked-recipe-tests:
runs-on: ubuntu-latest
+ timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
diff --git a/.github/workflows/release-metrics.yml b/.github/workflows/release-metrics.yml
index 280d2adf8..0738e1694 100644
--- a/.github/workflows/release-metrics.yml
+++ b/.github/workflows/release-metrics.yml
@@ -31,6 +31,7 @@ jobs:
snapshot:
name: Snapshot release download counts
runs-on: ubuntu-latest
+ timeout-minutes: 20
# Scheduled workflows run on forks too; a fork has nothing to snapshot.
if: github.repository == 'xerj-org/xerj'
steps:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b08fd0a0f..f66b75042 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -36,6 +36,14 @@ jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
+ # Tier 3 with extra room: this matrix cross-compiles (zigbuild, musl,
+ # Windows MSVC + vendored OpenSSL) and its cache key includes the
+ # target, so a Cargo.lock change makes every leg fully cold. Over the
+ # last 27 runs the slowest leg is aarch64-pc-windows-msvc at 38.3 min
+ # (median 18.9); 75 is 1.96x that and still 4.8x below GitHub's 360-min
+ # default. A tag run cannot rely on `cancel-in-progress` to clear a
+ # hang -- the tag ref is immutable, so no later push supersedes it.
+ timeout-minutes: 75
strategy:
fail-fast: false
matrix:
@@ -235,6 +243,7 @@ jobs:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
+ timeout-minutes: 15
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all build artifacts
diff --git a/.github/workflows/seo.yml b/.github/workflows/seo.yml
index eb2eab57a..c2bd77420 100644
--- a/.github/workflows/seo.yml
+++ b/.github/workflows/seo.yml
@@ -43,6 +43,7 @@ jobs:
seo:
name: Technical SEO gate
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
diff --git a/AGENTS.md b/AGENTS.md
index 8abc88e1d..59f68514d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -64,6 +64,7 @@ cannot push at all: [.github/AI_CONTRIBUTIONS.md](./.github/AI_CONTRIBUTIONS.md)
- **Reference-code before you write.** For non-trivial engine work, retrieve how peer projects already solved the problem before writing your own version, and cite `file:line` for what you relied on. This repo dogfoods XERJ for it: reference projects (tantivy, meilisearch, quickwit, qdrant, usearch, hnswlib, sled, fjall, redb, ClickHouse) are indexed locally and queried with one command — `xerj search "<what you need>"` against a running node (it detects the node and ranks symbol definitions first). For a shareable, pinned corpus definition across machines, the `xc-corpus.sh` / `xc.py` helpers in [`tools/xerj-code/`](tools/xerj-code/) wrap the same flow. Two rules bind regardless of tooling: **retrieved code is evidence, not authority** — adapt and attribute rather than paste; and **check the licence** — XERJ is Apache-2.0, so GPL-family sources (and Elasticsearch, which is AGPL/SSPL/Elastic-licensed) are approach-only, never copied. That second rule is also why XERJ can state it shares no code with Elasticsearch: ES is read for wire-protocol *semantics*, never for implementation. Honest scope: retrieval pays off on code a model has not memorised (internal, niche, post-cutoff) and is pure overhead on popular public libraries it already knows.
- **Builds are scoped:** `cd engine && cargo build --release -j 32 -p <crate>` — never workspace-wide, never `cargo clean`.
- **The hard gate:** the current CI ES-YAML conformance suite must stay at **0 failed**; pass and skip totals are reported by CI and grow as cases are added, so gate on failures, not on an exact total, before any engine change lands (see "Running the conformance tests" in the README).
+- **Every CI job declares a `timeout-minutes`.** A job without one runs against GitHub's 360-minute default, and three of this repo's workflows serialise on a concurrency group that never auto-cancels — so one hung job holds that slot for hours and every later run queues behind it — during #751 one hung `Build + Test` ran into that 360-minute default, and a second hang the same morning discarded seven consecutive `main` pushes without running a single job. `python3 .github/scripts/workflow-timeout-guard.py` enforces it and runs as a merge gate; size a new job's cap from what the job actually measures, generously — a cap that false-fails a slow-but-healthy run is worse than the hang it guards against.
- **Git discipline:** non-trivial changes land with full commit bodies (motivation, before/after numbers, root cause, file pointers) — the git history is the project's engineering log; read it before re-deriving decisions.
- **Review discipline:** before submitting or updating a non-trivial change, run the applicable audit in [docs/CONTRIBUTION_REVIEW.md](./docs/CONTRIBUTION_REVIEW.md). In particular, audit the effective diff and ancestry, preserve existing workflows and recovery paths, test failure atomicity and durable-state transitions, and support user-visible or performance claims with repository-visible evidence.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e03773e83..d59292b92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -355,6 +355,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`nice(10)` instead of a `nice(0)` blocking thread, which is only observable
when every core is already saturated.
+- **CI: every workflow job is bounded, so one hang can no longer cost `main` an
+ afternoon of CI** ([#770](https://github.com/xerj-org/xerj/issues/770)). 22 of
+ this repo's 23 GitHub Actions jobs declared no `timeout-minutes` and so ran
+ against GitHub's 360-minute default. Three workflows serialise on a
+ concurrency group that never auto-cancels (`ci-CI-refs/heads/main`,
+ `pages-deploy`, `release-metrics`), so a single hung job holds that slot for
+ six hours while every later run queues behind it. That is measured, not
+ hypothetical. On 2026-08-25, before #767 capped `build-test`, the #751 hang
+ ran that job into the 360-minute default and was killed by it (run
+ 32796557309, 01:21:28 → 07:21:44 — every other job in the same run finished
+ within 18 minutes). A second hang the same morning held the slot from 11:28
+ to 17:03, and the seven main pushes that landed behind it were all discarded
+ with **zero jobs run**; a normal ~37-minute run would have let at least four
+ of them through, since the gaps between them were 48, 62, 38 and 150 minutes.
+ Every job now carries a cap sized in tiers from the measured duration of every
+ job execution across the last ~245 CI runs (3 873 executions) and 27 release
+ runs: 15 min for jobs that install no toolchain (measured max 2.3 min), 30 min
+ for jobs that install a toolchain but compile no workspace member (max
+ 3.8 min), 60 min for jobs that compile workspace crates (max 48.3 min,
+ `Build + Test`), and 75 min for the two jobs with the heaviest tails —
+ `autoindex-fd-smoke`, whose `windows-latest` leg runs 18.8 min at the median
+ but 49.6 at the maximum, and `release.yml`'s cross-compile matrix (max
+ 38.3 min, `aarch64-pc-windows-msvc`). Worst-case slot starvation drops from
+ 360 minutes to 75 (CI on `main`), 20 (`pages-deploy`) and 75 (a release tag).
+ A new `.github/scripts/workflow-timeout-guard.py` keeps it true for jobs added
+ later. This bounds the blast radius of the next hang; it is not itself a fix
+ for any hang, and #899 remains what fixed #751's.
+
## [1.0.0-rc.72] - 2026-08-31
The idle-cost release. A 2026-08-29 measurement session found XERJ was not