Repository navigation
fix(alpha): cap pytest-xdist workers in agent runs - #338
Merged
Merged
Conversation
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli
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.
Why
Agent runs that call
pytest -n autostart one worker per CPU. On a 30-CPU Linux build host that's 30 workers at about 200 MB each, which fills the agent account's 8 GB limit and drives fleet load past 50, so reviews can't find a host.Behavior change
Every agent run, for both harnesses, now starts with
PYTEST_XDIST_AUTO_NUM_WORKERS=4in its environment. pytest-xdist reads that variable for-n auto, so existing commands stay the same and use at most 4 workers. An explicit-n 8still wins.Deviations from the task
The request suggested
min(auto, 8)or a memory-aware count. A fixed 4 is the simpler setting, and three concurrent runs then use 12 workers, not 90.Risk
Test suites in agent runs finish slower on large hosts. The value is one constant in
policy.py, so raising it takes one line.Verification
pytestpasses 1,611 tests across the policy, command-line, run-host and driver files, with the expected environment updated for both harnesses.ruffpasses. CI runs the full Bazel suite.Opened-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;surface=cli
Generated-by: LLM effort=medium;harness=claude-code:2.1.322;model=anthropic:claude-sonnet-5-5;session=sha-256-64:24ed779d56b187de;started_at=2026-11-15T16:51:11Z;surface=cli