Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

ci: size every run by tier and stop re-testing commits the merge queue proved (#536)

Ruben Lütkeb606a7e56791
diff --git a/.github/workflows/browser-runtime.yml b/.github/workflows/browser-runtime.yml
index 4ddc2cb80d..37b5a8eaa2 100644
--- a/.github/workflows/browser-runtime.yml
+++ b/.github/workflows/browser-runtime.yml
@@ -6,6 +6,10 @@ on:
target:
type: string
default: all
+ os:
+ description: "JSON list of runner labels (empty = every platform); ci.yml sizes it per tier."
+ type: string
+ default: ""
workflow_dispatch:
inputs:
target:
@@ -20,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: ${{ inputs.target == 'windows-latest' && fromJSON('["windows-latest"]') || fromJSON('["ubuntu-latest", "ubuntu-24.04-arm", "windows-latest", "windows-11-arm", "macos-latest", "macos-15-intel"]') }}
+ os: ${{ fromJSON(inputs.os || (inputs.target == 'windows-latest' && '["windows-latest"]') || '["ubuntu-latest", "ubuntu-24.04-arm", "windows-latest", "windows-11-arm", "macos-latest", "macos-15-intel"]') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
@@ -47,8 +51,32 @@ jobs:
with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as stream:
stream.write(f"JARVIS_BROWSER_TEST_PYTHON={venv_python()}\n")
stream.write(f"JARVIS_BROWSER_TEST_EXECUTABLE={browser_executable()}\n")
+ # A real Chrome on a shared runner: in 181 runs one timing-sensitive live
+ # test (a different one each time) failed in 32. As in the suite's
+ # shards, the failed tests get ONE more run: a pass there is reported as
+ # flaky, a second failure blocks. No recorded failure means nothing to
+ # re-run, and that fails too.
- name: Test real frames, ownership and protocol
- run: python -m pytest tests/contract/test_browser_live.py tests/contract/test_browser_contract.py tests/contract/test_browser_desktop_mcp.py tests/contract/test_browser_cli_model.py tests/unit/society/test_browser.py tests/unit/society/test_browser_install.py tests/unit/society/test_approvals.py tests/unit/agent_chat/test_jarvis_identity.py tests/unit/agent_chat/test_agent_chat_ladders.py tests/unit/brain/test_tool_gateway.py -q --tb=short --junitxml=browser-results.xml
+ shell: bash
+ run: |
+ tests=(
+ tests/contract/test_browser_live.py
+ tests/contract/test_browser_contract.py
+ tests/contract/test_browser_desktop_mcp.py
+ tests/contract/test_browser_cli_model.py
+ tests/unit/society/test_browser.py
+ tests/unit/society/test_browser_install.py
+ tests/unit/society/test_approvals.py
+ tests/unit/agent_chat/test_jarvis_identity.py
+ tests/unit/agent_chat/test_agent_chat_ladders.py
+ tests/unit/brain/test_tool_gateway.py
+ )
+ if python -m pytest "${tests[@]}" -q --tb=short --junitxml=browser-results.xml; then
+ exit 0
+ fi
+ echo "::warning title=Flaky browser test::A browser test failed and is re-run once; see the first pytest output of this step."
+ python -m pytest "${tests[@]}" --last-failed --last-failed-no-failures none \
+ -q --tb=short --junitxml=browser-results-retry.xml
- name: Diagnose Windows capture style support after a failure
if: failure() && matrix.os == 'windows-latest' && env.JARVIS_BROWSER_TEST_PYTHON != ''
shell: python
@@ -74,4 +102,4 @@ jobs:
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: browser-results-${{ matrix.os }}
- path: browser-results.xml
+ path: browser-results*.xml
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd938aca50..40af70f1b5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -30,12 +30,23 @@
# Windows suite, and only a green `CI gate` there lands it. This is what keeps
# main green when PRs that pass alone break together.
#
-# Windows: the full suite in four shards on every run that has the python
-# lane, pull requests included, so a Windows-only failure blocks before the
-# merge instead of turning main red after it (the organisation runs on GitHub
-# Team: 60 concurrent jobs, 5 of them macOS).
-# macOS (~10x runner cost): nightly and manual dispatch, plus the path-gated
-# realtime contract and macOS desktop lanes.
+# Tiers (scripts/ci/plan_run.py): the width of a run follows what it has to
+# prove. Measured 2026-10-07..12 over 338 runs: a run fanned out to 46 jobs in
+# the median (up to 69, 7-11 of them macOS) against 60 concurrent jobs with 5
+# macOS slots, so two runs filled the pool; 56 % of macOS jobs waited more than
+# five minutes (worst case two hours), and every change ran the suite three
+# times - pull request, merge queue, and again on the push that landed the
+# very same commit.
+# pr pull request: the whole Linux + Windows suite and every affected
+# lane on Linux and Windows. No macOS, no 18-minute real-runtime leg.
+# queue merge-queue group: everything `pr` runs, one macOS leg per affected
+# lane and the slow legs. The only blocking macOS proof per change.
+# full nightly, release tags, manual full dispatch: Intel macOS, the ARM
+# runners, every interpreter, the macOS test shards.
+# A push to main whose commit the merge queue already passed runs nothing
+# but `detect` and the gate (`proven`); a push that bypassed the queue runs
+# the `queue` tier. A branch gets macOS feedback before the queue with
+# `gh workflow run ci.yml --ref <branch> -f full=false -f include_macos=true`.
#
# Action SHAs are pinned to 40-char commits (CVE-2025-30066 hardening).
@@ -94,6 +105,9 @@ jobs:
name: detect lanes
runs-on: ubuntu-latest
timeout-minutes: 5
+ permissions:
+ contents: read
+ actions: read # the merge-queue run lookup behind `proven`
outputs:
full: ${{ steps.lanes.outputs.full }}
python: ${{ steps.lanes.outputs.python }}
@@ -110,20 +124,29 @@ jobs:
macos: ${{ steps.mode.outputs.macos }}
base: ${{ steps.mode.outputs.base }}
pr_mode: ${{ steps.mode.outputs.pr_mode }}
- linux_shards: ${{ steps.shards.outputs.linux_shards }}
- windows_shards: ${{ steps.shards.outputs.windows_shards }}
- tests_full: ${{ steps.shards.outputs.tests_full }}
+ proven: ${{ steps.proven.outputs.proven }}
+ linux_shards: ${{ steps.mode.outputs.linux_shards }}
+ windows_shards: ${{ steps.mode.outputs.windows_shards }}
os_matrix: ${{ steps.mode.outputs.os_matrix }}
+ lane_os: ${{ steps.mode.outputs.lane_os }}
+ updater_matrix: ${{ steps.mode.outputs.updater_matrix }}
+ crypto_matrix: ${{ steps.mode.outputs.crypto_matrix }}
+ e2e_matrix: ${{ steps.mode.outputs.e2e_matrix }}
+ browser_os: ${{ steps.mode.outputs.browser_os }}
+ desktop_legs: ${{ steps.mode.outputs.desktop_legs }}
duration_snapshot: ${{ steps.snapshot.outputs.name }}
release: ${{ github.ref_type == 'tag' }}
steps:
+ # History without file contents: the diff base needs commits and
+ # trees only, and every other job waits for this one.
- name: Checkout (full history for the diff base)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
+ filter: blob:none
persist-credentials: false
- - name: Decide run mode and diff base
+ - name: Decide the tier, the matrices and the diff base
id: mode
shell: bash
env:
@@ -131,39 +154,44 @@ jobs:
IN_FULL: ${{ inputs.full }}
IN_MACOS: ${{ inputs.include_macos }}
PR_BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
+ BEFORE: ${{ github.event.before }}
run: |
- # A merge-queue group and a push to main classify their lanes like a
- # pull request (runners are shared by every agent's PR, and macOS
- # has only five slots), and like a pull request they run the WHOLE
- # test suite on Linux and Windows. A merge group's lanes are
- # classified against the queue base (main or the entry ahead).
- # Nightly and manual full runs force everything.
- full=false; macos=false; pr_mode=false; tests_full=false
- case "$EVENT" in
- push|merge_group) tests_full=true ;;
- schedule) full=true; macos=true; tests_full=true ;;
- workflow_dispatch)
- [ "$IN_FULL" = "true" ] && full=true && tests_full=true
- [ "$IN_MACOS" = "true" ] && macos=true ;;
- pull_request) pr_mode=true ;;
- esac
- # A branch run the merge train dispatched behaves like its pull request.
- if [ "$EVENT" = "workflow_dispatch" ] && [ "$full" = "false" ]; then pr_mode=true; fi
+ # The tier and every job matrix (scripts/ci/plan_run.py). A
+ # merge-queue group and a push to main classify their lanes like a
+ # pull request; a merge group's lanes are classified against the
+ # queue base (main or the entry ahead). Nightly and manual full
+ # runs force everything.
+ python3 scripts/ci/plan_run.py plan --event "$EVENT" --ref "$GITHUB_REF" \
+ --full "${IN_FULL:-false}" --include-macos "${IN_MACOS:-false}"
git fetch --no-tags --quiet origin main:refs/remotes/origin/main || true
base="$PR_BASE"
if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then
base="$(git merge-base HEAD refs/remotes/origin/main 2>/dev/null || true)"
fi
if [ "$EVENT" = "push" ]; then
- before="${{ github.event.before }}"
- case "$before" in (*[!0]*) git cat-file -e "$before^{commit}" 2>/dev/null && base="$before" ;; esac
+ case "$BEFORE" in (*[!0]*) git cat-file -e "$BEFORE^{commit}" 2>/dev/null && base="$BEFORE" ;; esac
+ fi
+ echo "base=$base" | tee -a "$GITHUB_OUTPUT"
+
+ # A queue group and the push that lands it are ONE commit. When the
+ # queue already passed it, this run has nothing left to prove: every
+ # lane goes off and the gate needs `detect` alone. Any doubt (a direct
+ # push, an API error) fails open to the `queue` tier.
+ - name: Did the merge queue already pass this exact commit?
+ id: proven
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ EVENT: ${{ github.event_name }}
+ FULL: ${{ steps.mode.outputs.full_mode }}
+ MACOS: ${{ steps.mode.outputs.macos }}
+ run: |
+ if [ "$GITHUB_REF" = "refs/heads/main" ] && [ "$FULL" != "true" ] && [ "$MACOS" != "true" ] \
+ && { [ "$EVENT" = "push" ] || [ "$EVENT" = "workflow_dispatch" ]; }; then
+ python3 scripts/ci/plan_run.py proven --repo "$GITHUB_REPOSITORY" --sha "$GITHUB_SHA"
+ else
+ echo "proven=false" | tee -a "$GITHUB_OUTPUT"
fi
- if [ "$macos" = "true" ]; then os='["ubuntu-latest","windows-latest","macos-latest"]'; else os='["ubuntu-latest","windows-latest"]'; fi
- {
- echo "full_mode=$full"; echo "tests_full=$tests_full"; echo "macos=$macos"
- echo "pr_mode=$pr_mode"; echo "base=$base"
- echo "os_matrix=$os"
- } | tee -a "$GITHUB_OUTPUT"
- name: Classify the change into lanes
id: lanes
@@ -171,11 +199,16 @@ jobs:
env:
FULL: ${{ steps.mode.outputs.full_mode }}
BASE: ${{ steps.mode.outputs.base }}
+ PROVEN: ${{ steps.proven.outputs.proven }}
run: |
- if [ "$FULL" = "true" ] || [ -z "$BASE" ]; then
+ if [ "$PROVEN" = "true" ]; then
+ python3 scripts/ci/classify_changes.py --proven
+ elif [ "$FULL" = "true" ] || [ -z "$BASE" ]; then
python3 scripts/ci/classify_changes.py --full
else
- git diff --name-only "$BASE" HEAD | tee changed.txt | python3 scripts/ci/classify_changes.py
+ # --no-renames: both sides of a rename count as changed, and the
+ # blobless checkout never has to fetch file contents to pair them.
+ git diff --name-only --no-renames "$BASE" HEAD | tee changed.txt | python3 scripts/ci/classify_changes.py
fi
# Resolve the mutable cache ONCE. All shards download the same immutable
@@ -202,22 +235,10 @@ jobs:
if-no-files-found: error
retention-days: 7
- # The whole suite on both: six Linux shards, four Windows shards, on
- # every run with the python lane. Pull requests used to get one Windows
- # runner with only the tests the diff could reach, which let Windows-only
- # failures through to main; the 60-job limit makes room for the full
- # matrix. scripts/ci/select_tests.py stays for agent_land.py's local run.
- - name: Size the test matrices
- id: shards
- shell: bash
- run: |
- echo 'linux_shards=[1,2,3,4,5,6]' >> "$GITHUB_OUTPUT"
- echo 'windows_shards=[1,2,3,4]' >> "$GITHUB_OUTPUT"
- echo 'tests_full=true' >> "$GITHUB_OUTPUT"
-
gates:
name: static gates
needs: detect
+ if: needs.detect.outputs.proven != 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
@@ -256,11 +277,13 @@ jobs:
"$RUNNER_TEMP/actionlint/actionlint" -shellcheck= -pyflakes=
# Workflow audit. A blocking part of the gate on every event, merge-queue
- # groups included; security.yml keeps uploading the same audit to the
- # Security tab from main. Accepted exceptions live in .github/zizmor.yml.
+ # groups included (only a push the queue already proved skips it);
+ # security.yml keeps uploading the same audit to the Security tab from main.
+ # Accepted exceptions live in .github/zizmor.yml.
zizmor:
name: zizmor (workflow audit)
needs: detect
+ if: needs.detect.outputs.proven != 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
@@ -415,7 +438,7 @@ jobs:
matrix:
shard: ${{ fromJSON(needs.detect.outputs.linux_shards) }}
runs-on: ubuntu-latest
- timeout-minutes: 45
+ timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
@@ -437,12 +460,14 @@ jobs:
continue-on-error: true
env:
SHARD: ${{ matrix.shard }}
- run: >-
- python scripts/ci/run_tests_parallel.py tests
- --shard "$SHARD/6"
- --report "out/test-report-linux-$SHARD.json"
- --junit-out "out/junit-linux-$SHARD.xml"
- --durations-out "out/durations-linux-$SHARD.json"
+ SHARDS: ${{ needs.detect.outputs.linux_shards }}
+ run: |
+ total=$(python -c "import json,os; print(len(json.loads(os.environ['SHARDS'])))")
+ python scripts/ci/run_tests_parallel.py tests \
+ --shard "$SHARD/$total" \
+ --report "out/test-report-linux-$SHARD.json" \
+ --junit-out "out/junit-linux-$SHARD.xml" \
+ --durations-out "out/durations-linux-$SHARD.json"
- name: Ratchet (a failure not in the baseline blocks)
env:
SHARD: ${{ matrix.shard }}
@@ -463,60 +488,40 @@ jobs:
matrix:
shard: ${{ fromJSON(needs.detect.outputs.windows_shards) }}
runs-on: windows-latest
- timeout-minutes: 60
+ timeout-minutes: 40
defaults:
run:
shell: bash
steps:
+ # The whole suite on every tier: a Windows-only failure blocks the pull
+ # request instead of ejecting it from the merge queue.
+ # scripts/ci/select_tests.py stays for agent_land.py's local run.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
- fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- - name: Pick the tests (full run, or what this diff can reach)
- id: pick
- env:
- FULL: ${{ needs.detect.outputs.tests_full }}
- BASE: ${{ needs.detect.outputs.base }}
- SHARDS: ${{ needs.detect.outputs.windows_shards }}
- run: |
- mkdir -p out
- if [ "$FULL" = "true" ] || [ -z "$BASE" ]; then
- echo "mode=all" >> "$GITHUB_OUTPUT"
- else
- git diff --name-only "$BASE" HEAD > out/changed.txt
- python scripts/ci/select_tests.py --changed-from out/changed.txt --out out/selected.txt
- fi
- count=$(python -c "import json,os; print(len(json.loads(os.environ['SHARDS'])))")
- echo "total=$count" >> "$GITHUB_OUTPUT"
- name: Install
- if: steps.pick.outputs.mode != 'none'
uses: ./.github/actions/install-locked
with:
extras: dev telephony
- name: Download the shared duration snapshot
- if: steps.pick.outputs.mode != 'none'
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ needs.detect.outputs.duration_snapshot }}
- name: Run shard
- if: steps.pick.outputs.mode != 'none'
continue-on-error: true
env:
SHARD: ${{ matrix.shard }}
- PICK_MODE: ${{ steps.pick.outputs.mode }}
- PICK_TOTAL: ${{ steps.pick.outputs.total }}
+ SHARDS: ${{ needs.detect.outputs.windows_shards }}
run: |
- files=()
- if [ "$PICK_MODE" = "selected" ]; then files=(--files-from out/selected.txt); fi
- python scripts/ci/run_tests_parallel.py tests "${files[@]}" \
- --shard "$SHARD/$PICK_TOTAL" \
+ total=$(python -c "import json,os; print(len(json.loads(os.environ['SHARDS'])))")
+ python scripts/ci/run_tests_parallel.py tests \
+ --shard "$SHARD/$total" \
--report "out/test-report-windows-$SHARD.json" \
--junit-out "out/junit-windows-$SHARD.xml"
- name: Ratchet (a failure not in the baseline blocks)
- if: steps.pick.outputs.mode != 'none'
env:
SHARD: ${{ matrix.shard }}
run: python scripts/ci/ratchet_tests.py check --baseline scripts/ci/test-baseline-windows.json "out/test-report-windows-$SHARD.json"
@@ -589,27 +594,39 @@ jobs:
path: reports
merge-multiple: true
- name: Min-passed floor across all Linux shards (BLOCKING)
- run: python scripts/ci/ratchet_tests.py summary --floor --expected-shards 6 --baseline scripts/ci/test-baseline-linux.json reports
+ env:
+ SHARDS: ${{ needs.detect.outputs.linux_shards }}
+ run: |
+ total=$(python -c "import json,os; print(len(json.loads(os.environ['SHARDS'])))")
+ python scripts/ci/ratchet_tests.py summary --floor --expected-shards "$total" --baseline scripts/ci/test-baseline-linux.json reports
# Report only: flaky files (failed in a batch, passed alone) and new vs
# known failures. On main the cross-OS view and the "Flaky tests on main"
# issue come from .github/workflows/flaky-tests.yml.
- name: Flaky files and failures (report only)
if: ${{ !cancelled() }}
run: python scripts/ci/flaky_report.py summary reports
+ # The nightly run refreshes the cache: a push the merge queue already
+ # proved runs no tests, and only a run on main may write a cache every
+ # branch can read.
- name: Merge the duration cache (main only)
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule')
run: python scripts/ci/ratchet_tests.py durations --out test_durations.json reports
- name: Save the duration cache (main only)
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule')
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: test_durations.json
key: test-durations-${{ github.run_id }}
+ # Three test shards and the build side by side: `npm test` alone took seven
+ # minutes in one process and was the longest Linux leg of a run.
frontend:
- name: frontend (test + build + budget)
needs: detect
if: needs.detect.outputs.frontend == 'true'
+ strategy:
+ fail-fast: false
+ matrix:
+ part: ["test 1/3", "test 2/3", "test 3/3", "build + budget"]
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
@@ -625,10 +642,17 @@ jobs:
cache: npm
cache-dependency-path: jarvis/ui/web/frontend/package-lock.json
- run: npm ci
- - run: npm test
- - run: npm run build
+ - name: Unit tests (one shard)
+ if: startsWith(matrix.part, 'test ')
+ env:
+ PART: ${{ matrix.part }}
+ run: npm test -- --shard="${PART#test }"
+ - name: Production build
+ if: matrix.part == 'build + budget'
+ run: npm run build
# The entry chunk's size IS startup latency (AP-26's measurable half).
- name: Startup bundle budget
+ if: matrix.part == 'build + budget'
working-directory: ${{ github.workspace }}
run: python3 scripts/ci/check_frontend_bundle_budget.py
@@ -694,14 +718,10 @@ jobs:
if: needs.detect.outputs.deps == 'true'
strategy:
fail-fast: false
+ # Windows ARM on a pull request, Intel macOS added in the queue, both
+ # interpreters and Apple Silicon in the wide matrix (plan_run.py).
matrix:
- include:
- - {runner: macos-15-intel, architecture: x64, python: '3.11'}
- - {runner: macos-15-intel, architecture: x64, python: '3.14'}
- - {runner: macos-15, architecture: arm64, python: '3.11'}
- - {runner: macos-15, architecture: arm64, python: '3.14'}
- - {runner: windows-11-arm, architecture: arm64, python: '3.12'}
- - {runner: windows-11-arm, architecture: arm64, python: '3.14'}
+ include: ${{ fromJSON(needs.detect.outputs.crypto_matrix) }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 25
steps:
@@ -737,7 +757,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
+ os: ${{ fromJSON(needs.detect.outputs.lane_os) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 25
steps:
@@ -772,8 +792,10 @@ jobs:
# The in-app updater on every OS it ships to. Each one replaces a running
# app differently (Inno handover, .app swap, AppImage swap, git transaction
- # + restart helper), and the POSIX-only tests run the real relaunch waiter,
- # so this lane is never narrowed to one runner the way PR test jobs are.
+ # + restart helper), and the POSIX-only tests run the real relaunch waiter.
+ # A pull request runs Linux and the real Windows upgrade; the merge queue
+ # adds macOS and the second Windows interpreter; the wide matrix adds the
+ # Intel Mac (scripts/ci/plan_run.py).
#
# Python: 3.11 is the floor, 3.12 is what the native installers freeze.
# macos-15-intel adds the x86_64 Mac (the Intel .dmg and its Rosetta probe).
@@ -788,10 +810,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
- python: ["3.11", "3.12"]
- include:
- - {os: macos-15-intel, python: "3.12"}
+ include: ${{ fromJSON(needs.detect.outputs.updater_matrix) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
@@ -943,12 +962,16 @@ jobs:
needs: detect
if: needs.detect.outputs.browser == 'true'
uses: ./.github/workflows/browser-runtime.yml
+ with:
+ os: ${{ needs.detect.outputs.browser_os }}
macos-desktop:
name: macOS desktop
needs: detect
- if: needs.detect.outputs.macos_desktop == 'true' && (needs.detect.outputs.full != 'true' || needs.detect.outputs.macos == 'true')
+ if: needs.detect.outputs.macos_desktop == 'true' && needs.detect.outputs.desktop_legs != 'none'
uses: ./.github/workflows/macos-desktop.yml
+ with:
+ legs: ${{ needs.detect.outputs.desktop_legs }}
installer:
name: installer smoke
@@ -961,15 +984,16 @@ jobs:
# Hermes / OpenClaw society agents on every OS a person runs them on. The
# lane (scripts/ci/agent_runtime_suite.py) covers the runtimes AND the chat
- # and society code that drives them, so a pull request proves macOS too,
- # not only the nightly run. Fakes only: no key, no network to a model.
+ # and society code that drives them. A pull request proves Linux and
+ # Windows, the merge queue adds macOS before anything lands. Fakes only: no
+ # key, no network to a model.
agent-runtimes-unit:
needs: detect
if: needs.detect.outputs.agent_runtimes == 'true'
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
+ os: ${{ fromJSON(needs.detect.outputs.lane_os) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 25
steps:
@@ -1020,15 +1044,16 @@ jobs:
# budgets, the runtime unit tests on the same machine, and proof that the
# user PATH and shell profiles stayed put (scripts/ci/agent_runtime_e2e.py).
# No key, no network to a model. The weekly canary does the same at
- # upstream latest and raises the pin.
+ # upstream latest and raises the pin. A pull request runs both runtimes on
+ # Linux and OpenClaw on Windows; the 18-minute Hermes install on Windows
+ # and both macOS legs run in the merge queue (scripts/ci/plan_run.py).
agent-runtimes-e2e:
needs: detect
if: needs.detect.outputs.agent_runtimes == 'true'
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
- runtime: [hermes, openclaw]
+ include: ${{ fromJSON(needs.detect.outputs.e2e_matrix) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
diff --git a/.github/workflows/flaky-tests.yml b/.github/workflows/flaky-tests.yml
index 553d801d81..158a11df65 100644
--- a/.github/workflows/flaky-tests.yml
+++ b/.github/workflows/flaky-tests.yml
@@ -73,7 +73,12 @@ jobs:
case "$RUN_ID" in (''|*[!0-9]*) echo "::error::not a run id: $RUN_ID"; exit 1 ;; esac
gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID" > out/run.json
python scripts/ci/flaky_report.py vet-run out/run.json --repo "$GITHUB_REPOSITORY"
+ # A push the merge queue already proved runs no tests (ci.yml,
+ # `proven`): it has no shard reports and nothing to record.
+ reports="$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID/artifacts?per_page=100" --jq '[.artifacts[] | select(.name | startswith("tests-"))] | length')"
+ echo "reports=$reports" | tee -a "$GITHUB_OUTPUT"
- name: Download the run's shard reports
+ if: steps.run.outputs.reports != '0'
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
run-id: ${{ steps.run.outputs.id }}
@@ -82,8 +87,10 @@ jobs:
path: reports
merge-multiple: true
- name: Flaky files and failures (step summary)
+ if: steps.run.outputs.reports != '0'
run: python scripts/ci/flaky_report.py summary reports
- name: Update the tracking issue
+ if: steps.run.outputs.reports != '0'
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ steps.run.outputs.id }}
diff --git a/.github/workflows/macos-desktop.yml b/.github/workflows/macos-desktop.yml
index 99b26b5831..55f39910d4 100644
--- a/.github/workflows/macos-desktop.yml
+++ b/.github/workflows/macos-desktop.yml
@@ -7,10 +7,16 @@
name: macOS desktop
-# Called by ci.yml's `macos_desktop` lane (path-gated there; on full runs only
-# when macOS is included) and runnable by hand. The caller owns concurrency.
+# Called by ci.yml's `macos_desktop` lane (path-gated there) and runnable by
+# hand. The merge queue runs the Apple Silicon row (`legs: primary`); nightly,
+# release and manual runs add both Intel rows. The caller owns concurrency.
on:
workflow_call:
+ inputs:
+ legs:
+ description: "primary = the Apple Silicon row only; anything else = every row."
+ type: string
+ default: all
workflow_dispatch:
permissions:
@@ -21,24 +27,11 @@ jobs:
name: ${{ matrix.name }} / Python ${{ matrix.python }}
strategy:
fail-fast: false
+ # Rows: Intel, Apple Silicon, and the BUG-060 regression row - the stub
+ # launcher must also link against a NON-framework interpreter (uv's
+ # python-build-standalone), the layout py2app never supported.
matrix:
- include:
- - name: Intel
- runner: macos-15-intel
- architecture: x86_64
- python: "3.12"
- - name: Apple Silicon
- runner: macos-15
- architecture: arm64
- python: "3.13"
- # BUG-060 regression row: the stub launcher must also link against
- # a NON-framework interpreter (uv's python-build-standalone), the
- # layout py2app never supported.
- - name: Intel standalone (uv)
- runner: macos-15-intel
- architecture: x86_64
- python: "3.12"
- python-source: uv-standalone
+ include: ${{ fromJSON(inputs.legs == 'primary' && '[{"name":"Apple Silicon","runner":"macos-15","architecture":"arm64","python":"3.13"}]' || '[{"name":"Intel","runner":"macos-15-intel","architecture":"x86_64","python":"3.12"},{"name":"Apple Silicon","runner":"macos-15","architecture":"arm64","python":"3.13"},{"name":"Intel standalone (uv)","runner":"macos-15-intel","architecture":"x86_64","python":"3.12","python-source":"uv-standalone"}]') }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
diff --git a/docs/agent-runtimes.md b/docs/agent-runtimes.md
index 35cda28cb1..24408a8120 100644
--- a/docs/agent-runtimes.md
+++ b/docs/agent-runtimes.md
@@ -402,13 +402,18 @@ each of them:
| Job | Where | What it proves |
|---|---|---|
-| `agent-runtimes-unit` | Linux, Windows, macOS on the portable base install | The runtime drivers, gateway, ACP runner, chat service, send queue, controls, society binding, roster, routines and society routes (`python scripts/ci/agent_runtime_suite.py`). Fakes only. |
+| `agent-runtimes-unit` | Linux and Windows on a pull request, macOS added in the merge queue; the portable base install | The runtime drivers, gateway, ACP runner, chat service, send queue, controls, society binding, roster, routines and society routes (`python scripts/ci/agent_runtime_suite.py`). Fakes only. |
| `agent-runtimes-headless` | `python:3.11-slim` | The runtime package imports and its tests pass on a server with no GPU, audio or desktop stack, and the app's Hermes setup without curl stops with "Setup needs curl". |
-| `agent-runtimes-e2e` | Linux, Windows, macOS × Hermes, OpenClaw | `scripts/ci/agent_runtime_e2e.py`: the app's own setup job (`manager.wait_ready`) installs the release pinned in `jarvis/agent_runtimes/runtime-versions.json` with a desktop app's PATH, never npm or a manual installer. Then two turns per model-gateway protocol against scripted providers (`--replay`), the fake-model driver check with turn-1 budgets (Hermes 30 s, OpenClaw 90 s), `pytest tests/unit/agent_runtimes`, and proof that the Windows user PATH gained no `agent_runtimes` entry and OpenClaw edited no shell profile. No key and no network to a model. |
-
-The impact selection of the Windows pull-request leg adds the same suite
-whenever the lane is on, so a runtime change also runs the chat and society
-tests, not only the tests that import the changed module.
+| `agent-runtimes-e2e` | Pull request: Linux × Hermes, OpenClaw and Windows × OpenClaw. Merge queue: Linux, Windows, macOS × Hermes, OpenClaw | `scripts/ci/agent_runtime_e2e.py`: the app's own setup job (`manager.wait_ready`) installs the release pinned in `jarvis/agent_runtimes/runtime-versions.json` with a desktop app's PATH, never npm or a manual installer. Then two turns per model-gateway protocol against scripted providers (`--replay`), the fake-model driver check with turn-1 budgets (Hermes 30 s, OpenClaw 90 s), `pytest tests/unit/agent_runtimes`, and proof that the Windows user PATH gained no `agent_runtimes` entry and OpenClaw edited no shell profile. No key and no network to a model. |
+
+Every change has passed all three jobs on all three OSes before it lands:
+the merge queue is the blocking proof (`scripts/ci/plan_run.py` sizes the
+matrices). The Hermes install on Windows takes about 18 minutes and both
+macOS legs share five runner slots with every other pull request, so they
+run once per change, in the queue, not on every push to a branch. The
+impact selection of `scripts/agent_land.py` adds the same suite whenever the
+lane is on, so a runtime change also runs the chat and society tests, not
+only the tests that import the changed module.
`agent-runtimes-canary.yml` runs weekly and on dispatch. In its own checkout
it points the pin at upstream latest (`agent_runtime_suite.py
diff --git a/docs/ci-pipeline.md b/docs/ci-pipeline.md
index 8a881a2585..e21400fba7 100644
--- a/docs/ci-pipeline.md
+++ b/docs/ci-pipeline.md
@@ -16,24 +16,58 @@ agent branch ──► pull request ──► CI (lanes) ──► CI gate ─
## 1. CI — `.github/workflows/ci.yml`
+### Tiers: how wide a run is
+
+The organisation has 60 concurrent jobs, 5 of them macOS, shared by every
+agent's pull request. The width of a run therefore follows what the run has
+to prove (`scripts/ci/plan_run.py` emits the tier and every job matrix):
+
+| Tier | When | What runs | Target |
+| --- | --- | --- | --- |
+| `pr` | pull request, branch run dispatched by the merge train | Static gates, the whole Linux + Windows suite, every affected lane on Linux and Windows. No macOS, and not the 18-minute Hermes install on Windows. | ~10 min |
+| `queue` | merge-queue group; a push that reached main without the queue | Everything `pr` runs, plus one macOS leg per affected lane and the slow legs. The blocking proof of the exact tree main gets. | ~10 min, ~20 min when the agent-runtime lane is affected |
+| `full` | nightly, release tag, manual full dispatch | The wide matrix: Intel macOS, the ARM runners, every interpreter, the macOS test shards, all three macOS desktop rows. | ~30 min |
+| proven | push to main of a commit the merge queue already passed | `detect` and `CI gate` only. | under 1 min |
+
+A queue group and the push that lands it are one commit, so the push run
+asks the API for a green `merge_group` run of its own SHA and, when there is
+one, turns every lane off. Any doubt (a direct push, an API error) fails open
+to the `queue` tier. A nightly run never accepts an earlier proof.
+
+A branch gets macOS feedback before the queue with
+`gh workflow run ci.yml --ref <branch> -f full=false -f include_macos=true`.
+
+Measured before the tiers (338 runs, 2026-10-07 to 2026-10-12): a run fanned
+out to 46 jobs in the median and up to 69, with 7 to 11 macOS legs; 56 % of
+macOS jobs and 28 % of Linux jobs waited more than five minutes for a runner
+(worst case over two hours); every change ran the suite three times (pull
+request, merge queue, and again on the push of the same commit).
+
+### Jobs
+
| Stage | What it does | Script |
| --- | --- | --- |
-| `detect` | Classifies the diff into lanes. Fails open: an empty diff, a pipeline change, the nightly run and a manual run turn every lane on. A merge-queue group (`merge_group`, classified against the queue base) and a push to main classify their lanes too (the concurrent-job limit is shared), but always run the whole test suite on Linux and Windows. | `scripts/ci/classify_changes.py` |
+| `detect` | Picks the tier and the matrices, then classifies the diff into lanes. Fails open: an empty diff, a pipeline change, the nightly run and a manual run turn every lane on. A merge-queue group is classified against the queue base. Only a push the merge queue already proved turns every lane off. | `scripts/ci/plan_run.py`, `scripts/ci/classify_changes.py` |
| `static gates` | ~20 repository gates (keys, bundle, mirrors, privacy, docs, CLI coverage, ratchets, bash 3.2, no new German) in one job. Every gate reports. | `scripts/ci/run_gates.py` |
| `zizmor` / `dependency review` | Workflow security audit on every event (merge queue included, exceptions in `.github/zizmor.yml`); dependency review on pull requests only, failing on an added dependency with a high or critical advisory. `security.yml` keeps the Security-tab uploads. | — |
| `live third-party sites` | Nightly only and non-blocking: the opt-in live checks of pages the app parses (`JARVIS_LIVE_NETWORK_TESTS=1`, ollama.com's library). A site redesign shows as a failed step and a run warning, never as a red gate. | — |
| `python contracts (fast)` | Import cleanliness on the bare install, the named contract guards, skill-routing precision and recall, plugin auth. Blocking, no baseline. | — |
| `tests linux 1..6` | The whole suite in six shards. Batches of files run in fresh processes with a wall-clock budget; a failed batch is re-run file by file, a failed file once more (a pass there is reported as flaky). | `scripts/ci/run_tests_parallel.py` |
-| `tests windows` | The whole suite in four shards on every run with the python lane, pull requests included, so Windows-only failures block before the merge. | — |
-| `tests macos 1..3` | Nightly and manual runs only (~10x runner cost). | — |
-| `test report + floor` | Proves the six Linux shards cover every discovered file exactly once, enforces the min-passed floor, and on main refreshes the duration cache. Detection freezes one shared duration snapshot for all shards, including partial reruns. | `scripts/ci/ratchet_tests.py` |
-| Lanes | `frontend`, `jarvisctl`, `deps`, `realtime` (3 OS + slim container), `updater` (3 OS: in-app update, native handover, restart helper), `agent runtimes` (3 OS + slim container + the real Hermes and OpenClaw at their pinned version; see [agent-runtimes.md](agent-runtimes.md#ci-and-release-gates)), `dragdrop`, `browser`, `macOS desktop`, `installer smoke` — each only when its paths change. | — |
+| `tests windows 1..6` | The whole suite in six shards on every tier, pull requests included, so a Windows-only failure blocks the pull request instead of ejecting it from the merge queue. | `scripts/ci/run_tests_parallel.py` |
+| `tests macos 1..3` | Nightly, release and manual runs with macOS only. | — |
+| `test report + floor` | Proves the six Linux shards cover every discovered file exactly once, enforces the min-passed floor. The nightly run on main (and a push that bypassed the queue) refreshes the duration cache. Detection freezes one shared duration snapshot for all shards, including partial reruns. | `scripts/ci/ratchet_tests.py` |
+| Lanes | `frontend` (three test shards and the build, side by side), `jarvisctl`, `deps`, `realtime` (+ slim container), `updater` (in-app update, native handover, restart helper), `agent runtimes` (+ slim container + the real Hermes and OpenClaw at their pinned version; see [agent-runtimes.md](agent-runtimes.md#ci-and-release-gates)), `dragdrop`, `browser`, `macOS desktop`, `installer smoke` — each only when its paths change, each as wide as the tier: Linux + Windows on a pull request, + macOS in the merge queue, + Intel and ARM in the wide matrix. | `scripts/ci/plan_run.py` |
| `release qualification` | Tag CI requires a full run with macOS and the browser-auth E2E evidence gate: a plugin labeled verified needs a completed journey, every completed journey ships as verified, and every other plugin ships labeled preview. The step summary counts both. Ordinary branch/PR/nightly CI skips this release-only job. | `scripts/ci/check_plugin_auth_contract.py --require-e2e-pass` |
| `CI gate` | Aggregates every job. **The only required check**, on the pull request and again on its merge-queue group. A missing or skipped selected lane fails. Unselected lanes may skip; nightly is strict except event-specific jobs. | `scripts/ci/required_results.py` |
+The browser lane drives a real Chrome on a shared runner, where a
+timing-sensitive live test failed in about one run in five. Its failed tests
+get one more run, as failed files do in the test shards: a pass there is
+reported as a flaky warning, a second failure blocks.
+
The realtime lane runs the subscription authentication, direct reasoning,
voice transport, session orchestration, native login provisioning and Live catalog contracts on Windows,
-macOS and Linux, including the slim container without system audio. These
+macOS and Linux (macOS from the merge queue on), including the slim container without system audio. These
focused tests are strict: they do not use the broad-suite failure baseline.
Their fake credentials and transports also prove that a selected subscription
cannot fall through to a retained API-key provider when its account is absent
@@ -73,8 +107,9 @@ A file that fails inside its batch and passes when re-run alone is reported
as flaky. That almost always means test-order dependence, and the ratchet does
not block on it, so it is tracked instead. `test report + floor` lists flaky
files and new versus known failures in its step summary on every run. After
-each push, nightly and manual CI run on main, `.github/workflows/flaky-tests.yml`
-does the same for every OS and keeps one issue, "Flaky tests on main", updated
+each nightly and manual CI run on main (and a push that bypassed the merge
+queue; a push the queue already proved runs no tests and is skipped),
+`.github/workflows/flaky-tests.yml` does the same for every OS and keeps one issue, "Flaky tests on main", updated
with a rolling table (test file, OS, number of runs it was flaky in, last seen
run). Rows age out after 30 days without a sighting. That workflow is the only
place with `issues: write`; it never runs for pull requests and refuses any CI
@@ -111,16 +146,18 @@ the queue drops entries it no longer needs itself, and a dropped pending run
would leave `CI gate` unreported until the queue times out. A run on main is
never cancelled once it started; pushes to main share one queue slot, so a
burst of pushes leaves one pending run that covers every commit before it
-instead of a backlog behind the organisation's concurrent-job limit. The
-nightly run and manual runs have their own slots.
+instead of a backlog behind the organisation's concurrent-job limit. A push
+the merge queue already proved finishes in under a minute. The nightly run
+and manual runs have their own slots.
## 2. Integrating several agents — merge queue + `.github/workflows/merge-train.yml`
`main` requires a **merge queue** (repository ruleset "main merge queue":
squash, `CI gate` required). A pull request's own CI is its admission ticket;
the queue then builds each entry on top of the newest main plus every entry
-ahead of it, runs `ci.yml` on that exact tree (`merge_group` event, whole
-Linux + Windows suite), and squash-merges only when `CI gate` is green there.
+ahead of it, runs `ci.yml` on that exact tree (`merge_group` event: the
+`queue` tier, whole Linux + Windows suite plus one macOS leg per affected
+lane), and squash-merges only when `CI gate` is green there.
Changes that pass alone and break together stop in the queue instead of on
main. A failed entry leaves the queue; the entries behind it are rebuilt
without it.
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index d58d0f563d..706613a0ef 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -16,6 +16,9 @@ never be skipped when the change could break it:
* ``python`` is a DENYLIST: it is off only when every path is provably
outside what the test suite reads. Tests read docs/, the frontend source,
install/ and assets/, so those keep it on.
+* ``--proven`` is the one way every lane goes off: the caller verified that
+ the merge queue already passed this exact commit (``plan_run.py proven``),
+ so nothing is left to prove on the push that lands it.
Outputs beyond the lanes:
@@ -263,8 +266,10 @@ def _python_relevant(path: str) -> bool:
return not (path.startswith(_PY_IRRELEVANT_PREFIXES) or path in _PY_IRRELEVANT_FILES)
-def classify(paths: Iterable[str], *, full: bool = False) -> dict[str, bool]:
+def classify(paths: Iterable[str], *, full: bool = False, proven: bool = False) -> dict[str, bool]:
"""Return ``{lane: bool}`` plus ``full`` for a change set."""
+ if proven:
+ return {**{lane: False for lane in LANES}, "full": False}
changed = _normalize(paths)
force = full or not changed or _any(changed, _PIPELINE_PREFIXES)
if force:
@@ -300,6 +305,11 @@ def _emit(result: dict[str, bool], changed_count: int) -> list[str]:
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--full", action="store_true", help="Force every lane on.")
+ parser.add_argument(
+ "--proven",
+ action="store_true",
+ help="Every lane off: the merge queue already passed this exact commit.",
+ )
parser.add_argument("--files-from", type=Path, help="Read paths from this file, not stdin.")
args = parser.parse_args(argv)
@@ -310,7 +320,7 @@ def main(argv: list[str] | None = None) -> int:
else:
paths = [] if sys.stdin is None or sys.stdin.isatty() else sys.stdin.read().splitlines()
changed = _normalize(paths)
- result = classify(changed, full=args.full)
+ result = classify(changed, full=args.full, proven=args.proven)
lines = _emit(result, len(changed))
output = os.environ.get("GITHUB_OUTPUT")
diff --git a/scripts/ci/plan_run.py b/scripts/ci/plan_run.py
new file mode 100644
index 0000000000..a784984a26
--- /dev/null
+++ b/scripts/ci/plan_run.py
@@ -0,0 +1,272 @@
+#!/usr/bin/env python3
+"""Size a CI run: which tier it is and how wide every job matrix gets.
+
+The organisation has 60 concurrent jobs, 5 of them macOS. A run that fans out
+to ~65 jobs with ~10 macOS legs fills that pool on its own; two agents pushing
+at once queue everything behind it. So the width of a run follows what the
+run has to prove, not what could be run:
+
+``pr`` A pull request (or a branch run the merge train dispatched). Fast
+ feedback: the whole Linux and Windows suite, every affected lane on
+ Linux and Windows, no macOS, and without the slowest real-runtime
+ leg. It is the admission ticket to the merge queue.
+``queue`` A merge-queue group, or a push that reached main without one. The
+ blocking proof of the exact tree main gets: everything ``pr`` runs
+ plus one macOS leg per affected lane and the slow legs.
+``full`` Nightly, a release tag, a manual full dispatch. The wide matrix:
+ Intel macOS, the ARM runners, every interpreter, the macOS test
+ shards. Unchanged in scope; it only stopped running per change.
+
+``macos`` (nightly, tags, a dispatch with ``include_macos``) selects the wide
+matrix on any tier: ``gh workflow run ci.yml --ref <branch> -f full=false
+-f include_macos=true`` is how a branch gets macOS feedback before the queue.
+
+``proven`` answers one question for a run on main: did the merge queue already
+pass this exact commit? A queue group and the push that lands it share one
+SHA, so re-running the suite on the push repeats finished work.
+
+Usage::
+
+ python scripts/ci/plan_run.py plan --event pull_request
+ python scripts/ci/plan_run.py proven --repo owner/name --sha <sha>
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import sys
+import urllib.error
+import urllib.request
+from collections.abc import Callable
+from typing import Any
+
+LINUX = "ubuntu-latest"
+WINDOWS = "windows-latest"
+MACOS = "macos-latest"
+MACOS_INTEL = "macos-15-intel"
+MACOS_ARM = "macos-15"
+LINUX_ARM = "ubuntu-24.04-arm"
+WINDOWS_ARM = "windows-11-arm"
+
+TIERS = ("pr", "queue", "full")
+CI_WORKFLOW_PATH = ".github/workflows/ci.yml"
+MAIN_REF = "refs/heads/main"
+
+LINUX_SHARDS = 6
+# Six Windows shards finish in about the time of the Linux ones plus the
+# slower checkout; four made Windows the longest leg of every run.
+WINDOWS_SHARDS = 6
+
+
+def decide(
+ event: str, *, full_input: bool = False, macos_input: bool = False, ref: str = ""
+) -> dict[str, Any]:
+ """The run mode for a trigger: tier plus the flags the workflow reads."""
+ full = macos = pr_mode = False
+ if event in {"push", "merge_group"}:
+ tier = "queue"
+ elif event == "schedule":
+ tier, full, macos = "full", True, True
+ elif event == "workflow_dispatch":
+ macos = macos_input
+ if full_input:
+ tier, full = "full", True
+ elif ref == MAIN_REF:
+ # The merge train's stand-in for a push its own merge never fired:
+ # main gets the proof of a push, not the narrower one of a branch.
+ tier = "queue"
+ else:
+ # A branch run the merge train dispatched behaves like its pull request.
+ tier, pr_mode = "pr", True
+ else:
+ tier, pr_mode = "pr", True
+ return {
+ "tier": tier,
+ "full_mode": full,
+ "macos": macos,
+ "pr_mode": pr_mode,
+ # One macOS leg per affected lane: in the queue, and wherever the
+ # caller asked for macOS.
+ "mac_lanes": tier == "queue" or macos,
+ }
+
+
+def matrices(tier: str, *, macos: bool) -> dict[str, Any]:
+ """Every job matrix of ci.yml for a tier. ``macos`` adds the wide legs."""
+ if tier not in TIERS:
+ raise ValueError(f"unknown tier {tier!r}")
+ mac_lanes = tier == "queue" or macos
+ slow_legs = tier != "pr"
+ base_os = [LINUX, WINDOWS]
+
+ updater = [
+ {"os": LINUX, "python": "3.11"},
+ {"os": LINUX, "python": "3.12"},
+ # The 3.12 Windows leg compiles the real Inno script and upgrades a
+ # running install: the one handover proof a pull request keeps.
+ {"os": WINDOWS, "python": "3.12"},
+ ]
+ if slow_legs:
+ updater.append({"os": WINDOWS, "python": "3.11"})
+ if mac_lanes:
+ updater.append({"os": MACOS, "python": "3.12"})
+ if macos:
+ updater += [{"os": MACOS, "python": "3.11"}, {"os": MACOS_INTEL, "python": "3.12"}]
+
+ # The two architectures without an upstream cryptography wheel come first;
+ # the wide matrix adds the second interpreter and Apple Silicon.
+ crypto = [{"runner": WINDOWS_ARM, "architecture": "arm64", "python": "3.12"}]
+ if mac_lanes:
+ crypto.append({"runner": MACOS_INTEL, "architecture": "x64", "python": "3.11"})
+ if macos:
+ crypto += [
+ {"runner": MACOS_INTEL, "architecture": "x64", "python": "3.14"},
+ {"runner": MACOS_ARM, "architecture": "arm64", "python": "3.11"},
+ {"runner": MACOS_ARM, "architecture": "arm64", "python": "3.14"},
+ {"runner": WINDOWS_ARM, "architecture": "arm64", "python": "3.14"},
+ ]
+
+ # The real Hermes install on Windows takes ~18 minutes: it would be the
+ # longest job of every pull request, so it waits for the queue.
+ e2e = [
+ {"os": LINUX, "runtime": "hermes"},
+ {"os": LINUX, "runtime": "openclaw"},
+ {"os": WINDOWS, "runtime": "openclaw"},
+ ]
+ if slow_legs:
+ e2e.append({"os": WINDOWS, "runtime": "hermes"})
+ if mac_lanes:
+ e2e += [{"os": MACOS, "runtime": "hermes"}, {"os": MACOS, "runtime": "openclaw"}]
+
+ browser = list(base_os)
+ if mac_lanes:
+ browser.append(MACOS)
+ if macos:
+ browser += [LINUX_ARM, WINDOWS_ARM, MACOS_INTEL]
+
+ return {
+ # jarvisctl, dragdrop and the installer smoke stay off macOS unless
+ # the wide matrix is on: nothing in them is macOS-specific.
+ "os_matrix": base_os + ([MACOS] if macos else []),
+ "lane_os": base_os + ([MACOS] if mac_lanes else []),
+ "updater_matrix": updater,
+ "crypto_matrix": crypto,
+ "e2e_matrix": e2e,
+ "browser_os": browser,
+ # Skipped on a pull request; the queue proves the Apple Silicon
+ # bundle, the wide matrix adds both Intel rows.
+ "desktop_legs": "all" if macos else ("primary" if mac_lanes else "none"),
+ "linux_shards": list(range(1, LINUX_SHARDS + 1)),
+ "windows_shards": list(range(1, WINDOWS_SHARDS + 1)),
+ }
+
+
+def plan(
+ event: str, *, full_input: bool = False, macos_input: bool = False, ref: str = ""
+) -> dict[str, Any]:
+ mode = decide(event, full_input=full_input, macos_input=macos_input, ref=ref)
+ return {**mode, **matrices(mode["tier"], macos=mode["macos"])}
+
+
+def proven_by_queue(runs: list[dict[str, Any]], *, repo: str, sha: str) -> bool:
+ """Whether a merge-queue CI run of this repository passed exactly ``sha``."""
+ for run in runs:
+ if (
+ run.get("head_sha") == sha
+ and run.get("event") == "merge_group"
+ and run.get("status") == "completed"
+ and run.get("conclusion") == "success"
+ and str(run.get("path") or "").split("@", 1)[0] == CI_WORKFLOW_PATH
+ and ((run.get("head_repository") or {}).get("full_name")) == repo
+ ):
+ return True
+ return False
+
+
+def fetch_runs(repo: str, sha: str, token: str) -> list[dict[str, Any]]:
+ url = (
+ f"https://api.github.com/repos/{repo}/actions/workflows/ci.yml/runs"
+ f"?head_sha={sha}&event=merge_group&status=success&per_page=20"
+ )
+ request = urllib.request.Request( # noqa: S310 - fixed https host
+ url,
+ headers={
+ "Accept": "application/vnd.github+json",
+ "Authorization": f"Bearer {token}",
+ "X-GitHub-Api-Version": "2022-11-28",
+ },
+ )
+ with urllib.request.urlopen(request, timeout=30) as response: # noqa: S310
+ payload = json.load(response)
+ runs = payload.get("workflow_runs") if isinstance(payload, dict) else None
+ return runs if isinstance(runs, list) else []
+
+
+def is_proven(
+ repo: str,
+ sha: str,
+ token: str,
+ fetch: Callable[[str, str, str], list[dict[str, Any]]] = fetch_runs,
+) -> bool:
+ """Fail open: any doubt (no token, API error, odd payload) means not proven."""
+ if not (repo and sha and token):
+ return False
+ try:
+ proven = proven_by_queue(fetch(repo, sha, token), repo=repo, sha=sha)
+ except (OSError, ValueError, urllib.error.URLError) as exc:
+ print(f"::warning::could not ask for a merge-queue run of {sha}: {exc}")
+ return False
+ if not proven:
+ print(f"::notice::no green merge-queue run of {sha}: this run proves it itself")
+ return proven
+
+
+def _render(value: Any) -> str:
+ if isinstance(value, bool):
+ return "true" if value else "false"
+ if isinstance(value, str):
+ return value
+ return json.dumps(value, separators=(",", ":"))
+
+
+def _emit(values: dict[str, Any]) -> None:
+ lines = [f"{key}={_render(value)}" for key, value in values.items()]
+ output = os.environ.get("GITHUB_OUTPUT")
+ if output:
+ with open(output, "a", encoding="utf-8") as handle:
+ handle.write("\n".join(lines) + "\n")
+ print("\n".join(lines))
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
+ commands = parser.add_subparsers(dest="command", required=True)
+ plan_cmd = commands.add_parser("plan", help="Emit the tier, flags and matrices.")
+ plan_cmd.add_argument("--event", required=True)
+ plan_cmd.add_argument("--full", default="false", help="The dispatch input `full`.")
+ plan_cmd.add_argument("--include-macos", default="false")
+ plan_cmd.add_argument("--ref", default="", help="The run's ref (refs/heads/main ...).")
+ proven_cmd = commands.add_parser("proven", help="Emit proven=true|false for a commit.")
+ proven_cmd.add_argument("--repo", required=True)
+ proven_cmd.add_argument("--sha", required=True)
+ args = parser.parse_args(argv)
+
+ if args.command == "plan":
+ _emit(
+ plan(
+ args.event,
+ full_input=args.full == "true",
+ macos_input=args.include_macos == "true",
+ ref=args.ref,
+ )
+ )
+ else:
+ token = os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN") or ""
+ _emit({"proven": is_proven(args.repo, args.sha, token)})
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/ci/required_results.py b/scripts/ci/required_results.py
index 4c1faf0c89..9c413ee27f 100644
--- a/scripts/ci/required_results.py
+++ b/scripts/ci/required_results.py
@@ -10,6 +10,8 @@ never needs a settings change.
Unselected lanes may skip in normal mode.
* ``--strict`` (nightly, release) fails a skipped job too, except the jobs in
:data:`STRICT_SKIP_OK` that can never run on those events.
+* A run whose commit the merge queue already passed (``proven``) needs only
+ ``detect``: every other job skips, and a strict run never accepts that.
echo "$NEEDS" | python scripts/ci/required_results.py [--strict]
"""
@@ -42,15 +44,15 @@ LANE_JOBS = {
def expected_jobs(outputs: dict[str, str]) -> set[str]:
"""Derive required evidence from detection, rather than trusting skipped jobs."""
+ if outputs.get("proven") == "true":
+ return {"detect"}
required = {"detect", "gates", "zizmor"}
for lane, jobs in LANE_JOBS.items():
if outputs.get(lane) == "true":
required.update(jobs)
if outputs.get("macos") == "true" and outputs.get("python") == "true":
required.add("tests-macos")
- if outputs.get("macos_desktop") == "true" and (
- outputs.get("full") != "true" or outputs.get("macos") == "true"
- ):
+ if outputs.get("macos_desktop") == "true" and outputs.get("desktop_legs") != "none":
required.add("macos-desktop")
if outputs.get("release") == "true":
required.add("release-qualification")
@@ -68,9 +70,13 @@ def evaluate(
required: set[str] = set()
if pipeline:
outputs = (entries.get("detect") or {}).get("outputs") or {}
- flags = set(LANE_JOBS) | {"full", "macos", "macos_desktop", "release"}
- if any(outputs.get(flag) not in {"true", "false"} for flag in flags):
+ flags = set(LANE_JOBS) | {"full", "macos", "macos_desktop", "release", "proven"}
+ if any(outputs.get(flag) not in {"true", "false"} for flag in flags) or outputs.get(
+ "desktop_legs"
+ ) not in {"none", "primary", "all"}:
failed.append("<invalid-detection>")
+ if strict and outputs.get("proven") == "true":
+ failed.append("<proven-in-strict-run>")
required = expected_jobs(outputs)
failed.extend(required - entries.keys())
for name, info in entries.items():
diff --git a/tests/unit/ci/test_agent_runtime_lane.py b/tests/unit/ci/test_agent_runtime_lane.py
index abebeea593..7ce3260841 100644
--- a/tests/unit/ci/test_agent_runtime_lane.py
+++ b/tests/unit/ci/test_agent_runtime_lane.py
@@ -10,7 +10,13 @@ from pathlib import Path
import pytest
import yaml
-from scripts.ci import agent_runtime_suite, classify_changes, required_results, select_tests
+from scripts.ci import (
+ agent_runtime_suite,
+ classify_changes,
+ plan_run,
+ required_results,
+ select_tests,
+)
ROOT = Path(__file__).resolve().parents[3]
LANE_JOBS = {"agent-runtimes-unit", "agent-runtimes-headless", "agent-runtimes-e2e"}
@@ -44,6 +50,7 @@ def test_a_pipeline_change_runs_the_lane_too():
def _needs(lane: bool, **results: str) -> dict:
outputs = {flag: "false" for flag in required_results.LANE_JOBS}
outputs.update(full="false", macos="false", macos_desktop="false", release="false")
+ outputs.update(proven="false", desktop_legs="none")
outputs["agent_runtimes"] = "true" if lane else "false"
needs = {"detect": {"result": "success", "outputs": outputs}}
# Every pipeline also requires the always-on jobs (gates, workflow audit).
@@ -97,11 +104,18 @@ def test_ci_runs_the_lane_on_every_os_and_the_gate_waits_for_it():
jobs = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text(encoding="utf-8"))["jobs"]
assert "agent_runtimes" in jobs["detect"]["outputs"]
assert LANE_JOBS <= set(jobs["gate"]["needs"])
+ # Before anything lands (the merge queue) the lane has run on all three
+ # OSes with both runtimes; ci.yml reads those matrices from the plan.
oses = {"ubuntu-latest", "windows-latest", "macos-latest"}
- assert set(jobs["agent-runtimes-unit"]["strategy"]["matrix"]["os"]) == oses
+ queue = plan_run.plan("merge_group")
+ assert set(queue["lane_os"]) == oses
+ assert {(leg["os"], leg["runtime"]) for leg in queue["e2e_matrix"]} == {
+ (os, runtime) for os in oses for runtime in ("hermes", "openclaw")
+ }
+ unit = jobs["agent-runtimes-unit"]["strategy"]["matrix"]
+ assert unit["os"] == "${{ fromJSON(needs.detect.outputs.lane_os) }}"
e2e = jobs["agent-runtimes-e2e"]["strategy"]["matrix"]
- assert set(e2e["os"]) == oses
- assert set(e2e["runtime"]) == {"hermes", "openclaw"}
+ assert e2e["include"] == "${{ fromJSON(needs.detect.outputs.e2e_matrix) }}"
assert jobs["agent-runtimes-headless"]["container"] == "python:3.11-slim"
for job in LANE_JOBS:
assert jobs[job]["if"] == "needs.detect.outputs.agent_runtimes == 'true'"
diff --git a/tests/unit/ci/test_pipeline_audit.py b/tests/unit/ci/test_pipeline_audit.py
index ebe76c56ae..13f35d28de 100644
--- a/tests/unit/ci/test_pipeline_audit.py
+++ b/tests/unit/ci/test_pipeline_audit.py
@@ -15,6 +15,7 @@ from scripts.ci import (
check_workflow_policy,
classify_changes,
cut_release,
+ plan_run,
ratchet_tests,
release_admit,
release_assets,
@@ -150,7 +151,7 @@ def test_commit_identity_and_fresh_main_are_required(monkeypatch, tag_sha, fetch
def pipeline_needs():
flags = {name: "true" for name in classify_changes.LANES}
- flags.update(full="true", macos="true", release="true")
+ flags.update(full="true", macos="true", release="true", proven="false", desktop_legs="all")
needs = {name: {"result": "success"} for name in required_results.expected_jobs(flags)}
needs["detect"]["outputs"] = flags
return needs
@@ -178,7 +179,7 @@ def test_invalid_detection_does_not_turn_checks_off():
def test_unaffected_lanes_can_still_skip():
flags = {name: "false" for name in classify_changes.LANES}
- flags.update(full="false", macos="false", release="false")
+ flags.update(full="false", macos="false", release="false", proven="false", desktop_legs="none")
needs = {
"detect": {"result": "success", "outputs": flags},
"gates": {"result": "success"},
@@ -191,7 +192,9 @@ def test_unaffected_lanes_can_still_skip():
def test_dependency_review_runs_only_on_pull_requests_and_may_skip_elsewhere():
ci = workflows()["ci.yml"]["jobs"]
assert ci["dependency-review"]["if"] == "github.event_name == 'pull_request'"
- assert "if" not in ci["zizmor"] # the workflow audit runs on every event
+ # The workflow audit runs on every event; only a push whose commit the
+ # merge queue already audited skips it.
+ assert ci["zizmor"]["if"] == "needs.detect.outputs.proven != 'true'"
needs = pipeline_needs()
needs["dependency-review"] = {"result": "skipped"}
assert required_results.evaluate(needs, pipeline=True, strict=True)["ok"]
@@ -208,11 +211,20 @@ def test_live_site_checks_run_only_nightly_and_never_fail_the_run():
assert all(s.get("continue-on-error") for s in job["steps"] if "pytest" in s.get("run", ""))
-def test_pull_requests_run_the_whole_windows_suite():
- steps = workflows()["ci.yml"]["jobs"]["detect"]["steps"]
- sizing = next(s for s in steps if s.get("id") == "shards")["run"]
- assert "windows_shards=[1,2,3,4]" in sizing and "windows_shards=[1]'" not in sizing
- assert "tests_full=true" in sizing and "tests_full=false" not in sizing
+def test_every_tier_runs_the_whole_linux_and_windows_suite():
+ ci = workflows()["ci.yml"]["jobs"]
+ for tier in plan_run.TIERS:
+ sized = plan_run.matrices(tier, macos=False)
+ assert sized["linux_shards"] == [1, 2, 3, 4, 5, 6]
+ assert sized["windows_shards"] == [1, 2, 3, 4, 5, 6]
+ # No impact selection in CI: the Windows job always takes its shard of
+ # the whole suite, and the shard count comes from the same plan.
+ windows = "\n".join(step.get("run", "") for step in ci["tests-windows"]["steps"])
+ assert "select_tests" not in windows and "--files-from" not in windows
+ assert ci["tests-windows"]["strategy"]["matrix"]["shard"] == (
+ "${{ fromJSON(needs.detect.outputs.windows_shards) }}"
+ )
+ assert ci["detect"]["outputs"]["windows_shards"] == "${{ steps.mode.outputs.windows_shards }}"
def test_merge_queue_runs_the_whole_suite_and_is_never_cancelled():
@@ -222,11 +234,192 @@ def test_merge_queue_runs_the_whole_suite_and_is_never_cancelled():
assert "merge_group" in ci["concurrency"]["group"]
assert "merge_group" not in ci["concurrency"]["cancel-in-progress"]
mode = next(s for s in ci["jobs"]["detect"]["steps"] if s.get("id") == "mode")
- assert "push|merge_group) tests_full=true" in mode["run"]
+ assert "plan_run.py plan" in mode["run"]
assert "merge_group.base_sha" in mode["env"]["PR_BASE"]
+ assert plan_run.decide("merge_group")["tier"] == "queue"
assert ci["jobs"]["gate"]["if"] == "${{ !cancelled() }}"
+# --------------------------------------------------------------------------- tiers
+
+
+def test_a_pull_request_never_takes_a_macos_runner():
+ sized = plan_run.plan("pull_request")
+ assert sized["tier"] == "pr" and sized["pr_mode"] and not sized["mac_lanes"]
+ assert sized["desktop_legs"] == "none"
+ assert "macos" not in json.dumps([v for k, v in sized.items() if k != "macos"])
+ # The slowest real-runtime leg waits for the queue.
+ assert {"os": "windows-latest", "runtime": "hermes"} not in sized["e2e_matrix"]
+ assert {"os": "windows-latest", "runtime": "openclaw"} in sized["e2e_matrix"]
+ # The real Inno upgrade of a running install stays on the pull request.
+ assert {"os": "windows-latest", "python": "3.12"} in sized["updater_matrix"]
+
+
+def test_the_merge_queue_proves_one_macos_leg_per_lane_and_the_slow_legs():
+ sized = plan_run.plan("merge_group")
+ assert sized["mac_lanes"] and not sized["macos"]
+ assert sized["lane_os"] == ["ubuntu-latest", "windows-latest", "macos-latest"]
+ assert sized["browser_os"] == ["ubuntu-latest", "windows-latest", "macos-latest"]
+ assert sized["desktop_legs"] == "primary"
+ assert {(leg["os"], leg["runtime"]) for leg in sized["e2e_matrix"]} == {
+ (os, runtime)
+ for os in ("ubuntu-latest", "windows-latest", "macos-latest")
+ for runtime in ("hermes", "openclaw")
+ }
+ # Exactly one macOS leg in each of these lanes: five macOS slots serve
+ # every agent's merge group at once.
+ for key in ("updater_matrix", "crypto_matrix"):
+ assert sum("macos" in json.dumps(leg) for leg in sized[key]) == 1, key
+ # jarvisctl, dragdrop and the installer smoke have no macOS-specific code.
+ assert sized["os_matrix"] == ["ubuntu-latest", "windows-latest"]
+ # A push that reached main without the queue gets the same proof.
+ assert plan_run.plan("push") == sized
+
+
+def test_nightly_release_and_macos_dispatch_keep_the_wide_matrix():
+ for sized in (
+ plan_run.plan("schedule"),
+ plan_run.plan("workflow_dispatch", full_input=True, macos_input=True),
+ ):
+ assert sized["tier"] == "full" and sized["full_mode"] and sized["macos"]
+ assert sized["desktop_legs"] == "all"
+ assert sized["os_matrix"][-1] == "macos-latest"
+ assert len(sized["updater_matrix"]) == 7
+ assert len(sized["crypto_matrix"]) == 6
+ assert set(sized["browser_os"]) == {
+ "ubuntu-latest",
+ "ubuntu-24.04-arm",
+ "windows-latest",
+ "windows-11-arm",
+ "macos-latest",
+ "macos-15-intel",
+ }
+ # A branch asks for macOS before the queue without a full run.
+ branch = plan_run.plan("workflow_dispatch", macos_input=True)
+ assert branch["tier"] == "pr" and branch["pr_mode"] and branch["desktop_legs"] == "all"
+ # The merge train's stand-in for a push on main gets a push's proof,
+ # never the narrower one of a branch run.
+ stand_in = plan_run.plan("workflow_dispatch", ref="refs/heads/main")
+ assert stand_in["tier"] == "queue" and not stand_in["pr_mode"] and stand_in["mac_lanes"]
+ assert plan_run.plan("workflow_dispatch", ref="refs/heads/claude/x")["tier"] == "pr"
+ # The merge train's macOS-free full dispatch stays off macOS.
+ train = plan_run.plan("workflow_dispatch", full_input=True)
+ assert train["full_mode"] and not train["mac_lanes"]
+ assert "macos" not in json.dumps(plan_run.matrices("full", macos=False))
+
+
+def test_ci_reads_every_matrix_from_the_plan():
+ ci = workflows()["ci.yml"]["jobs"]
+ outputs = ci["detect"]["outputs"]
+ planned = plan_run.plan("pull_request")
+ for key in ("lane_os", "updater_matrix", "crypto_matrix", "e2e_matrix", "browser_os"):
+ assert key in planned and outputs[key] == f"${{{{ steps.mode.outputs.{key} }}}}"
+ uses = {
+ "realtime-contract": ("os", "lane_os"),
+ "agent-runtimes-unit": ("os", "lane_os"),
+ "jarvisctl": ("os", "os_matrix"),
+ "dragdrop": ("os", "os_matrix"),
+ "updater": ("include", "updater_matrix"),
+ "native-crypto-runtime": ("include", "crypto_matrix"),
+ "agent-runtimes-e2e": ("include", "e2e_matrix"),
+ }
+ for job, (axis, key) in uses.items():
+ assert ci[job]["strategy"]["matrix"][axis] == (
+ f"${{{{ fromJSON(needs.detect.outputs.{key}) }}}}"
+ ), job
+ assert ci["browser"]["with"]["os"] == "${{ needs.detect.outputs.browser_os }}"
+ assert ci["macos-desktop"]["with"]["legs"] == "${{ needs.detect.outputs.desktop_legs }}"
+ assert "desktop_legs != 'none'" in ci["macos-desktop"]["if"]
+
+
+def _queue_run(**changes):
+ run = {
+ "head_sha": "a" * 40,
+ "event": "merge_group",
+ "status": "completed",
+ "conclusion": "success",
+ "path": ".github/workflows/ci.yml",
+ "head_repository": {"full_name": "owner/app"},
+ }
+ run.update(changes)
+ return run
+
+
+def test_a_commit_the_merge_queue_passed_is_proven():
+ assert plan_run.proven_by_queue([_queue_run()], repo="owner/app", sha="a" * 40)
+ # The API may name the workflow with the ref it ran from.
+ suffixed = _queue_run(path=".github/workflows/ci.yml@refs/heads/gh-readonly-queue/main/pr-1")
+ assert plan_run.proven_by_queue([suffixed], repo="owner/app", sha="a" * 40)
+ assert plan_run.is_proven("owner/app", "a" * 40, "token", lambda *_: [_queue_run()])
+
+
+ "changes",
+ [
+ {"head_sha": "b" * 40},
+ {"event": "pull_request"},
+ {"event": "push"},
+ {"conclusion": "failure"},
+ {"status": "in_progress", "conclusion": None},
+ {"path": ".github/workflows/pretend-ci.yml"},
+ {"head_repository": {"full_name": "fork/app"}},
+ {"head_repository": None},
+ ],
+)
+def test_anything_but_a_green_queue_run_of_this_commit_is_not_proven(changes):
+ runs = [_queue_run(**changes)]
+ assert not plan_run.proven_by_queue(runs, repo="owner/app", sha="a" * 40)
+
+
+def test_the_proven_lookup_fails_open():
+ def broken(*_):
+ raise OSError("api down")
+
+ assert not plan_run.is_proven("owner/app", "a" * 40, "token", broken)
+ assert not plan_run.is_proven("owner/app", "a" * 40, "", lambda *_: [_queue_run()])
+ assert not plan_run.is_proven("owner/app", "a" * 40, "token", lambda *_: [])
+
+
+def test_a_proven_push_runs_nothing_but_detection_and_the_gate():
+ ci = workflows()["ci.yml"]["jobs"]
+ lanes = classify_changes.classify(["jarvis/core/config.py"], proven=True)
+ assert not any(lanes.values())
+ proven = next(s for s in ci["detect"]["steps"] if s.get("id") == "proven")
+ # Only a run on main that is neither a full nor a macOS run may skip.
+ assert '"$GITHUB_REF" = "refs/heads/main"' in proven["run"]
+ assert '"$FULL" != "true"' in proven["run"] and '"$MACOS" != "true"' in proven["run"]
+ assert ci["detect"]["permissions"] == {"contents": "read", "actions": "read"}
+ assert ci["gates"]["if"] == "needs.detect.outputs.proven != 'true'"
+ flags = {name: "false" for name in classify_changes.LANES}
+ flags.update(full="false", macos="false", release="false", proven="true", desktop_legs="none")
+ needs = {name: {"result": "skipped"} for name in ci["gate"]["needs"]}
+ needs["detect"] = {"result": "success", "outputs": flags}
+ assert required_results.evaluate(needs, pipeline=True)["ok"]
+ # A nightly run is never satisfied by an earlier proof.
+ assert not required_results.evaluate(needs, pipeline=True, strict=True)["ok"]
+ # Without the proof the same skips fail the gate.
+ flags["proven"] = "false"
+ assert not required_results.evaluate(needs, pipeline=True)["ok"]
+
+
+def test_the_linux_shard_count_has_one_source():
+ ci = workflows()["ci.yml"]["jobs"]
+ shard = next(s for s in ci["tests-linux"]["steps"] if s.get("name") == "Run shard")
+ floor = next(s for s in ci["test-report"]["steps"] if "--expected-shards" in s.get("run", ""))
+ for step in (shard, floor):
+ assert step["env"]["SHARDS"] == "${{ needs.detect.outputs.linux_shards }}"
+ assert '--shard "$SHARD/$total"' in shard["run"]
+ assert '--expected-shards "$total"' in floor["run"]
+
+
+def test_the_duration_cache_is_refreshed_by_the_nightly_run_on_main():
+ steps = workflows()["ci.yml"]["jobs"]["test-report"]["steps"]
+ for name in ("Merge the duration cache (main only)", "Save the duration cache (main only)"):
+ condition = next(s for s in steps if s.get("name") == name)["if"]
+ assert "github.ref == 'refs/heads/main'" in condition
+ assert "github.event_name == 'schedule'" in condition
+
+
@pytest.mark.parametrize("payload", [{}, {"failed_ids": [], "counts": {}, "files": 0}])
def test_empty_test_evidence_fails_even_without_a_baseline(tmp_path, payload):
report = tmp_path / "report.json"