Skip to content

Stop page servers when asked, and run CI's suite on three workers - #1856

Merged
max-sixty merged 3 commits into
mainfrom
ci-test-perf
Oct 6, 2026
Merged

max-sixty merged 3 commits into
mainfrom
ci-test-perf

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two cuts to what the browser suite pays per test, from the cost survey after #1807.

A page server stops when asked (skills/leaf/scripts/leaf/hosting.py). Uvicorn notices should_exit on a 0.1 s tick, then sleeps a fixed 0.1 s after asking each connection to finish, so a page server with nothing in flight took ~0.18 s to stop, and the suite stops one per browser test. LeafHTTPServer now runs a uvicorn Server subclass whose loop also wakes on shutdown(), and whose stop keeps uvicorn's order (close listeners, ask connections to finish, wait for them and for running tasks, then for the servers) but waits only as long as they take. Measured locally: a server stops in 0.001 s with its pages closed and 0.006 s with one still open (was 0.182 s); the drafts and reactions files' 225 teardowns sum to 3.9 s (was 35.9 s).

CI runs three pytest workers (.github/workflows/ci.yaml). The runner's four vCPUs sat ~41% idle under two workers. In the Oct 4 experiment (37211926233) four workers left 7% idle and cut wall time ~30% but slowed each test 1.3–1.46×; three take most of the idle share without saturating the deadlines browser tests wait under. Local runs keep pyproject.toml's two, since several suites overlap on one machine. This adds no runners: PR test jobs were 92 of the ci workflow's 155 runner-hours over the last day, so a shorter job frees the shared pool directly.

Checked locally: test_interact_server, test_website_server, test_interact_session, test_interact_preview, test_interact_layer, test_smoke pass; test_render_drafts and test_render_reactions (nightly) pass except the two reactions tests that fail identically on main.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits October 5, 2026 17:13
Uvicorn notices `should_exit` on a 0.1 s tick, then sleeps a fixed 0.1 s after
asking each connection to finish. A page server with nothing in flight took
~0.18 s to stop, and the browser suite stops one per test. The serving loop now
also wakes when `shutdown` is called, and the stop waits only as long as its
connections and tasks take.

Measured locally: a closed-page server stops in 0.001 s (was 0.182 s); the
drafts and reactions files' 225 teardowns sum to 3.9 s (was 35.9 s).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The runner's four vCPUs sat ~41% idle under two workers. In the Oct 4
experiment four workers left 7% idle and cut wall time ~30% but slowed each test
1.3–1.46×, so three take most of the idle share without saturating the deadlines
browser tests wait under. Local runs keep two, since several suites overlap on
one machine.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 19928fb into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the ci-test-perf branch October 6, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants