The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
ci(windows): try xdist loadfile instead of the per-file subprocess runner
ethernetdd7f5b998dc7
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 4cbdf93cba2..0c9fa6702c8 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -151,26 +151,39 @@ jobs:run: uv cache prune --ci- name: Run tests- # Two shapes, selected by whether this lane carries a marker:+ # Three shapes:#- # * No marker (Linux + Windows): the full suite via- # scripts/run_tests.sh — per-file isolation, bounded parallelism,- # and the conftest OS-marker skip does the platform gating.- # * Marker (macOS for now): plain pytest over the files that carry- # the marker. Two-step selection: list_os_marked_tests.py narrows- # WHICH FILES are imported (collection otherwise drags ~900- # unrelated modules through import on the macOS host, where a- # single unrelated ImportError fails a lane whose own subject- # is fine), and `-m` stays the authoritative selector. Passing- # `-m` REPLACES pyproject's ``-m 'not integration'`` addopts, so- # ``not integration`` is repeated here or the integration suite- # returns through the side door.- # Each marked lane FAILS on pytest exit 5 (zero tests selected) so a- # renamed/broken marker can never report green while running nothing.+ # * Windows (EXPERIMENT, PR #96458): xdist with --dist loadfile.+ # The per-file subprocess model pays a spawn+import wall of+ # ~0.5-1.5s per file x ~3400 files there — a ~6-minute floor+ # before any test runs. xdist pays that wall once per worker.+ # loadfile keeps each file's tests on ONE worker, so the+ # remaining hazard is state shared by files co-scheduled on a+ # worker. Failures from that are stateful-test bugs to fix, not+ # runner bugs.+ # * Linux: the full suite via scripts/run_tests.sh — per-file+ # isolation, bounded parallelism. The spawn floor is ~15ms per+ # file there, so isolation is nearly free; keep the stronger+ # guarantee.+ # * macOS (marker set): plain pytest over the files that carry the+ # marker. list_os_marked_tests.py narrows WHICH FILES are+ # imported (collection otherwise drags ~900 unrelated modules+ # through import on the macOS host), and `-m` stays the+ # authoritative selector. Passing `-m` REPLACES pyproject's+ # ``-m 'not integration'`` addopts, so ``not integration`` is+ # repeated or the integration suite returns through the side+ # door. The lane FAILS on pytest exit 5 (zero tests selected) so+ # a renamed/broken marker can never report green while running+ # nothing.shell: bashrun: |set -uo pipefail+ if [ "${{ matrix.os }}" = "windows" ]; then+ bash scripts/run_xdist.sh 32 tests/+ exit $?+ fi+if [ -n "${{ matrix.marker }}" ]; thenLIST="${RUNNER_TEMP:-.}/selected-tests.txt"@@ -206,8 +219,9 @@ jobs:exit "$status"fi- # Full suite. run_tests.sh locates the venv itself (both the POSIX- # bin/ and the Windows Scripts/ layout), so no per-OS activation.+ # Linux full suite. run_tests.sh locates the venv itself (both the+ # POSIX bin/ and the Windows Scripts/ layout), so no per-OS+ # activation.scripts/run_tests.shenv:# The maximum number of test FILES that run together. Linux pinsdiff --git a/pyproject.toml b/pyproject.tomlindex f455c40ed59..eff5d0d0310 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -196,7 +196,7 @@ modal = ["modal==1.3.4"]daytona = ["daytona==0.155.0"]vercel = ["vercel==0.7.2"]hindsight = ["hindsight-client==0.6.1"]-dev = ["debugpy==1.8.20", "pytest==9.1.1", "pytest-asyncio==1.3.0", "mcp==2.0.0", "httpx2==2.7.0", "starlette==1.3.1", "ty==0.0.21", "ruff==0.15.10", "setuptools==83.0.0"] # starlette: CVE-2026-48710; setuptools: 83 (torch >=2.13 requires setuptools 83)+dev = ["debugpy==1.8.20", "pytest==9.1.1", "pytest-asyncio==1.3.0", "pytest-xdist==3.8.0", "mcp==2.0.0", "httpx2==2.7.0", "starlette==1.3.1", "ty==0.0.21", "ruff==0.15.10", "setuptools==83.0.0"] # starlette: CVE-2026-48710; setuptools: 83 (torch >=2.13 requires setuptools 83)messaging = ["python-telegram-bot[webhooks]==22.8", "discord.py[voice]==2.7.1", "aiohttp==3.14.3", "brotlicffi==1.2.0.1", "slack-bolt==1.30.0", "slack-sdk==3.43.0", "qrcode==7.4.2"] # aiohttp 3.14.3: prior CVEs + GHSA-cq5v-8q36-5273/GHSA-mfx4-hv73-q22v/GHSA-mq44-7p77-q5h7cron = [] # croniter is now a core dependency; this extra kept for back-compatslack = ["slack-bolt==1.30.0", "slack-sdk==3.43.0", "aiohttp==3.14.3"]diff --git a/scripts/run_xdist.sh b/scripts/run_xdist.shnew file mode 100644index 00000000000..62cc9a852ed--- /dev/null+++ b/scripts/run_xdist.sh@@ -0,0 +1,24 @@+#!/usr/bin/env bash+# xdist runner: persistent workers sharing one collection pass, instead of+# the per-file subprocess model. EXPERIMENT (PR #96458): the per-file model+# pays a spawn+import wall of ~0.5-1.5s per file x 3400 files (~6 min floor+# on Windows, the dominant share of the lane's runtime). xdist pays that+# import wall once per worker.+#+# --dist loadfile keeps every test of a file on ONE worker, so cross-file+# state pollution is bounded to "files sharing a worker", the same class of+# hazard the per-file model eliminated. Failures here are stateful-test bugs+# to fix, not runner bugs.+set -uo pipefail+cd "$(dirname "$0")/.."++export PATH="/c/Program Files/Git/bin:$PATH"+unset PYTHONPATH PYTHONPYCACHEPREFIX HERMES_RUNTIME_DIR+export TZ=UTC LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONHASHSEED=0 PYTHONUTF8=1++N="${1:-auto}"+shift || true++echo "▶ xdist run: -n $N --dist loadfile $*"+exec .venv/Scripts/python.exe -m pytest -n "$N" --dist loadfile \+ -p no:cacheprovider -m "not integration" -q --tb=line "$@"diff --git a/uv.lock b/uv.lockindex cadbe3f3f55..ed320bdd450 100644--- a/uv.lock+++ b/uv.lock@@ -1286,6 +1286,15 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/e2/bc/7a34e904a415040ba626948d0b0a36a08cd073f12b13342578a68331be3c/exa_py-2.10.2-py3-none-any.whl", hash = "sha256:ecb2a7581f4b7a8aeb6b434acce1bbc40f92ed1d4126b2aa6029913acd904a47", size = 72248, upload-time = "2026-03-26T20:29:37.306Z" },]+[[package]]+name = "execnet"+version = "2.1.2"+source = { registry = "https://pypi.org/simple" }+sdist = { url = "https://files.pythonhosted.org/packages/bf/89/780e11f9588d9e7128a3f87788354c7946a9cbb1401ad38a48c4db9a4f07/execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd", size = 166622, upload-time = "2025-11-12T09:56:37.75Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/ab/84/02fc1827e8cdded4aa65baef11296a9bbe595c474f0d6d758af082d849fd/execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec", size = 40708, upload-time = "2025-11-12T09:56:36.333Z" },+]+[[package]]name = "fal-client"version = "0.13.1"@@ -1753,6 +1762,7 @@ dev = [{ name = "mcp" },{ name = "pytest" },{ name = "pytest-asyncio" },+ { name = "pytest-xdist" },{ name = "ruff" },{ name = "setuptools" },{ name = "starlette" },@@ -2011,6 +2021,7 @@ requires-dist = [{ name = "pyjwt", extras = ["crypto"], specifier = "==2.13.0" },{ name = "pytest", marker = "extra == 'dev'", specifier = "==9.1.1" },{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = "==1.3.0" },+ { name = "pytest-xdist", marker = "extra == 'dev'", specifier = "==3.8.0" },{ name = "python-dotenv", specifier = "==1.2.2" },{ name = "python-multipart", specifier = ">=0.0.9,<1" },{ name = "python-multipart", marker = "extra == 'web'", specifier = "==0.0.32" },@@ -3701,6 +3712,19 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" },]+[[package]]+name = "pytest-xdist"+version = "3.8.0"+source = { registry = "https://pypi.org/simple" }+dependencies = [+ { name = "execnet" },+ { name = "pytest" },+]+sdist = { url = "https://files.pythonhosted.org/packages/78/b4/439b179d1ff526791eb921115fca8e44e596a13efeda518b9d845a619450/pytest_xdist-3.8.0.tar.gz", hash = "sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1", size = 88069, upload-time = "2025-07-01T13:30:59.346Z" }+wheels = [+ { url = "https://files.pythonhosted.org/packages/ca/31/d4e37e9e550c2b92a9cbc2e4d0b7420a27224968580b5a447f420847c975/pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88", size = 46396, upload-time = "2025-07-01T13:30:56.632Z" },+]+[[package]]name = "python-dateutil"version = "2.9.0.post0"