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: run the Windows Hermes install nightly and report a red nightly (#549)

Ruben Lütke5e77912204e6
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a96c650c27..c5585d8b9d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -38,13 +38,16 @@
# 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, the slow legs and one
-# SHORT macOS leg per affected lane. The blocking macOS proof per
-# change; up to four groups share the five macOS slots.
+# lane on Linux and Windows. No macOS.
+# queue merge-queue group: everything `pr` runs plus one SHORT macOS leg
+# per affected lane. The blocking macOS proof per change; several
+# groups share the five macOS slots, and no leg takes much longer
+# than the test shards.
# full nightly, release tags, manual full dispatch: Intel macOS, the ARM
-# runners, every interpreter, the macOS test shards, and the real
-# runtimes and the real browser on macOS (5-10 minutes per leg).
+# runners, every interpreter, the macOS test shards, and the long
+# real-product legs (the Hermes install on Windows, the real
+# runtimes and the real browser on macOS). A red nightly opens an
+# issue (nightly-alert.yml).
# 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
@@ -1046,9 +1049,9 @@ 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. A pull request runs both runtimes on
- # Linux and OpenClaw on Windows; the merge queue adds the 18-minute Hermes
- # install on Windows; nightly and release runs add both macOS legs
+ # upstream latest and raises the pin. Every change runs both runtimes on
+ # Linux and OpenClaw on Windows; nightly and release runs add the Hermes
+ # install on Windows (14-23 minutes) and both macOS legs
# (scripts/ci/plan_run.py).
agent-runtimes-e2e:
needs: detect
diff --git a/.github/workflows/nightly-alert.yml b/.github/workflows/nightly-alert.yml
new file mode 100644
index 0000000000..15cdc2983d
--- /dev/null
+++ b/.github/workflows/nightly-alert.yml
@@ -0,0 +1,84 @@
+# Nightly alert: a red nightly CI run opens (or updates) ONE issue.
+#
+# Several legs run only in the nightly and release runs: the real Hermes
+# install on Windows, the real runtimes and the real browser on macOS, Intel
+# macOS, the ARM runners, the macOS test shards (scripts/ci/plan_run.py). A
+# failure there blocks no pull request, so it has to reach someone. This
+# keeps one issue, "Nightly CI is red", with the failed jobs of the latest red
+# nightly, and closes it after the next green one.
+#
+# A separate workflow for the same reason as flaky-tests.yml: `issues: write`
+# never reaches a pull-request run. Nothing is checked out; the run's job list
+# is read as data only.
+name: Nightly alert
+
+on:
+ workflow_run:
+ workflows: [CI]
+ types: [completed]
+ branches: [main]
+
+permissions: {}
+
+# Issue updates are read-modify-write; never let two run at once.
+concurrency:
+ group: nightly-alert
+ cancel-in-progress: false
+
+jobs:
+ alert:
+ name: track a red nightly
+ # A fork pull request can be named `main` too: the repository and event
+ # checks, not the branch filter alone, keep its runs out.
+ if: >-
+ github.event.workflow_run.event == 'schedule' &&
+ github.event.workflow_run.head_repository.full_name == github.repository &&
+ github.event.workflow_run.head_branch == 'main' &&
+ contains(fromJSON('["success","failure"]'), github.event.workflow_run.conclusion)
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ actions: read
+ issues: write
+ steps:
+ - name: Open, update or close the tracking issue
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RUN_ID: ${{ github.event.workflow_run.id }}
+ RUN_URL: ${{ github.event.workflow_run.html_url }}
+ CONCLUSION: ${{ github.event.workflow_run.conclusion }}
+ run: |
+ # The label lists issues without the search index, which lags behind
+ # a freshly created issue and would invite a duplicate.
+ number="$(gh issue list --repo "$GITHUB_REPOSITORY" --label nightly-ci --state open \
+ --limit 1 --json number --jq '.[0].number // empty')"
+ if [ "$CONCLUSION" = "success" ]; then
+ if [ -n "$number" ]; then
+ gh issue close "$number" --repo "$GITHUB_REPOSITORY" \
+ --comment "The nightly run is green again: $RUN_URL"
+ echo "Closed issue #$number" | tee -a "$GITHUB_STEP_SUMMARY"
+ fi
+ exit 0
+ fi
+ {
+ echo "The nightly CI run on main failed: $RUN_URL"
+ echo
+ echo "Failed jobs:"
+ echo
+ gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID/jobs?per_page=100&filter=latest" \
+ --paginate --jq '.jobs[] | select(.conclusion == "failure" and .name != "CI gate") | "- [\(.name)](\(.html_url))"'
+ echo
+ echo "Some of these legs run only at night and on release tags, so no pull request"
+ echo "was blocked by them. Reproduce on a branch with"
+ echo '`gh workflow run ci.yml --ref <branch> -f full=false -f include_macos=true`.'
+ } > "$RUNNER_TEMP/issue.md"
+ if [ -n "$number" ]; then
+ gh issue edit "$number" --repo "$GITHUB_REPOSITORY" --body-file "$RUNNER_TEMP/issue.md"
+ echo "Updated issue #$number" | tee -a "$GITHUB_STEP_SUMMARY"
+ else
+ gh label create nightly-ci --repo "$GITHUB_REPOSITORY" --force \
+ --color B60205 --description "The nightly CI run on main is red"
+ url="$(gh issue create --repo "$GITHUB_REPOSITORY" --title "Nightly CI is red" \
+ --label nightly-ci --body-file "$RUNNER_TEMP/issue.md")"
+ echo "Created $url" | tee -a "$GITHUB_STEP_SUMMARY"
+ fi
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
index 0f98527e09..394a5abfb7 100644
--- a/.github/zizmor.yml
+++ b/.github/zizmor.yml
@@ -17,6 +17,10 @@ rules:
# checked in `if:` and again by flaky_report.py vet-run), checks out
# `main`, and reads the downloaded shard reports as JSON data.
- flaky-tests.yml
+ # Reacts to completed nightly CI runs on main only (repository, branch
+ # and the `schedule` event checked in `if:`), checks out nothing, uses
+ # no action, and reads the run's job names and links as data.
+ - nightly-alert.yml
unpinned-uses:
config:
policies:
diff --git a/docs/agent-runtimes.md b/docs/agent-runtimes.md
index f27109c9f7..4d33d60dc9 100644
--- a/docs/agent-runtimes.md
+++ b/docs/agent-runtimes.md
@@ -404,14 +404,14 @@ each of them:
|---|---|---|
| `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` | Pull request: Linux × Hermes, OpenClaw and Windows × OpenClaw. Merge queue: Linux, Windows × Hermes, OpenClaw. Nightly and release: macOS added | `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. |
+| `agent-runtimes-e2e` | Every pull request and merge group: Linux × Hermes, OpenClaw and Windows × OpenClaw. Nightly and release: Windows × Hermes and macOS × Hermes, OpenClaw added | `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. |
Before a change lands, the merge queue has run the unit suite on all three
-OSes and both real runtimes on Linux and Windows (`scripts/ci/plan_run.py`
-sizes the matrices). The Hermes install on Windows takes about 18 minutes,
-so it runs once per change, in the queue, not on every push to a branch. The
-real runtimes on macOS (10 and 7 minutes, on five runner slots shared with
-every merge group) run nightly, on release tags and on request
+OSes, both real runtimes on Linux and OpenClaw on Windows
+(`scripts/ci/plan_run.py` sizes the matrices). The Hermes install on Windows
+(14 to 23 minutes a job, 13 of them the upstream installer) and the real
+runtimes on macOS (10 and 7 minutes, on five runner slots shared with every
+merge group) run nightly, on release tags and on request
(`gh workflow run ci.yml --ref <branch> -f full=false -f include_macos=true`). 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
diff --git a/docs/ci-pipeline.md b/docs/ci-pipeline.md
index a28ee20d5b..aca7119cdb 100644
--- a/docs/ci-pipeline.md
+++ b/docs/ci-pipeline.md
@@ -24,9 +24,9 @@ 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, the slow legs, and one short macOS leg per affected lane (realtime contract, updater, agent-runtime unit suite, native crypto on Intel, the Apple Silicon desktop bundle). 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, and the real runtimes and the real browser on macOS. | ~30 min |
+| `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. | ~10 min |
+| `queue` | merge-queue group; a push that reached main without the queue | Everything `pr` runs plus one short macOS leg per affected lane (realtime contract, updater, agent-runtime unit suite, native crypto on Intel, the Apple Silicon desktop bundle). The blocking proof of the exact tree main gets. | ~10-13 min |
+| `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, and the long real-product legs: the Hermes install on Windows, the real runtimes and the real browser on macOS. A red nightly opens the issue "Nightly CI is red" (`nightly-alert.yml`). | ~40 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
@@ -34,12 +34,18 @@ 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.
-Up to four merge groups build at once on five macOS slots. The first queue
-runs of this design carried six to eight macOS legs each; three groups and
-one manual full run then waited more than half an hour on macOS alone. The
-two real-runtime legs (10 and 7 minutes) and the real-browser leg therefore
-run on macOS nightly and on release tags, and a group keeps only legs of one
-to four minutes.
+`CI gate` waits for the slowest job of a run, and several merge groups build
+at once on five macOS slots (the queue builds two groups in parallel). The
+first queue runs of this design carried six to eight macOS legs each: three
+groups and one manual full run waited more than half an hour on macOS alone.
+And the Hermes install on Windows (13 minutes of upstream installer before
+the first turn, 14 to 23 minutes a job) was the last job of three in four
+merge groups. So a group keeps macOS legs of one to four minutes, and the
+long real-product legs run nightly and on release tags: the Hermes install
+on Windows, the two real-runtime legs on macOS (10 and 7 minutes) and the
+real-browser leg on macOS. A regression that only shows there is found by
+the next nightly run, which opens the issue "Nightly CI is red", and at the
+latest by the release run, which blocks publication.
A branch gets the whole macOS matrix before the queue with
`gh workflow run ci.yml --ref <branch> -f full=false -f include_macos=true`.
diff --git a/scripts/ci/plan_run.py b/scripts/ci/plan_run.py
index 82f6682322..8e316d035e 100644
--- a/scripts/ci/plan_run.py
+++ b/scripts/ci/plan_run.py
@@ -7,18 +7,20 @@ 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.
+ feedback: the whole Linux and Windows suite and every affected lane
+ on Linux and Windows, no macOS. 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,
- the slow legs, and one SHORT macOS leg per affected lane. Up to
- four groups build at once on five macOS slots, so a group may
- spend minutes there, not half an hour: the real-runtime and the
- real-browser macOS legs (5 to 10 minutes each) stay in ``full``.
+ blocking proof of the exact tree main gets: everything ``pr`` runs
+ plus one SHORT macOS leg per affected lane. Several groups build
+ at once on five macOS slots, and the gate waits for the slowest
+ job, so no leg of a group may take much longer than the test
+ shards do.
``full`` Nightly, a release tag, a manual full dispatch. The wide matrix:
Intel macOS, the ARM runners, every interpreter, the macOS test
- shards, the real runtimes and the real browser on macOS.
+ shards, and the long real-product legs: the Hermes install on
+ Windows, the real runtimes and the real browser on macOS. A red
+ nightly opens an issue (.github/workflows/nightly-alert.yml).
``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
@@ -101,7 +103,7 @@ def matrices(tier: str, *, macos: bool) -> dict[str, Any]:
if tier not in TIERS:
raise ValueError(f"unknown tier {tier!r}")
mac_lanes = tier == "queue" or macos
- slow_legs = tier != "pr"
+ queue_legs = tier != "pr"
base_os = [LINUX, WINDOWS]
updater = [
@@ -111,7 +113,7 @@ def matrices(tier: str, *, macos: bool) -> dict[str, Any]:
# running install: the one handover proof a pull request keeps.
{"os": WINDOWS, "python": "3.12"},
]
- if slow_legs:
+ if queue_legs:
updater.append({"os": WINDOWS, "python": "3.11"})
if mac_lanes:
updater.append({"os": MACOS, "python": "3.12"})
@@ -131,19 +133,23 @@ def matrices(tier: str, *, macos: bool) -> dict[str, Any]:
{"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.
+ # Every change proves both real runtimes on Linux and OpenClaw on Windows.
+ # The long legs wait for the nightly and release runs: the Hermes install
+ # on Windows is 13 minutes of upstream installer before the first turn (14
+ # to 23 minutes a job, the last job of three in four merge groups), and
+ # the two macOS legs (10 and 7 minutes) held every macOS slot for half an
+ # hour with three groups in the queue.
e2e = [
{"os": LINUX, "runtime": "hermes"},
{"os": LINUX, "runtime": "openclaw"},
{"os": WINDOWS, "runtime": "openclaw"},
]
- if slow_legs:
- e2e.append({"os": WINDOWS, "runtime": "hermes"})
- # 10 and 7 minutes on macOS: with three groups in the queue these two
- # legs alone held every macOS slot for half an hour. Nightly and release.
if macos:
- e2e += [{"os": MACOS, "runtime": "hermes"}, {"os": MACOS, "runtime": "openclaw"}]
+ e2e += [
+ {"os": WINDOWS, "runtime": "hermes"},
+ {"os": MACOS, "runtime": "hermes"},
+ {"os": MACOS, "runtime": "openclaw"},
+ ]
browser = list(base_os)
if macos:
diff --git a/scripts/ci/run_tests_parallel.py b/scripts/ci/run_tests_parallel.py
index 24d7a529c2..183ccba226 100644
--- a/scripts/ci/run_tests_parallel.py
+++ b/scripts/ci/run_tests_parallel.py
@@ -55,6 +55,8 @@ MIN_FILE_TIMEOUT = 300.0
MAX_FILE_TIMEOUT = 900.0
BATCH_TARGET_SECONDS = 45.0
BATCH_MAX_FILES = 12
+MAX_BATCH_TIMEOUT = 1800.0
+BATCH_TIMEOUT_FACTOR = 6.0 # times the batch's own history
_OK_EXIT_CODES = {0, 5} # 5 = every test deselected / none collected
# A new batch waits while less than this much memory is left to commit. A local
# run shares the machine with the user's apps: eight batches on a box already
@@ -141,6 +143,19 @@ def file_timeout(file: str, durations: dict[str, float]) -> float:
return min(MAX_FILE_TIMEOUT, max(MIN_FILE_TIMEOUT, 3 * durations.get(file, 0.0)))
+def batch_timeout(batch: list[str], durations: dict[str, float]) -> float:
+ """Wall clock for one batch: its slowest file's budget, or a multiple of its load.
+
+ A batch is built to ~45 s of history. Summing every file's five-minute
+ floor gave a twelve-file batch thirty minutes, so one wedged test held a
+ shard until the job timeout killed it without a report. A batch killed
+ early costs nothing but time: each of its files runs again alone.
+ """
+ load = sum(estimate(file, durations) for file in batch)
+ slowest = max(file_timeout(file, durations) for file in batch)
+ return min(MAX_BATCH_TIMEOUT, max(slowest, BATCH_TIMEOUT_FACTOR * load))
+
+
# --------------------------------------------------------------------------- execution
@@ -388,7 +403,7 @@ class Runner:
def run_unit(self, batch: list[str]) -> dict[str, object]:
"""Run one batch with isolation-on-failure and a flaky retry."""
- budget = min(1800.0, sum(file_timeout(f, self.durations) for f in batch))
+ budget = batch_timeout(batch, self.durations)
first = self.run(batch, budget)
outcome: dict[str, object] = {"runs": [first], "flaky": [], "first_pass": []}
if first.ok:
diff --git a/tests/unit/ci/test_agent_runtime_lane.py b/tests/unit/ci/test_agent_runtime_lane.py
index eda03c3ab4..908665bb06 100644
--- a/tests/unit/ci/test_agent_runtime_lane.py
+++ b/tests/unit/ci/test_agent_runtime_lane.py
@@ -105,13 +105,16 @@ def test_ci_runs_the_lane_on_every_os_and_the_gate_waits_for_it():
assert "agent_runtimes" in jobs["detect"]["outputs"]
assert LANE_JOBS <= set(jobs["gate"]["needs"])
# Before anything lands (the merge queue) the unit suite has run on all
- # three OSes and both real runtimes on Linux and Windows; the nightly and
- # release runs add the real runtimes on macOS. ci.yml reads the plan.
+ # three OSes, both real runtimes on Linux and OpenClaw on Windows; the
+ # nightly and release runs add the Hermes install on Windows and both
+ # runtimes on macOS. ci.yml reads the plan.
oses = {"ubuntu-latest", "windows-latest", "macos-latest"}
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 - {"macos-latest"} for runtime in ("hermes", "openclaw")
+ ("ubuntu-latest", "hermes"),
+ ("ubuntu-latest", "openclaw"),
+ ("windows-latest", "openclaw"),
}
assert {(leg["os"], leg["runtime"]) for leg in plan_run.plan("schedule")["e2e_matrix"]} == {
(os, runtime) for os in oses for runtime in ("hermes", "openclaw")
diff --git a/tests/unit/ci/test_pipeline_audit.py b/tests/unit/ci/test_pipeline_audit.py
index 09f520be0a..4cc23647df 100644
--- a/tests/unit/ci/test_pipeline_audit.py
+++ b/tests/unit/ci/test_pipeline_audit.py
@@ -248,7 +248,7 @@ def test_a_pull_request_never_takes_a_macos_runner():
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.
+ # The slowest real-runtime leg never runs per change.
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.
@@ -260,11 +260,18 @@ def test_the_merge_queue_proves_one_short_macos_leg_per_lane_and_the_slow_legs()
assert sized["mac_lanes"] and not sized["macos"]
assert sized["lane_os"] == ["ubuntu-latest", "windows-latest", "macos-latest"]
assert sized["desktop_legs"] == "primary"
- assert {"os": "windows-latest", "runtime": "hermes"} in sized["e2e_matrix"]
- # Five macOS slots serve up to four merge groups at once: the long macOS
- # legs (real runtimes, real browser) wait for the nightly and release runs.
+ # The gate waits for the slowest job and five macOS slots serve every
+ # merge group: the long legs (the Hermes install on Windows, the real
+ # runtimes and the real browser on macOS) run nightly and on release.
assert sized["browser_os"] == ["ubuntu-latest", "windows-latest"]
- assert "macos" not in json.dumps(sized["e2e_matrix"])
+ assert sized["e2e_matrix"] == plan_run.plan("pull_request")["e2e_matrix"]
+ assert {(leg["os"], leg["runtime"]) for leg in sized["e2e_matrix"]} == {
+ ("ubuntu-latest", "hermes"),
+ ("ubuntu-latest", "openclaw"),
+ ("windows-latest", "openclaw"),
+ }
+ # The second Windows interpreter of the updater is the queue's one extra.
+ assert {"os": "windows-latest", "python": "3.11"} in sized["updater_matrix"]
wide = plan_run.plan("schedule")
assert {(leg["os"], leg["runtime"]) for leg in wide["e2e_matrix"]} == {
(os, runtime)
@@ -417,6 +424,27 @@ def test_the_linux_shard_count_has_one_source():
assert '--expected-shards "$total"' in floor["run"]
+def test_a_red_nightly_reaches_someone_and_only_a_nightly_on_main_can_write_issues():
+ alert = workflows()["nightly-alert.yml"]
+ assert alert["permissions"] == {}
+ job = alert["jobs"]["alert"]
+ assert job["permissions"] == {"actions": "read", "issues": "write"}
+ for clause in (
+ "github.event.workflow_run.event == 'schedule'",
+ "github.event.workflow_run.head_repository.full_name == github.repository",
+ "github.event.workflow_run.head_branch == 'main'",
+ ):
+ assert clause in job["if"], clause
+ # No pull-request code runs next to the issue token.
+ assert all("uses" not in step for step in job["steps"])
+ script = job["steps"][0]["run"]
+ assert "--label nightly-ci" in script and "gh issue close" in script
+ # The legs that left the per-change tiers are exactly what the nightly keeps.
+ nightly, queue = plan_run.plan("schedule"), plan_run.plan("merge_group")
+ only_nightly = [leg for leg in nightly["e2e_matrix"] if leg not in queue["e2e_matrix"]]
+ assert {"os": "windows-latest", "runtime": "hermes"} in only_nightly and len(only_nightly) == 3
+
+
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)"):
diff --git a/tests/unit/ci/test_pipeline_scripts.py b/tests/unit/ci/test_pipeline_scripts.py
index 4a8befa7fc..d19627ea6e 100644
--- a/tests/unit/ci/test_pipeline_scripts.py
+++ b/tests/unit/ci/test_pipeline_scripts.py
@@ -216,6 +216,22 @@ def test_batches_stay_in_one_directory_and_isolate_slow_files():
assert sorted(f for batch in batches for f in batch) == sorted(files)
+def test_a_wedged_batch_is_killed_after_minutes_not_after_the_whole_job():
+ # Twelve ordinary files: five minutes, not twelve five-minute floors.
+ batch = [f"tests/unit/a/test_{i}.py" for i in range(12)]
+ quick = dict.fromkeys(batch, 3.0)
+ assert run_tests_parallel.batch_timeout(batch, quick) == run_tests_parallel.MIN_FILE_TIMEOUT
+ # A batch with real load gets a multiple of its own history ...
+ heavy = dict.fromkeys(batch, 100.0)
+ assert run_tests_parallel.batch_timeout(batch, heavy) == run_tests_parallel.MAX_BATCH_TIMEOUT
+ assert run_tests_parallel.batch_timeout(batch[:2], heavy) == 6 * 200.0
+ # ... and never less than its slowest file would get alone.
+ one_slow = {**quick, batch[0]: 280.0}
+ assert run_tests_parallel.batch_timeout(batch, one_slow) >= run_tests_parallel.file_timeout(
+ batch[0], one_slow
+ )
+
+
def test_file_timeout_scales_with_history_but_is_bounded():
assert run_tests_parallel.file_timeout("x", {}) == run_tests_parallel.MIN_FILE_TIMEOUT
assert (