Repository navigation
Stop page servers when asked, and run CI's suite on three workers - #1856
Merged
Merged
Conversation
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]>
leaf-agent
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 noticesshould_exiton 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.LeafHTTPServernow runs a uvicornServersubclass whose loop also wakes onshutdown(), 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 keeppyproject.toml's two, since several suites overlap on one machine. This adds no runners: PR test jobs were 92 of theciworkflow'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_smokepass;test_render_draftsandtest_render_reactions(nightly) pass except the two reactions tests that fail identically on main.