Repository navigation
perf(tests): stub babysit gh reads and run check-affected suites in parallel - #10534
Conversation
…arallel The babysit-prs engine suite spawned 6 real gh processes across 5 tests (repos/owner/repo reads), spending the shared token budget and depending on the network. The Unattended harness's policy._get fake fell back to the real reader when no test patch answered; it now raises there instead, so the four manifest tests read the head as unreadable exactly as before, with no process. The refresh author-check test stops at refuse_standards_sync instead of calling gh. check-affected.sh --tests ran the selected shell suites one at a time. It now takes --jobs N (default $CHECK_AFFECTED_JOBS, else cores - 1) and hands it to affected-tests.sh, whose run-plugin-tests.sh job pool keeps the serial-list suites off the parallel group. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: no findingsI read the whole diff and the PR context. I did not run anything.
Spend: more concurrent local test suites in critical-findings: 0 |
|
claude-review reviewed No blocking or advisory findings. I read the full diff and checked its call sites in the repository. I ran no tests, so the test results quoted in the PR description are author-claimed and unverified by me. What I checked
Cost and trusted paths
|
Post-merge mutation testingKilled 0, survived 1, timeout 0, no coverage 0, invalid 0, not run 7.
Surviving mutants
The run's summary has the full report. |
No related issue: test-lane waste found by measurement in this session (real gh calls from unit tests, serial suites in check-affected --tests).
Summary
ghprocesses againstrepos/owner/repo, spending the shared token budget and depending on the network. They now spawn none.scripts/check-affected.sh --testsran the selected shell suites one at a time. It now takes--jobs Nand runs them through the existingrun-plugin-tests.shjob pool.Fix
Real gh calls. Measured by running the suite with a PATH shim
ghthat logs its argv and the running test, then exits 1, plus a socket-connect probe:test_babysit_verify_evidence.py(LaneRequiresAVerdict,LocalBabysitReadsNoVerdict)test_babysit_merge.py(RefreshRefusesDependencyManagerPrs)Unattendedharness intest_babysit_merge_unattended.py: itspolicy._getfake fell back to whateverpolicy._getwas whenrun_mainpatched it, which is the real reader unless the test patched it first, so a manifest's head contents read reached gh. The fallback still delegates to a test's own outer patch (TheQueueSweepIsSharedPerRunuses one), and raisesAssertionErrorinstead of calling the real reader, as the harness'sgh_jsonfake already does.with_contentscatches it, so those tests still read the manifest as unreadable and score HIGH exactly as before (the shim and the old real call both failed the read).validate_current_candidatego on torefuse_standards_sync, which calledgh api repos/owner/repo/pulls/476. It now patches that step to raise, and asserts the run got past the author check.No suite-wide guard: the engine runs
unittest discover, which has no shared hook (no conftest, andtests/__init__.pyis not imported as a package), and a mock-based guard inside the readers would be swallowed by their own broadexcept. The PATH-shim run is the check; adding it as a lane would be a new mechanism.check-affected --jobs.
--jobs N(default$CHECK_AFFECTED_JOBS, elsenproc- 1; an invalid env value falls back to 1, ascheck-changed-skills.shdoes) is passed toaffected-tests.sh --jobs, which already hands N > 1 torun-plugin-tests.sh --suites-from. That pool keepsrun-plugin-tests-serial.txtsuites off the parallel group, so no new pool.--uncommittedforwards it. The pre-push hook runs check-affected without--tests, so pushes are unchanged.Timing. The shell-suite leg
--jobschanges, on a frozen selection: the 48*.test.shsuitesaffected-tests.shselects forb914f852f7..HEAD,ghshim first on PATH, 24-core WSL host with load average 9 to 14 from other sessions.bash <suite>in turn, asaffected-tests.shruns them today)surface.test.shhit a Playwright click timeout)Command:
bash scripts/run-plugin-tests.sh --jobs N --suites-from <list>, the callaffected-tests.sh --run --jobs Nmakes. From 8 jobs up, the wall time is the longest suite (plugins/planning/surface/surface-journey.test.sh, 290 s median inscripts/suite-seconds.txt). The same results at 3, 8 and 24 jobs show the selected suites don't depend on each other. The default isnproc- 1, notnproc:affected-tests.shrecords 3 jobs as the ceiling on a 4-vCPU runner, and 4 failed there (#3694). This host gains nothing past 8 jobs. On this branch,scripts/check-affected.sh --tests --base 73b971b815 --no-fetchat the default (23 jobs) took 218 s end to end, rc 0.Verification
plugins/source-control/skills/babysit-prs/scripts/engine.test.sh(the unittest suite, the pinned ruff and the wrapper checks) with theghshim first on PATH: 3205 tests OK, ruff clean, 0ghspawns.ghspawns, 0 connects. Theunittest discoverrun above is the final revision.scripts/check-affected.test.sh: PASS=75 FAIL=0, including a new case where--jobs 0is a usage error.scripts/check-affected.sh --testson this branch with the shim: every lint check passed and every selected shell suite passed, with 0ghspawns.testsis a SKIP only for the 8 babysit Python files, whichengine.test.shruns.Related
scripts/affected-tests.sh)plugins/harness-ops/skills/morning-brief/morning-brief.test.shspawnedgh api --paginate repos/example/test-repo/actions/workflows?per_page=1006 times per run under the shim. The read isscripts/morning-brief.sh:2161, which a test reaches withoutGH_STUB_DIRon PATH.🤖 Generated with Claude Code