Skip to content

Commit 33668ee

Browse files
committed
ci: move primary test gate to ubuntu-latest with xdist parallelism
The Windows-2022 runner hits transient STATUS_ILLEGAL_INSTRUCTION crashes (AVX2 misfire in fastembed/sqlite-vec) at ~40% rate per attempt, forcing a serial retry loop that makes every test run 8-24 minutes. New structure: - lint: ubuntu-latest — instant, no C-extension crashes - test: ubuntu-latest, matrix [3.12, 3.13], -n auto — 2-3 min with full xdist parallelism; this is the blocking gate - test-windows: windows-2022, 3.13 only, continue-on-error: true — the existing serial retry loop stays but the job is non-gating; Windows regressions are visible without holding up every push
1 parent 614fbf8 commit 33668ee

1 file changed

Lines changed: 25 additions & 52 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ env:
66

77
jobs:
88
lint:
9-
runs-on: windows-2022
9+
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: astral-sh/setup-uv@v3
@@ -21,7 +21,7 @@ jobs:
2121
run: uv run mypy src
2222

2323
test:
24-
runs-on: windows-2022
24+
runs-on: ubuntu-latest
2525
strategy:
2626
fail-fast: false
2727
matrix:
@@ -35,43 +35,31 @@ jobs:
3535
- run: uv python install ${{ matrix.python-version }}
3636
- run: uv sync --all-extras --python ${{ matrix.python-version }}
3737
- name: Test
38-
# ``-rfE`` prints short tracebacks for failures and errors at the
39-
# end of the run so a CI failure surfaces the actual assertion or
40-
# exception in the log without needing to download artefacts.
41-
# ``--tb=short`` keeps each entry compact (one line per frame) so
42-
# the summary stays readable even when several tests fail at once.
43-
# ``TOKEN_GOAT_NO_WORKER_SPAWN=1`` suppresses the detached worker
44-
# daemon spawn from ``worker.ensure_running()``. Under GitHub
45-
# Actions on Windows the runner tracks every descendant via a
46-
# Win32 job object, so the daemon's infinite loop holds the
47-
# test step open until the global six-hour timeout fires. Tests
48-
# still exercise the watchdog branch by reading the env var; only
49-
# the actual ``subprocess.Popen`` is skipped.
5038
env:
5139
TOKEN_GOAT_NO_WORKER_SPAWN: "1"
52-
# Ensure detect_harness() returns "claudecode" on the CI runner.
53-
# Without this, no ANTHROPIC_API_KEY or CLAUDE_CODE_SESSION_ID is
54-
# present and detect_harness() falls back to "generic", which strips
55-
# most manifest sections in _render() — causing 100+ test failures.
5640
TOKEN_GOAT_HARNESS_OVERRIDE: "claudecode"
57-
# ``-m "not slow"`` excludes the opt-in stress tier (git-integration
58-
# tests, multi-process concurrency tests). The slow tier is racy on
59-
# the Windows runner's tmpdir under heavy IO and CI's already-stressed
60-
# filesystem layer — pytest-rerunfailures only partially masks it.
61-
# The fast tier still exercises the cross-process invariants via the
62-
# threaded variant of each stress test (e.g. test_concurrent_threads
63-
# _100_edits_no_loss covers the same lock-stack as its subprocess
64-
# sibling, just without the subprocess.Popen pressure).
65-
#
66-
# ``-n 0`` forces serial execution, overriding the ``-n auto`` from
67-
# pyproject.toml's addopts. The Windows-2022 GH Actions runner produces
68-
# transient C-extension worker crashes (``Windows fatal exception:
69-
# access violation`` / ``code 0xc000001d`` / ``<freed thread state>``)
70-
# at random points in the suite. Even serial execution sees them — the
71-
# corruption is process-level, not contention-level. The 3-attempt
72-
# retry loop catches them: a single attempt's crash rate is ~40%, so
73-
# three independent tries yield ~94% green CI without hiding real
74-
# failures (a real regression fails every attempt).
41+
run: uv run pytest -n auto -m "not slow" -rfE --tb=short
42+
43+
test-windows:
44+
# Non-gating Windows compat check. The Windows-2022 runner produces
45+
# transient C-extension crashes (STATUS_ILLEGAL_INSTRUCTION from AVX2
46+
# mismatches in fastembed/sqlite-vec) at ~40% rate per attempt, requiring
47+
# a serial retry loop. Linux is the primary gate; this job surfaces
48+
# Windows-specific regressions without blocking the build.
49+
runs-on: windows-2022
50+
continue-on-error: true
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: astral-sh/setup-uv@v3
54+
with:
55+
enable-cache: true
56+
cache-dependency-glob: "uv.lock"
57+
- run: uv python install 3.13
58+
- run: uv sync --all-extras
59+
- name: Test
60+
env:
61+
TOKEN_GOAT_NO_WORKER_SPAWN: "1"
62+
TOKEN_GOAT_HARNESS_OVERRIDE: "claudecode"
7563
run: |
7664
for attempt in 1 2 3; do
7765
echo "=== Test attempt $attempt of 3 ==="
@@ -80,28 +68,13 @@ jobs:
8068
done
8169
exit 1
8270
shell: bash
83-
84-
- name: Test (slow tier, allow-fail)
85-
# The slow tier runs the multi-process concurrency tests and git
86-
# integration tests. These are racy under Windows-Server-2022 + GitHub
87-
# Actions and we don't want them to gate the build. ``continue-on-error``
88-
# surfaces failures without blocking the run, so we still see what's
89-
# happening but don't lose the entire build to a transient race.
71+
- name: Test (slow tier)
9072
continue-on-error: true
9173
env:
9274
TOKEN_GOAT_NO_WORKER_SPAWN: "1"
9375
TOKEN_GOAT_HARNESS_OVERRIDE: "claudecode"
9476
run: uv run pytest -m "slow" -rfE --tb=short
95-
9677
- name: Kill leftover detached worker daemons
97-
# Several hook tests trigger ``worker.ensure_running()`` which
98-
# spawns ``pythonw.exe -m token_goat.cli worker --daemon`` as a
99-
# detached background process. ``DETACHED_PROCESS`` is honoured
100-
# by Windows itself but GitHub Actions' Windows runner uses a
101-
# Win32 job object to track every descendant; the daemon's
102-
# infinite loop would otherwise hold the step open until the
103-
# global six-hour timeout. This always-runs step terminates
104-
# any leftover daemon so the runner can finish promptly.
10578
if: always()
10679
run: |
10780
Get-CimInstance Win32_Process |

0 commit comments

Comments
 (0)