Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: quick stage first in Actions, local-ci gate for agent PRs (#6465)

Francesco Bonaccib3e6f95021b6
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 3dbc4ced6c..f8c6653186 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -41,3 +41,4 @@ or cross-component contract change):
- [ ] The PR title is a Conventional Commit describing the production change.
- [ ] External contributor authorship is preserved, or no external contribution is included.
- [ ] If release-tracked files changed but this is intentionally non-releasing, the `no-release` label is applied.
+- [ ] `bin/ci` is green and signed off (`bin/ci --signoff`)
diff --git a/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py b/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py
index ea2cb30462..57649214d7 100644
--- a/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py
+++ b/.github/scripts/tests/test_ci_cua_spaces_macos_workflow.py
@@ -35,11 +35,11 @@ CHECKS = {
def run_text(job: str) -> str:
- return "\n".join(step.get("run", "") + "\n" for step in JOBS[job]["steps"])
+ return "\n".join(step.get("run", "") + "\n" for step in JOBS[job].get("steps", []))
def uses(job: str) -> list[str]:
- return [step["uses"] for step in JOBS[job]["steps"] if "uses" in step]
+ return [step["uses"] for step in JOBS[job].get("steps", []) if "uses" in step]
def test_every_swift_check_still_runs_in_exactly_one_job():
diff --git a/.github/scripts/tests/test_ci_gate_scope.py b/.github/scripts/tests/test_ci_gate_scope.py
index 6e17cf8141..0727d0501b 100644
--- a/.github/scripts/tests/test_ci_gate_scope.py
+++ b/.github/scripts/tests/test_ci_gate_scope.py
@@ -264,14 +264,15 @@ def test_gate_runs_the_scope_step_first_and_passes_its_output_to_the_wait_step()
gate = yaml.safe_load((scope.WORKFLOWS / 'ci-gate.yml').read_text())
steps = gate['jobs']['ci-gate']['steps']
assert steps[2]['id'] == 'scope'
- assert steps[3]['env']['IGNORE_RE'] == '${{ steps.scope.outputs.ignore_re }}'
+ wait = next(st for st in steps if st.get('name', '').startswith('Wait for every other'))
+ assert wait['env']['IGNORE_RE'] == '${{ steps.scope.outputs.ignore_re }}'
assert 'labeled' in gate[True]['pull_request']['types']
assert 'edited' in gate[True]['pull_request']['types']
assert 'merge_group' in gate[True]
def test_gate_run_filter_drops_only_ignored_workflows():
- script = yaml.safe_load((scope.WORKFLOWS / 'ci-gate.yml').read_text())['jobs']['ci-gate']['steps'][3]['run']
+ script = yaml.safe_load((scope.WORKFLOWS / 'ci-gate.yml').read_text())['jobs']['ci-gate']['steps'][4]['run']
jq_filter = next(line.split("='", 1)[1].rsplit("'", 1)[0]
for line in script.splitlines() if line.strip().startswith('scope_jq='))
runs = [{'path': '.github/workflows/cd-image-linux.yml@refs/pull/1/merge'},
diff --git a/.github/scripts/tests/test_ci_gate_workflow.py b/.github/scripts/tests/test_ci_gate_workflow.py
index 77e6418d61..2244720808 100644
--- a/.github/scripts/tests/test_ci_gate_workflow.py
+++ b/.github/scripts/tests/test_ci_gate_workflow.py
@@ -290,3 +290,106 @@ def test_gate_reads_the_quarantine_list_from_the_base_commit():
assert '/.github/flaky/quarantine.json' in base and '/.github/scripts/flaky/flaky.py' in base
env = STEPS['Wait for every other workflow on the pull request head']['env']
assert env['FLAKY_PY'].startswith('base/') and env['QUARANTINE_FILE'].startswith('base/')
+
+
+def test_gate_fails_a_run_whose_quick_job_failed_and_skipped_the_rest():
+ # `quick` failed; the heavy jobs were skipped (the jobs API lists them, the gate drops them).
+ # The run is a failure, so the gate must not read the skipped jobs as a pass.
+ completed = run_gate('1\t11\tbuild\tfailure\tcompleted', jobs='quick / quick\tfailure')
+ assert completed.returncode == 1
+ assert 'build: fail' in completed.stdout
+
+
+HEAVY_WORKFLOWS = sorted(
+ path for path in WORKFLOWS.glob('*.yml')
+ if 'quick' in (yaml.safe_load(path.read_text()).get('jobs') or {})
+ and path.name != 'ci-quick.yml'
+)
+
+
+def test_quick_stage_is_wired_into_heavy_workflows():
+ assert HEAVY_WORKFLOWS
+ for path in HEAVY_WORKFLOWS:
+ jobs = yaml.safe_load(path.read_text())['jobs']
+ assert jobs['quick']['uses'] == './.github/workflows/ci-quick.yml', path.name
+ for name, job in jobs.items():
+ if name == 'quick':
+ continue
+ needs = job.get('needs', [])
+ needs = [needs] if isinstance(needs, str) else needs
+ # Every job waits for `quick`, directly or through the job it needs.
+ assert needs, f'{path.name}: {name} does not wait for quick'
+ if 'quick' in needs:
+ # Still runs on push and manual runs, where `quick` is skipped.
+ assert '!failure() && !cancelled()' in str(job['if']), f'{path.name}: {name}'
+
+
+LOCAL_CI = STEPS['Require local sign-off on agent pull requests']['run']
+GH_STUB = '''
+sleep() { :; }
+gh() {
+ case "$*" in
+ *'/pulls/'*) printf '%s\\t%s\\t%s\\t%s\\n' "$AUTHOR" "deadbeefcafe" "$REF" "$HEAD_REPO" ;;
+ *'/labels'*) printf '%s\\n' "$LABELS" ;;
+ *'/statuses'*) printf '%s\\n' "$STATE" ;;
+ esac
+}
+'''
+
+
+def run_local_ci(author='someone', labels='', ref='fix/x', head_repo='fork/repo', state='', require='true'):
+ return subprocess.run(
+ ['bash', '-e', '-c', GH_STUB + LOCAL_CI],
+ env={**os.environ, 'PR_NUMBER': '7', 'QUEUE_REF': '', 'GITHUB_REPOSITORY': 'test/repo',
+ 'AUTHOR': author, 'LABELS': labels, 'REF': ref, 'HEAD_REPO': head_repo, 'STATE': state,
+ 'REQUIRE_LOCAL_CI': require},
+ capture_output=True, text=True, timeout=20,
+ )
+
+
[email protected]('kwargs', [
+ {'author': 'cua-agents[bot]'},
+ {'labels': 'bug,agent'},
+ {'ref': 'agent/cua-1-x', 'head_repo': 'test/repo'},
+])
+def test_local_ci_is_required_for_agent_pull_requests(kwargs):
+ missing = run_local_ci(**kwargs)
+ assert missing.returncode == 1
+ assert 'Run bin/ci and bin/ci --signoff on this head commit.' in missing.stdout
+ assert run_local_ci(**kwargs, state='failure').returncode == 1
+ assert run_local_ci(**kwargs, state='success').returncode == 0
+
+
[email protected]('kwargs', [
+ {},
+ {'ref': 'agent/x', 'head_repo': 'fork/repo'}, # a fork cannot opt in or out by branch name
+ {'labels': 'agents,bug'},
+])
+def test_local_ci_is_not_required_for_community_pull_requests(kwargs):
+ done = run_local_ci(**kwargs)
+ assert done.returncode == 0, done.stdout
+ assert 'Not an agent pull request' in done.stdout
+
+
+def test_local_ci_is_report_only_until_the_switch_is_on():
+ for state in ('', 'failure'):
+ done = run_local_ci(author='cua-agents[bot]', state=state, require='')
+ assert done.returncode == 0, done.stdout
+ assert '::warning' in done.stdout
+ assert 'Run bin/ci and bin/ci --signoff on this head commit.' in done.stdout
+ assert run_local_ci(author='cua-agents[bot]', state='success', require='').returncode == 0
+
+
+def test_quick_stage_runs_once_per_commit():
+ steps = yaml.safe_load((WORKFLOWS / 'ci-quick.yml').read_text())['jobs']['quick']['steps']
+ restore, *middle, save = [s for s in steps if s.get('id') == 'marker' or 'if' in s or 'cache' in str(s.get('uses', ''))]
+ key = 'ci-quick-pass-${{ github.sha }}'
+ assert restore['uses'].startswith('actions/cache/restore@') and restore['with']['key'] == key
+ assert save['uses'].startswith('actions/cache/save@') and save['with']['key'] == key
+ assert steps[0] is restore
+ # Every step after the restore is skipped on a hit; the save runs last, after the checks passed
+ # (a failing step stops the job before it, so a failure is never cached).
+ for step in steps[1:]:
+ assert step['if'] == "steps.marker.outputs.cache-hit != 'true'", step.get('name', step.get('uses'))
+ assert steps[-1] is save
+ assert any('bin/ci --quick' in str(s.get('run', '')) for s in middle)
diff --git a/.github/scripts/tests/test_ci_swift_samples_scope.py b/.github/scripts/tests/test_ci_swift_samples_scope.py
index 44914a3ed0..238e77a24a 100644
--- a/.github/scripts/tests/test_ci_swift_samples_scope.py
+++ b/.github/scripts/tests/test_ci_swift_samples_scope.py
@@ -298,8 +298,9 @@ class WorkflowWiringTests(unittest.TestCase):
script = changes["steps"][-1]["run"]
self.assertIn(f"check-manifests {lane}", script)
self.assertIn(f"scope {lane}", script)
- self.assertNotIn("needs", changes)
- self.assertNotIn("if", changes)
+ # Only the quick stage (ci-quick.yml) comes before the scope job.
+ self.assertEqual(changes["needs"], "quick")
+ self.assertEqual(changes["if"], "${{ !failure() && !cancelled() }}")
swift = jobs["swift"]
self.assertEqual(swift["needs"], "changes")
# The arm64 larger runner of the same macOS image (macos-26 is 3-core).
@@ -322,7 +323,7 @@ class WorkflowWiringTests(unittest.TestCase):
self.assertEqual(self.load("openkoalabot")["jobs"]["typescript"]["needs"], "changes")
def test_no_other_job_in_the_infinite_canvas_workflow(self):
- self.assertEqual(set(self.load("infinite-canvas")["jobs"]), {"changes", "swift"})
+ self.assertEqual(set(self.load("infinite-canvas")["jobs"]), {"quick", "changes", "swift"})
if __name__ == "__main__":
diff --git a/.github/scripts/tests/test_e2e_cua_sdk_scope.py b/.github/scripts/tests/test_e2e_cua_sdk_scope.py
index dc315c031d..6cdf3797af 100644
--- a/.github/scripts/tests/test_e2e_cua_sdk_scope.py
+++ b/.github/scripts/tests/test_e2e_cua_sdk_scope.py
@@ -369,7 +369,7 @@ def test_workflow_wiring():
assert checkout["with"]["fetch-depth"] == 2
assert changes["steps"][1]["env"]["EVENT"] == "${{ github.event_name }}"
# The nightly lane is not behind the scope job.
- assert "needs" not in live
+ assert live["needs"] == "quick" # the quick stage only; not behind the scope job
assert "github.event_name == 'schedule'" in live["if"] and "needs.changes" not in live["if"]
assert set(WORKFLOW[True]) == {"pull_request", "schedule", "workflow_dispatch"}
diff --git a/.github/workflows/ci-check-docs.yml b/.github/workflows/ci-check-docs.yml
index 21156faa32..02d7701e38 100644
--- a/.github/workflows/ci-check-docs.yml
+++ b/.github/workflows/ci-check-docs.yml
@@ -55,7 +55,14 @@ jobs:
# Route once on Linux, then start only the generator rows this change can
# affect. Unaffected rows previously booted a macOS or Windows runner just to
# decide to skip.
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
scope:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Select affected generators
runs-on: ubuntu-latest
timeout-minutes: 10
diff --git a/.github/workflows/ci-container-cuabot.yml b/.github/workflows/ci-container-cuabot.yml
index 0e3bf48e71..83489817ea 100644
--- a/.github/workflows/ci-container-cuabot.yml
+++ b/.github/workflows/ci-container-cuabot.yml
@@ -16,7 +16,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cuabot
diff --git a/.github/workflows/ci-container-kasm.yml b/.github/workflows/ci-container-kasm.yml
index 660bece523..a55d12d9a7 100644
--- a/.github/workflows/ci-container-kasm.yml
+++ b/.github/workflows/ci-container-kasm.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cua-ubuntu
diff --git a/.github/workflows/ci-container-lumier.yml b/.github/workflows/ci-container-lumier.yml
index 3d3628da82..f3e534840d 100644
--- a/.github/workflows/ci-container-lumier.yml
+++ b/.github/workflows/ci-container-lumier.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: lumier
diff --git a/.github/workflows/ci-container-qemu-android.yml b/.github/workflows/ci-container-qemu-android.yml
index 8ecef58a1c..dd5555048b 100644
--- a/.github/workflows/ci-container-qemu-android.yml
+++ b/.github/workflows/ci-container-qemu-android.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cua-qemu-android
diff --git a/.github/workflows/ci-container-qemu-linux.yml b/.github/workflows/ci-container-qemu-linux.yml
index ab49858daf..e5075c612b 100644
--- a/.github/workflows/ci-container-qemu-linux.yml
+++ b/.github/workflows/ci-container-qemu-linux.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cua-qemu-linux
diff --git a/.github/workflows/ci-container-qemu-windows.yml b/.github/workflows/ci-container-qemu-windows.yml
index d565361886..a62b146ea0 100644
--- a/.github/workflows/ci-container-qemu-windows.yml
+++ b/.github/workflows/ci-container-qemu-windows.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cua-qemu-windows
diff --git a/.github/workflows/ci-container-xfce-cua.yml b/.github/workflows/ci-container-xfce-cua.yml
index 59cf2ccfa3..761c32f2c0 100644
--- a/.github/workflows/ci-container-xfce-cua.yml
+++ b/.github/workflows/ci-container-xfce-cua.yml
@@ -19,7 +19,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build-and-smoke:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: build-and-smoke (${{ matrix.platform }})
runs-on: ${{ matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
diff --git a/.github/workflows/ci-container-xfce.yml b/.github/workflows/ci-container-xfce.yml
index 4b5b7cbd50..267da64bdb 100644
--- a/.github/workflows/ci-container-xfce.yml
+++ b/.github/workflows/ci-container-xfce.yml
@@ -15,7 +15,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/docker-reusable-build.yml
with:
image_name: cua-xfce
diff --git a/.github/workflows/ci-cua-compat.yml b/.github/workflows/ci-cua-compat.yml
index de1cfee6a1..21106bcf77 100644
--- a/.github/workflows/ci-cua-compat.yml
+++ b/.github/workflows/ci-cua-compat.yml
@@ -55,7 +55,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
hermetic:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: hermetic (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
@@ -96,7 +103,8 @@ jobs:
surface:
name: E2B SDK surface
# Not on main pushes: those exist to keep the hermetic job's Rust cache warm.
- if: github.event_name != 'push'
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (github.event_name != 'push') }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@@ -121,7 +129,8 @@ jobs:
name: live E2B conformance (drift)
# Paid E2B sandboxes and a live provider: the weekly run and manual runs only,
# never the main pushes that keep the Rust cache warm.
- if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-latest
timeout-minutes: 20
env:
diff --git a/.github/workflows/ci-cua-driver-bench.yml b/.github/workflows/ci-cua-driver-bench.yml
index 6682523e45..8103f9006e 100644
--- a/.github/workflows/ci-cua-driver-bench.yml
+++ b/.github/workflows/ci-cua-driver-bench.yml
@@ -20,8 +20,14 @@ concurrency:
cancel-in-progress: true
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
harness:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Harness tests (no GUI, no model)
runs-on: macos-26
timeout-minutes: 20
@@ -45,6 +51,8 @@ jobs:
python -m pytest -q tests probes/tests swift/tests
linux-desktop:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Linux headless desktop contracts (no model)
runs-on: ubuntu-latest
timeout-minutes: 10
@@ -67,7 +75,8 @@ jobs:
'openbox >/tmp/cua-openbox.log 2>&1 & picom --backend xrender --config /dev/null >/tmp/cua-picom.log 2>&1 & sleep 2; /usr/bin/python3 -m pytest -q tests/test_pilot_runner.py tests/test_linux_session.py tests/test_runner_flow.py tests/test_bench_v2.py tests/test_analyze.py tests/test_cdb_adapter.py tests/test_linux_tools.py'
taskpack:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Task pack tests
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -115,7 +124,8 @@ jobs:
python tools/check_pack_pins.py
lint:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Python lint and format
runs-on: ubuntu-latest
timeout-minutes: 10
diff --git a/.github/workflows/ci-cua-driver-contract-clients.yml b/.github/workflows/ci-cua-driver-contract-clients.yml
index cc9af43ea6..a47d721499 100644
--- a/.github/workflows/ci-cua-driver-contract-clients.yml
+++ b/.github/workflows/ci-cua-driver-contract-clients.yml
@@ -80,8 +80,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
changes:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: "contract clients / changes"
runs-on: ubuntu-latest
timeout-minutes: 5
diff --git a/.github/workflows/ci-cua-microvm.yml b/.github/workflows/ci-cua-microvm.yml
index 073df6d50a..033286cfdb 100644
--- a/.github/workflows/ci-cua-microvm.yml
+++ b/.github/workflows/ci-cua-microvm.yml
@@ -54,7 +54,14 @@ env:
CARGO_PROFILE_DEV_DEBUG: line-tables-only
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
unit:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: unit (linux)
runs-on: ubuntu-latest
timeout-minutes: 45
@@ -96,6 +103,8 @@ jobs:
done
macos:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: unit (macos)
runs-on: macos-26
timeout-minutes: 45
@@ -134,7 +143,8 @@ jobs:
vz-e2e:
name: vz e2e + perf guard (self-hosted Mac)
- if: vars.CUA_E2E_LUME_RUNNER != '' && github.event_name != 'pull_request'
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (vars.CUA_E2E_LUME_RUNNER != '' && github.event_name != 'pull_request') }}
runs-on: ["self-hosted", "macOS", "${{ vars.CUA_E2E_LUME_RUNNER }}"]
timeout-minutes: 120
steps:
diff --git a/.github/workflows/ci-cua-oci-spacesd.yml b/.github/workflows/ci-cua-oci-spacesd.yml
index 0f63ada8f2..1c8fc031ce 100644
--- a/.github/workflows/ci-cua-oci-spacesd.yml
+++ b/.github/workflows/ci-cua-oci-spacesd.yml
@@ -49,7 +49,14 @@ env:
CARGO_PROFILE_DEV_DEBUG: line-tables-only
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
static:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: static cua-spacesd (musl)
runs-on: ubuntu-latest
timeout-minutes: 60
diff --git a/.github/workflows/ci-cua-perception-release.yml b/.github/workflows/ci-cua-perception-release.yml
index f799d6d4af..7596dcd33c 100644
--- a/.github/workflows/ci-cua-perception-release.yml
+++ b/.github/workflows/ci-cua-perception-release.yml
@@ -63,7 +63,14 @@ concurrency:
cancel-in-progress: true
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
crate:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: crate (${{ matrix.target }})
strategy:
fail-fast: false
@@ -92,6 +99,8 @@ jobs:
run: cargo test --locked -p cua-perception
contract:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
diff --git a/.github/workflows/ci-cua-relay-image.yml b/.github/workflows/ci-cua-relay-image.yml
index 78cc0e3c58..4616447e93 100644
--- a/.github/workflows/ci-cua-relay-image.yml
+++ b/.github/workflows/ci-cua-relay-image.yml
@@ -25,7 +25,14 @@ concurrency:
cancel-in-progress: true
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
reproducible:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: reproducible image (linux/amd64)
runs-on: ubuntu-latest
timeout-minutes: 120
diff --git a/.github/workflows/ci-cua-s1.yml b/.github/workflows/ci-cua-s1.yml
index 17e04bb9d6..0d9896514a 100644
--- a/.github/workflows/ci-cua-s1.yml
+++ b/.github/workflows/ci-cua-s1.yml
@@ -20,7 +20,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
test:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Lint, test, and train smoke (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -153,6 +160,8 @@ jobs:
uv run --frozen --extra four-b --group test pytest -q tests/test_four_b.py
macos-unit:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
# Apple silicon is the primary local inference platform for Cua-S1-4B
# (S1_DEVICE=mps). This job covers the offline unit suite and the four-b
# dependency resolution on macOS arm64; it does not download weights.
diff --git a/.github/workflows/ci-cua-sandbox-doctor.yml b/.github/workflows/ci-cua-sandbox-doctor.yml
index 0c6c5c08ef..8b6b2e4ca3 100644
--- a/.github/workflows/ci-cua-sandbox-doctor.yml
+++ b/.github/workflows/ci-cua-sandbox-doctor.yml
@@ -67,8 +67,14 @@ env:
jobs:
# The three builds are independent and the slowest ones dominate, so they
# run in parallel jobs and the doctor jobs below pick up the binaries.
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
build:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: build ${{ matrix.component }}
runs-on: ubuntu-latest
timeout-minutes: 60
diff --git a/.github/workflows/ci-cua-sdk.yml b/.github/workflows/ci-cua-sdk.yml
index 8a5a475c2b..5d0c008555 100644
--- a/.github/workflows/ci-cua-sdk.yml
+++ b/.github/workflows/ci-cua-sdk.yml
@@ -70,8 +70,14 @@ jobs:
# always run there. Any doubt means "run everything": see
# .github/scripts/ci_reuse_pr_result.py. Rollback: set the repository
# variable CI_REUSE_PR_RESULTS to "off".
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
reuse:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: reuse PR results
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -802,7 +808,8 @@ jobs:
swift:
name: swift smoke (macOS)
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full'))) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full')))) }}
runs-on: macos-26
# Cold, the release cua-sdk build alone nears 45 minutes on macos-26.
timeout-minutes: 60
diff --git a/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml b/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
index 4cc422bdfd..807229fa44 100644
--- a/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
+++ b/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
@@ -29,7 +29,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
resolve:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Find a run with live artifacts
runs-on: ubuntu-latest
timeout-minutes: 5
diff --git a/.github/workflows/ci-cua-spaces-macos.yml b/.github/workflows/ci-cua-spaces-macos.yml
index 7d427a5ab1..fefdddefa2 100644
--- a/.github/workflows/ci-cua-spaces-macos.yml
+++ b/.github/workflows/ci-cua-spaces-macos.yml
@@ -88,8 +88,14 @@ env:
CARGO_HTTP_MULTIPLEXING: "false"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
core:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: app core (Rust) + FFI mirror gate
runs-on: ubuntu-24.04
defaults:
@@ -128,7 +134,8 @@ jobs:
# each compiling it (the checks that need the Rust toolchain compile only
# the small bindgen tools).
ffi:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: Cua Spaces app library (built once)
runs-on: macos-26
# A cold build takes 20 to 60+ minutes (a push to main ran 73 minutes). 45
diff --git a/.github/workflows/ci-cua-spaces-rust-slice.yml b/.github/workflows/ci-cua-spaces-rust-slice.yml
index 3e9a8a2d57..1468c24f13 100644
--- a/.github/workflows/ci-cua-spaces-rust-slice.yml
+++ b/.github/workflows/ci-cua-spaces-rust-slice.yml
@@ -51,7 +51,14 @@ env:
CUA_RELEASE_REPOSITORY: ${{ github.repository }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
slice:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: SwiftUI Rust (${{ matrix.arch }})
runs-on: macos-26
timeout-minutes: 120
diff --git a/.github/workflows/ci-cua-spaces-web.yml b/.github/workflows/ci-cua-spaces-web.yml
index 57ec4caff9..90d0fa7f64 100644
--- a/.github/workflows/ci-cua-spaces-web.yml
+++ b/.github/workflows/ci-cua-spaces-web.yml
@@ -51,8 +51,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
test:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: typecheck, tests, bridge contract, build
runs-on: ubuntu-24.04
steps:
diff --git a/.github/workflows/ci-cua-spaces.yml b/.github/workflows/ci-cua-spaces.yml
index 583640502b..5509f36a2a 100644
--- a/.github/workflows/ci-cua-spaces.yml
+++ b/.github/workflows/ci-cua-spaces.yml
@@ -68,8 +68,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
changes:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft)) }}
name: changes
runs-on: ubuntu-24.04
timeout-minutes: 5
@@ -131,7 +137,8 @@ jobs:
echo "native bundles: $native"
rust:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft)) }}
name: rust command-layer tests
runs-on: ubuntu-22.04
timeout-minutes: 60
@@ -191,7 +198,8 @@ jobs:
suite: spaces-rust
frontend:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: vitest + typecheck
runs-on: ubuntu-24.04
steps:
diff --git a/.github/workflows/ci-cua-spacesd.yml b/.github/workflows/ci-cua-spacesd.yml
index 1882d81715..41361ee33e 100644
--- a/.github/workflows/ci-cua-spacesd.yml
+++ b/.github/workflows/ci-cua-spacesd.yml
@@ -88,8 +88,14 @@ env:
CUA_ENV_TEST_SANDBOX: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
changes:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: "cua-spacesd / changes"
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -270,7 +276,8 @@ jobs:
name: Cua Volume mount (Windows NFS client)
# Not shipped yet (renames fail in the Windows NFS client): run on
# demand while the Windows mount is finished.
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name == 'workflow_dispatch') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name == 'workflow_dispatch')) }}
runs-on: windows-latest
timeout-minutes: 60
defaults:
diff --git a/.github/workflows/ci-driver-linux-bootstrap.yml b/.github/workflows/ci-driver-linux-bootstrap.yml
index 772041a86d..332eece356 100644
--- a/.github/workflows/ci-driver-linux-bootstrap.yml
+++ b/.github/workflows/ci-driver-linux-bootstrap.yml
@@ -20,7 +20,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
bootstrap:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Debian 11 bootstrap (${{ matrix.arch }})
strategy:
fail-fast: false
diff --git a/.github/workflows/ci-driver-mcp-candidate.yml b/.github/workflows/ci-driver-mcp-candidate.yml
index 45bda94b0a..eb2bebd474 100644
--- a/.github/workflows/ci-driver-mcp-candidate.yml
+++ b/.github/workflows/ci-driver-mcp-candidate.yml
@@ -26,7 +26,14 @@ env:
CARGO_HTTP_MULTIPLEXING: "false"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
candidate:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: MCP candidate (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 40
diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml
index d56db3347f..f249a639bb 100644
--- a/.github/workflows/ci-gate.yml
+++ b/.github/workflows/ci-gate.yml
@@ -12,6 +12,7 @@ permissions:
actions: write
contents: read
pull-requests: read
+ statuses: read
jobs:
ci-gate:
@@ -77,6 +78,54 @@ jobs:
# The files API stops at 3000 entries; a PR that large waits on everything.
if (( $(wc -l < "$RUNNER_TEMP/files.txt") >= 3000 )); then echo ".github/too-many-files" > "$RUNNER_TEMP/files.txt"; fi
python3 base/.github/scripts/ci_gate_scope.py --labels "$labels" --body-file "$RUNNER_TEMP/pr-body.txt" < "$RUNNER_TEMP/files.txt"
+ # Pull requests from our agents must carry a `local-ci` commit status on the head commit, set by
+ # `bin/ci --signoff` after a green local `bin/ci`. An agent PR is one opened by the Cua Agents
+ # GitHub App (`cua-agents[bot]`), labelled `agent`, or opened from an `agent/` branch of this
+ # repository. Community PRs are not asked for it. The status usually lands a few seconds after
+ # the push, so the gate polls for it for five minutes before it fails.
+ # The requirement is report-only (a warning) until the repository variable REQUIRE_LOCAL_CI is
+ # set to "true"; that variable is the one switch that makes a missing status block the merge.
+ - name: Require local sign-off on agent pull requests
+ env:
+ GH_TOKEN: ${{ github.token }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ QUEUE_REF: ${{ github.event.merge_group.head_ref }}
+ REQUIRE_LOCAL_CI: ${{ vars.REQUIRE_LOCAL_CI }}
+ run: |
+ set -euo pipefail
+ api() { local out; for _ in 1 2 3 4 5 6; do out=$(gh api "$@") && { printf '%s\n' "$out"; return; }; sleep 20; done; return 1; }
+ pr=$PR_NUMBER
+ if [[ -n "$QUEUE_REF" ]]; then
+ [[ "$QUEUE_REF" =~ /pr-([0-9]+) ]] || { echo "::error::cannot read the pull request from $QUEUE_REF"; exit 1; }
+ pr=${BASH_REMATCH[1]}
+ fi
+ info=$(api "repos/$GITHUB_REPOSITORY/pulls/$pr" --jq '[.user.login, .head.sha, .head.ref, (.head.repo.full_name // "")] | @tsv')
+ IFS=$'\t' read -r author sha ref head_repo <<<"$info"
+ labels=$(api "repos/$GITHUB_REPOSITORY/issues/$pr/labels" --jq '[.[].name] | join(",")')
+ why=
+ if [[ "$author" == "cua-agents[bot]" || "$author" == "cua-agents" ]]; then why="opened by $author"
+ elif [[ ",$labels," == *,agent,* ]]; then why="labelled agent"
+ elif [[ "$ref" == agent/* && "$head_repo" == "$GITHUB_REPOSITORY" ]]; then why="opened from the $ref branch"
+ fi
+ if [[ -z "$why" ]]; then echo "Not an agent pull request: no local-ci status required."; exit 0; fi
+ echo "Agent pull request ($why): requiring a successful local-ci status on ${sha:0:10}."
+ # Report-only: look once. Blocking: wait up to five minutes for the status.
+ tries=1
+ [[ "${REQUIRE_LOCAL_CI:-}" == true ]] && tries=20
+ for _ in $(seq 1 "$tries"); do
+ state=$(api "repos/$GITHUB_REPOSITORY/commits/$sha/statuses?per_page=100" --jq '[.[] | select(.context == "local-ci")][0].state // ""')
+ if [[ "$state" == success ]]; then echo "local-ci: success"; exit 0; fi
+ [[ "$state" == failure || "$state" == error ]] && break
+ sleep 15
+ done
+ msg="Run bin/ci and bin/ci --signoff on this head commit. (local-ci on ${sha:0:10}: ${state:-not set})"
+ if [[ "${REQUIRE_LOCAL_CI:-}" == true ]]; then
+ echo "::error title=local-ci missing::$msg"
+ exit 1
+ fi
+ echo "::warning title=local-ci missing (report-only)::$msg"
+ echo "local-ci is report-only until the repository variable REQUIRE_LOCAL_CI is true; not failing the gate."
+
- name: Wait for every other workflow on the pull request head
env:
GH_TOKEN: ${{ github.token }}
diff --git a/.github/workflows/ci-infinite-canvas-swift.yml b/.github/workflows/ci-infinite-canvas-swift.yml
index 1880708b06..1f0005ae6c 100644
--- a/.github/workflows/ci-infinite-canvas-swift.yml
+++ b/.github/workflows/ci-infinite-canvas-swift.yml
@@ -43,7 +43,14 @@ env:
CARGO_BUILD_JOBS: "4"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
changes:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: scope (macOS Swift sample)
runs-on: ubuntu-24.04
timeout-minutes: 10
diff --git a/.github/workflows/ci-installers.yml b/.github/workflows/ci-installers.yml
index 058a62a4d2..2a1a19306f 100644
--- a/.github/workflows/ci-installers.yml
+++ b/.github/workflows/ci-installers.yml
@@ -30,8 +30,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
lint:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: shellcheck + shfmt + manifest unit tests
runs-on: ubuntu-24.04
steps:
@@ -52,7 +58,8 @@ jobs:
run: python3 -m unittest discover -s scripts/install/tests -v
installer-smoke-linux:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: installer smoke (Linux containers)
runs-on: ubuntu-24.04
strategy:
@@ -97,7 +104,8 @@ jobs:
'
installer-smoke-macos:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: installer smoke (macOS, temp prefix + dmg mount + pkg)
runs-on: macos-15
steps:
@@ -110,7 +118,8 @@ jobs:
run: sh apps/cua-spaces/tests/installer/pkg.test.sh
installer-smoke-windows:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: installer smoke (Windows, install.ps1)
runs-on: windows-latest
steps:
diff --git a/.github/workflows/ci-jev-use.yml b/.github/workflows/ci-jev-use.yml
index b18d3fb213..d57a153482 100644
--- a/.github/workflows/ci-jev-use.yml
+++ b/.github/workflows/ci-jev-use.yml
@@ -62,7 +62,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
unit-python:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Python unit
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -90,6 +97,8 @@ jobs:
uv run --frozen python verify_decision_cli.py --model mock --fixture native
unit-typescript:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: TypeScript unit and typecheck
runs-on: ubuntu-latest
timeout-minutes: 15
@@ -108,6 +117,8 @@ jobs:
run: npm run typecheck
mock-e2e-linux:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Linux mock E2E
runs-on: ubuntu-latest
timeout-minutes: 90
@@ -345,6 +356,8 @@ jobs:
# silently tests an older release. The candidate-source build above stays
# Linux-only.
released-driver-macos:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: macOS released Driver mock E2E
runs-on: macos-26
timeout-minutes: 45
@@ -461,6 +474,8 @@ jobs:
# mock provider. verify_native.py launches a fresh harness per run and reads
# the harness's own state file as the independent oracle.
native-appkit-macos:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: macOS native AppKit mock E2E
runs-on: macos-26
timeout-minutes: 45
@@ -613,6 +628,8 @@ jobs:
retention-days: 14
released-driver-windows:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Windows released Driver mock E2E
runs-on: windows-latest
timeout-minutes: 45
@@ -727,6 +744,8 @@ jobs:
# verify_native.py launches a fresh harness in task mode per run and reads
# the harness's own state file as the independent oracle.
native-wpf-windows:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Windows native WPF mock E2E
runs-on: windows-latest
timeout-minutes: 45
@@ -873,6 +892,8 @@ jobs:
# default install.ps1, the deterministic mock provider, and the harness's
# own state file as the independent oracle.
native-winui3-windows:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Windows native WinUI3 mock E2E
runs-on: windows-latest
timeout-minutes: 45
@@ -1020,6 +1041,8 @@ jobs:
# verify_native.py runs from the locked venv directly (not `uv run`, which
# would put the venv's python3 first on PATH).
native-gtk3-linux:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Linux native GTK3 mock E2E
runs-on: ubuntu-latest
timeout-minutes: 45
diff --git a/.github/workflows/ci-nix-linux.yml b/.github/workflows/ci-nix-linux.yml
index 3935e5f289..fb910ce1c3 100644
--- a/.github/workflows/ci-nix-linux.yml
+++ b/.github/workflows/ci-nix-linux.yml
@@ -60,8 +60,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
rust-source:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: Nix / ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 60
diff --git a/.github/workflows/ci-openkoalabot-example-samples.yml b/.github/workflows/ci-openkoalabot-example-samples.yml
index 7b3b54c4f6..0093877400 100644
--- a/.github/workflows/ci-openkoalabot-example-samples.yml
+++ b/.github/workflows/ci-openkoalabot-example-samples.yml
@@ -55,6 +55,11 @@ env:
CARGO_PROFILE_DEV_DEBUG: "0"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
typescript:
needs: changes
if: ${{ needs.changes.outputs.typescript == 'true' && !startsWith(github.head_ref, 'release-please--branches--') }}
@@ -111,6 +116,8 @@ jobs:
npm run build:web
changes:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: scope (macOS Swift sample)
runs-on: ubuntu-24.04
timeout-minutes: 10
diff --git a/.github/workflows/ci-openkoalabot-example-tauri.yml b/.github/workflows/ci-openkoalabot-example-tauri.yml
index aed88da871..094f395e06 100644
--- a/.github/workflows/ci-openkoalabot-example-tauri.yml
+++ b/.github/workflows/ci-openkoalabot-example-tauri.yml
@@ -43,8 +43,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
check:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: cargo check + core tests + vitest
runs-on: ubuntu-22.04
timeout-minutes: 60
diff --git a/.github/workflows/ci-platform-linux-portability.yml b/.github/workflows/ci-platform-linux-portability.yml
index 7308f3565c..428606ce58 100644
--- a/.github/workflows/ci-platform-linux-portability.yml
+++ b/.github/workflows/ci-platform-linux-portability.yml
@@ -46,7 +46,14 @@ env:
CARGO_HTTP_MULTIPLEXING: "false"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
platform-linux-off-linux:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: platform-linux compiles on macOS
runs-on: macos-latest
timeout-minutes: 20
diff --git a/.github/workflows/ci-quick.yml b/.github/workflows/ci-quick.yml
new file mode 100644
index 0000000000..94f55d8c6a
--- /dev/null
+++ b/.github/workflows/ci-quick.yml
@@ -0,0 +1,84 @@
+name: "CI: Quick"
+
+# The fast first stage. It runs `bin/ci --quick` (formatting, lockfiles, SPDX headers, workflow lint and
+# the other checks that build nothing) on what the pull request changes. It is the same command a
+# contributor runs locally, so the two cannot drift; `bin/ci --verify-sync` keeps the commands aligned
+# with the workflows.
+#
+# Heavy workflows call this one as their first job (`quick`) and make their heavy jobs `needs: quick`, so
+# a pull request that fails a cheap check stops in about a minute instead of spending runner minutes on
+# builds. It also runs on its own, so the gate sees a quick failure even when no heavy workflow starts.
+# Nothing here builds, signs or reaches a service: only deterministic checks, so it cannot flake.
+#
+# It runs once per commit, not once per workflow: the first run that passes saves a marker in the cache
+# (key `ci-quick-pass-<sha>`); every other `quick` job restores it first and finishes in seconds. Jobs
+# that start before the marker exists simply run the checks themselves, so a race costs time, never
+# correctness. Only a pass is cached; a failure always fails the run that saw it.
+
+on:
+ pull_request:
+ workflow_call:
+
+permissions:
+ contents: read
+
+concurrency:
+ # Called from another workflow, github.workflow is the caller's name; the prefix keeps this group
+ # apart from the caller's own concurrency group, so neither cancels the other.
+ group: ci-quick-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
+jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - name: Skip when this commit already passed
+ id: marker
+ uses: actions/cache/restore@v4
+ with:
+ path: ${{ runner.temp }}/ci-quick-pass
+ key: ci-quick-pass-${{ github.sha }}
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
+ if: steps.marker.outputs.cache-hit != 'true'
+ with:
+ fetch-depth: 0
+ filter: blob:none
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
+ if: steps.marker.outputs.cache-hit != 'true'
+ with:
+ node-version: "22"
+ - name: Pin npm
+ if: steps.marker.outputs.cache-hit != 'true'
+ # The npm that wrote the committed package-lock.json files.
+ run: npm install -g [email protected]
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ if: steps.marker.outputs.cache-hit != 'true'
+ with:
+ enable-cache: true
+ - name: Install actionlint
+ if: steps.marker.outputs.cache-hit != 'true'
+ run: |
+ set -euo pipefail
+ VERSION=1.7.12
+ curl -fsSL -o "$RUNNER_TEMP/actionlint.tgz" \
+ "https://github.com/rhysd/actionlint/releases/download/v${VERSION}/actionlint_${VERSION}_linux_amd64.tar.gz"
+ mkdir -p "$RUNNER_TEMP/bin"
+ tar xzf "$RUNNER_TEMP/actionlint.tgz" -C "$RUNNER_TEMP/bin" actionlint
+ echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
+ - name: bin/ci --quick
+ if: steps.marker.outputs.cache-hit != 'true'
+ # --no-install: a check that needs a package's node_modules is skipped here (its own workflow
+ # still runs it) instead of installing it, which would make this stage slow and network-bound.
+ run: python3 bin/ci --quick --no-install
+ - name: Write the pass marker
+ if: steps.marker.outputs.cache-hit != 'true'
+ run: echo "${{ github.sha }}" > "${{ runner.temp }}/ci-quick-pass"
+ - name: Remember that this commit passed
+ if: steps.marker.outputs.cache-hit != 'true'
+ uses: actions/cache/save@v4
+ with:
+ path: ${{ runner.temp }}/ci-quick-pass
+ key: ci-quick-pass-${{ github.sha }}
diff --git a/.github/workflows/ci-rust-linux.yml b/.github/workflows/ci-rust-linux.yml
index 222fe953bf..97ed9a9514 100644
--- a/.github/workflows/ci-rust-linux.yml
+++ b/.github/workflows/ci-rust-linux.yml
@@ -64,8 +64,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
pacman:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Arch native pacman updates
runs-on: ubuntu-latest
container: archlinux:base-devel
@@ -121,7 +127,8 @@ jobs:
libs/cua-driver/rust/pacman-build.jsonl
unit:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Rust Linux unit and compile
runs-on: ubuntu-latest
# 10 to 14 minutes warm. The headroom covers a run with neither the
diff --git a/.github/workflows/ci-rust-macos.yml b/.github/workflows/ci-rust-macos.yml
index b77a26b6dc..811a95ed4b 100644
--- a/.github/workflows/ci-rust-macos.yml
+++ b/.github/workflows/ci-rust-macos.yml
@@ -51,8 +51,14 @@ env:
CARGO_HTTP_MULTIPLEXING: "false"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
unit:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Rust macOS unit
runs-on: macos-latest
timeout-minutes: 30
diff --git a/.github/workflows/ci-rust-windows.yml b/.github/workflows/ci-rust-windows.yml
index e8f90dbd3d..3dcd5241e0 100644
--- a/.github/workflows/ci-rust-windows.yml
+++ b/.github/workflows/ci-rust-windows.yml
@@ -62,8 +62,14 @@ env:
jobs:
# Three shards of the same job. Each builds (the Rust cache key is shared)
# and runs a third of the test steps; `unit` below keeps the check name.
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
shard:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
name: Rust Windows shard ${{ matrix.shard }}/3
runs-on: windows-latest
strategy:
diff --git a/.github/workflows/ci-swift-linker.yml b/.github/workflows/ci-swift-linker.yml
index dea9f6f4c7..fac1cce778 100644
--- a/.github/workflows/ci-swift-linker.yml
+++ b/.github/workflows/ci-swift-linker.yml
@@ -46,8 +46,14 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
link:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Fresh macOS link without duplicate symbols
runs-on: macos-latest
timeout-minutes: 20
diff --git a/.github/workflows/ci-swift-lume.yml b/.github/workflows/ci-swift-lume.yml
index e1e494d1cd..208ecd40ad 100644
--- a/.github/workflows/ci-swift-lume.yml
+++ b/.github/workflows/ci-swift-lume.yml
@@ -20,7 +20,14 @@ permissions:
contents: read
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
test:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Test
runs-on: macos-15
steps:
@@ -30,6 +37,8 @@ jobs:
- run: swift test
working-directory: ./libs/lume
build:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: Release build
runs-on: macos-15
steps:
diff --git a/.github/workflows/ci-test-python.yml b/.github/workflows/ci-test-python.yml
index c3071303e9..bffb1a8f22 100644
--- a/.github/workflows/ci-test-python.yml
+++ b/.github/workflows/ci-test-python.yml
@@ -48,8 +48,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
test:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Test ${{ matrix.package }}
runs-on: ubuntu-latest
@@ -116,7 +122,8 @@ jobs:
continue-on-error: true
cua-sandbox:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (!startsWith(github.head_ref, 'release-please--branches--')) }}
# cua-sandbox drives sandboxes through the cua SDK (UniFFI over cua-sdk),
# so the native library and the MockServer fixture are built first. The
# hermetic suite never touches the host or a cloud;
diff --git a/.github/workflows/ci-test-scripts.yml b/.github/workflows/ci-test-scripts.yml
index 375b2ab897..94a3e1d03c 100644
--- a/.github/workflows/ci-test-scripts.yml
+++ b/.github/workflows/ci-test-scripts.yml
@@ -99,7 +99,14 @@ permissions:
contents: read
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
macos-uninstall:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: macOS uninstall regressions
runs-on: macos-26
timeout-minutes: 10
@@ -125,6 +132,8 @@ jobs:
run: /bin/bash libs/cua-driver/scripts/tests/uninstall-history-purge-test.sh
windows-uninstall:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
runs-on: windows-latest
timeout-minutes: 5
permissions:
@@ -141,6 +150,8 @@ jobs:
run: '& ./libs/cua-driver/scripts/tests/install-common-windows-regression.ps1'
test:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 15
diff --git a/.github/workflows/ci-vm-density.yml b/.github/workflows/ci-vm-density.yml
index 78ca46e2d9..5e31fbeea5 100644
--- a/.github/workflows/ci-vm-density.yml
+++ b/.github/workflows/ci-vm-density.yml
@@ -51,7 +51,14 @@ env:
CARGO_BUILD_JOBS: "4"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
unit:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: unit (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
@@ -83,7 +90,8 @@ jobs:
kvm:
name: nightly KVM (density tests + bench guard)
# Also on a pull request labelled ci:vm-density.
- if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:vm-density')
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:vm-density')) }}
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
diff --git a/.github/workflows/e2e-compat-examples.yml b/.github/workflows/e2e-compat-examples.yml
index ef14ede6e2..86e93c162f 100644
--- a/.github/workflows/e2e-compat-examples.yml
+++ b/.github/workflows/e2e-compat-examples.yml
@@ -58,9 +58,15 @@ env:
DO_NOT_TRACK: "1"
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
hermetic:
name: manifest, pins and licenses
- if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -81,7 +87,8 @@ jobs:
nightly:
name: examples on real Spaces (QEMU)
- if: github.event_name != 'pull_request'
+ needs: quick
+ if: ${{ !failure() && !cancelled() && (github.event_name != 'pull_request') }}
runs-on: ubuntu-24.04
timeout-minutes: 330
steps:
diff --git a/.github/workflows/e2e-cua-driver-release-gate.yml b/.github/workflows/e2e-cua-driver-release-gate.yml
index 58051eb07b..a17f7b30a9 100644
--- a/.github/workflows/e2e-cua-driver-release-gate.yml
+++ b/.github/workflows/e2e-cua-driver-release-gate.yml
@@ -47,7 +47,14 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
decide:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: "E2E gate / decide"
runs-on: ubuntu-latest
timeout-minutes: 10
diff --git a/.github/workflows/e2e-cua-sdk.yml b/.github/workflows/e2e-cua-sdk.yml
index b76b647b32..c11b673860 100644
--- a/.github/workflows/e2e-cua-sdk.yml
+++ b/.github/workflows/e2e-cua-sdk.yml
@@ -108,9 +108,15 @@ jobs:
# job runs the suite when a block changed (or a tagged page came or went) and
# skips it for prose. Every other trigger, and any doubt, runs it. When it is
# skipped, the run still exists and succeeds, so `ci-gate` counts it as passed.
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
changes:
name: "E2E: cua SDK / changes"
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--')) }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--'))) }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
@@ -497,7 +503,8 @@ jobs:
live:
name: nightly (cua-sandbox, qemu)
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name == 'schedule') }}
+ needs: quick
+ if: ${{ !failure() && !cancelled() && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name == 'schedule')) }}
runs-on: ubuntu-24.04
timeout-minutes: 180
steps:
diff --git a/.github/workflows/e2e-rust-linux.yml b/.github/workflows/e2e-rust-linux.yml
index c84d8c7559..a54f1621f1 100644
--- a/.github/workflows/e2e-rust-linux.yml
+++ b/.github/workflows/e2e-rust-linux.yml
@@ -69,7 +69,14 @@ concurrency:
cancel-in-progress: false
jobs:
+ quick:
+ name: quick
+ if: github.event_name == 'pull_request'
+ uses: ./.github/workflows/ci-quick.yml
+
source:
+ needs: quick
+ if: ${{ !failure() && !cancelled() }}
name: "Resolve exact source"
runs-on: ubuntu-latest
timeout-minutes: 10
diff --git a/AGENTS.md b/AGENTS.md
index f830360d2d..4ab3c7377b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -69,10 +69,22 @@ that are easy to miss:
Run `bin/ci` before every push, and `bin/ci --fix` when it reports a failure
it can repair (formatting, lockfiles, generated bindings and reference docs).
-It runs the CI checks your diff against `origin/main` affects, in a few
-minutes, and prints the exact fix command for each failure. A green `bin/ci`
-does not replace CI: the end-to-end, image and native Windows lanes still run
-there.
+It runs the CI checks your diff against `origin/main` affects and prints the
+exact fix command for each failure. `bin/ci --install-hook` runs it for you
+before every `git push`.
+
+- **Quick stage.** CI starts with a `quick` job that runs `bin/ci --quick`
+ (formatting, lockfiles, headers, lint). The heavy jobs wait for it, so a
+ failure there stops the run in about a minute.
+- **Agent pull requests need a sign-off.** After a green `bin/ci` on a clean
+ tree, push and run `bin/ci --signoff`. That sets the `local-ci` status on the
+ head commit. `ci-gate` reports an agent PR without it (and blocks it once
+ `REQUIRE_LOCAL_CI` is on): "Run bin/ci and bin/ci --signoff on this head
+ commit." Sign off again after every new commit.
+
+Reviewers of an agent PR check, before approving, that the `local-ci` status is
+`success` on the current head commit (`gh api repos/trycua/cua/commits/<sha>/statuses`)
+and that the PR's `bin/ci` checklist item is ticked. No status, no approval.
**Agents on shared hosts (the dev host that runs live VMs) use `bin/ci --quick`.**
It runs only the cheap checks (formatting, lockfiles, headers, lint) and builds
@@ -80,7 +92,10 @@ nothing. Heavy checks (cargo test, clippy, build, cross-target) go to CI or a
VM. A full `bin/ci` is disk-guarded: it skips heavy steps below
`CUA_CI_MIN_FREE_GB` (40) free, and stops cargo and exits 3 if the target dir
passes `CUA_CI_MAX_TARGET_GB` (15) or free disk falls under 25 GB. The target
-dir is per run and deleted on exit unless you pass `--keep-target`. See [`CI.md`](docs/contributing/CI.md#run-the-checks-locally-first-binci).
+dir is per run and deleted on exit unless you pass `--keep-target`.
+
+A green `bin/ci` does not replace CI: the end-to-end, image and native Windows
+lanes still run there. See [`CI.md`](docs/contributing/CI.md#run-the-checks-locally-first-binci).
## Cross-platform Cua Driver behavior
diff --git a/docs/contributing/CI.md b/docs/contributing/CI.md
index bc699560db..1ec75984f2 100644
--- a/docs/contributing/CI.md
+++ b/docs/contributing/CI.md
@@ -1,7 +1,8 @@
# CI
Every pull request must pass one required check, **CI: gate** (`ci-gate`). The gate waits for the other
-pull request workflows and passes when they pass. This page explains which of those workflows it waits for.
+pull request workflows and passes when they pass. This page explains which of those workflows it waits for,
+and the two checks in front of them: the quick stage and, for agent pull requests, the `local-ci` sign-off.
## Run the checks locally first: `bin/ci`
@@ -55,7 +56,7 @@ your `PATH`, and installs a web package's `node_modules` with its frozen lockfil
What it cannot catch: failures that only happen on a real Windows or Linux host (sockets, permissions,
installers), the end-to-end and image lanes, and flakes. CI still runs those.
-### Pre-push hook (opt-in)
+### Pre-push hook
```bash
bin/ci --install-hook # runs bin/ci before every git push from this clone and its worktrees
@@ -63,16 +64,51 @@ bin/ci --uninstall-hook
CUA_SKIP_LOCAL_CI=1 git push # skip it once
```
-The hook goes in the clone's `hooks/pre-push`. An existing pre-push hook is kept and still runs first.
-If you set a global `core.hooksPath`, your global pre-push hook must chain to the repository hook; the
-installer tells you whether it does. Prefer `CUA_SKIP_LOCAL_CI=1` to `git push --no-verify`, which also
-skips every other pre-push hook. `CUA_LOCAL_CI_ARGS="--quick"` changes what the hook runs.
+Agent machines install the hook; for everyone else it is opt-in. The hook goes in the clone's
+`hooks/pre-push`. An existing pre-push hook is kept and still runs first. If you set a global
+`core.hooksPath`, your global pre-push hook must chain to the repository hook; the installer tells you
+whether it does. Prefer `CUA_SKIP_LOCAL_CI=1` to `git push --no-verify`, which also skips every other
+pre-push hook. `CUA_LOCAL_CI_ARGS="--quick"` changes what the hook runs.
-### Local sign-off (optional)
+### Local sign-off: `bin/ci --signoff`
After a green run on a clean tree, `bin/ci --signoff` sets the `local-ci` commit status on `HEAD` through
`gh api`. If the commit is not on GitHub yet, push and run it again: it reuses the green run. It refuses to
-sign off a run that failed or skipped a check. The status is informational; `ci-gate` does not require it.
+sign off a run that failed or skipped a check. Sign off again after every new commit.
+
+`ci-gate` requires a successful `local-ci` status on the head commit for **agent pull requests**: those
+opened by the Cua Agents GitHub App (`cua-agents[bot]`), labelled `agent`, or opened from an `agent/` branch
+of this repository. Community pull requests are not asked for it. When it is missing the gate says "Run
+bin/ci and bin/ci --signoff on this head commit."
+
+The requirement is **report-only** at first: the gate prints that line as a warning and passes. Setting the
+repository variable `REQUIRE_LOCAL_CI` to `true` makes it blocking. It is the only switch. When blocking, the
+gate polls for the status for five minutes, so signing off right after the push is enough; after a failure,
+sign off and rerun the gate job.
+
+How it authenticates: `bin/ci --signoff` calls `gh api` with whatever credential `gh` uses on that machine
+(`gh auth login` or `GH_TOKEN`), which needs permission to write commit statuses on the repository. It
+reads the result of the last green run from `.git/bin-ci/last-run.json` in that checkout, so run `bin/ci`
+and `bin/ci --signoff` in the same checkout. The status is an ordinary commit status (context `local-ci`)
+on a commit SHA, so another machine or credential can set it, as long as the checks passed on that commit.
+
+## Quick stage
+
+[`ci-quick.yml`](../../.github/workflows/ci-quick.yml) runs `bin/ci --quick` on the pull request: formatting,
+lockfiles, SPDX headers, workflow lint and the other checks that build nothing. It is the command you run
+locally, so the two cannot drift (`bin/ci --verify-sync` covers the rest). It needs no secrets and builds
+nothing, so it is deterministic. A check that needs a package's `node_modules` is skipped there; that
+package's own workflow still runs it.
+
+The heavy workflows (Rust, macOS and Swift, Nix, containers, SDK and end-to-end) start with a `quick` job
+that calls it, and every job in them waits for it (`needs: quick`). A pull request that fails a cheap check
+stops in about a minute instead of spending runner minutes on builds. The jobs use
+`if: ${{ !failure() && !cancelled() }}` so they still run on pushes and manual runs, where `quick` is
+skipped. `ci-quick.yml` also runs on its own on every pull request, so the gate sees a quick failure even
+when no heavy workflow starts. A failed `quick` fails its workflow run; the jobs it skipped are not read as
+passed. It runs once per commit: the first `quick` that passes saves a cache marker (`ci-quick-pass-<sha>`) and the
+others restore it and finish in seconds. Jobs that start before the marker exists run the checks themselves.
+When you add a heavy workflow, add the `quick` job and the `needs` the same way.
## Path-scoped gate