test: stabilize and speed the parallel suite without a full rerun - #18
Merged
Conversation
Stop load-sensitive flakes from forcing a 605-file rerun at 2 workers. Batch cheap files, isolate server/spawn/HOME-mutating tests, and retry only failed files. Convert the doctor CLI spawn to in-process status collection and keep the spawned status JSON contract in cli-status-json. Co-authored-by: pavelhov <pavelhov@users.noreply.github.com>
Route Back, sync, and ensure tests were reaching the host bus. With no user session that probe is unproven ownership / SERVICE_BLOCKED, which is not the catalog or lifecycle claim those files make. Pass diagnoseService through restore-back replacement, put the existing systemctl stub on child PATH, and treat unsupported summaries as the no-bus Linux case instead of requiring a log path they never embed. Co-authored-by: pavelhov <pavelhov@users.noreply.github.com>
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.
TESTS ONLY. No packaging, Cursor protocol, or product/security audit work.
What was flaky and why
Pavel’s repro:
bun run test:parallel(~605 files, default 4 workers) took ~5m28s, thentests/codex-plugins-doctor.test.tsandtests/claude-models-discovery.test.tsfailed. Both pass in isolation and hit a ~20s timeout under parallel load. The recovery wasCCX_TEST_PARALLEL_WORKERS=2 bun run test:parallel— a full-suite rerun at half workers.Root cause (verified, not guessed):
bun test --isolate) × 4 workers.codex-plugins-doctorspawned another Bun CLI (ccx status --json) with a 20s test budget and nospawnSynctimeout. Under load that nested boot exceeded 20s.claude-models-discoverybinds real servers (startServer) many times in one file. Same isolate-per-file contention class; it already had a 30s budget, but still competed with hundreds of other process boots.What changed (runner + tests)
scripts/test-plan.ts): cheap unit files share a process (--no-isolate --max-concurrency=1, batches of 8). Files that bind a server, spawnprocess.execPath, callsaveConfig, or mutateCODEXCOMMANDER_HOME/CODEX_HOMEstill get their own process.tests/preload.tsHOME sandbox is unchanged (still per process, including a barebun test <file>).bun run test:parallel tests/foo.test.ts …, not a 2-worker full rerun. Default worker count staysmin(4, CPUs).collectStatus()(samecodexPlugins+ CODEX_HOME read-only assertions). Spawnedstatus --jsoncoverage, including CODEX_HOME read-only andcodexPlugins, stays intests/cli-status-json.test.tswithSPAWN_BUDGET_MS.SERVER_BUDGET_MS(30s) instead of a magic number.SERVICE_BLOCKED. Child processes get the existingsystemctlstub onPATH; restore-back passesdiagnoseServiceinto the replacement start path.bun run test:parallelso local and CI share the retry path.CCX_TEST_FORCE_ISOLATE=1restores one process per file.CCX_TEST_RETRY=0disables retry.Timings
CCX_TEST_PARALLEL_WORKERSunset)Plan on this tree: 605 files → 239 isolated + 366 batchable in 46 batches = 285 work items.
Formerly flaky files (
codex-plugins-doctor,claude-models-discovery) plus heavy neighbors: 5/5 passes under default 4-workerbun run test:parallel(~8s each).Landing
Pushed onto
development(fast-forward03c66ca5..9c4c195d) after the evidence above. Not pushed tomain.developmentwas first fast-forwarded tomainso it was not 105 commits behind.Audit / packaging / Cursor
Out of scope. Not in this PR.
Verification
test-runner,ci-workflows,codex-plugins-doctor,cli-status-json,claude-models-discoverybun run typecheckbun run test:parallel(default workers) green: 605 files, 1.7 min, no retryCCX_TEST_PARALLEL_WORKERS=2full-rerun hack requiredSecurity review
.github/workflows/ci.ymlTest suite step is nowbun run test:parallel(contents: read; no new secrets, third-party actions, or permission changes). Needs explicit security review per MAINTAINERS.md.GitHub
cion this branch (and onmain) currently fails at GUI tests before the proxy suite runs. That failure is pre-existing onmainand is out of scope for this tests-only change.