Skip to content

fix(test): prevent shared build races across parallel projects - #131297

Merged
steipete merged 1 commit into
mainfrom
codex/qa-build-ownership-20260827
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-build-ownership-20260827

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #120624 (the earlier parallel-E2E artifact race) and #125924 (QA lifecycle regression coverage).

What Problem This Solves

Resolves a problem where developers running QA lifecycle tests alongside other test projects could see unrelated model-resolution tests fail with missing generated modules, even after a successful build. A full-suite retest reproduced five failures among the nine existing model-resolution cases while the QA fixture rebuilt the shared output tree.

Why This Change Was Made

The selected test run now owns preparation before admitting any workers: one shared classifier supplies local and CI prerequisite modes, private QA satisfies ordinary runtime requirements, and the lifecycle fixture consumes the existing built Gateway instead of launching a development rebuild. Explicit mixed E2E selections reuse the same E2E preparation owner before all readers, while standalone E2E setup, existing prebuilt/skip contracts, cleanup, progress and deadlines remain intact.

This removes the fixture's custom development command and build-forcing fields, duplicate prerequisite metadata, and a test-only export. It does not change model/provider behavior, add configuration, alter hosted CI capacity, or attempt to coordinate arbitrary independent commands sharing a checkout. Product runtime LOC is unchanged; tooling is net +76 lines to supply the missing combined admission boundary, and tests/test-support are net +239.

User Impact

No end-user behavior changes. Maintainers can run selected QA, model and E2E projects together without those projects deleting artifacts beneath already-running readers. A failed preparation admits no test workers, and selections without runtime prerequisites do not build.

Evidence

AI-assisted with Codex; independently reviewed. All proof used an isolated exact-dependency checkout based on 79dfa81664fd64a3f6192331af4953ff9f9bf1ef and task-owned state/ports.

Runtime attestation: test controllers and observed Vitest readers used Node 24.20.0. Build/lint commands that launched bare node through the host PATH were not uniformly version-attested and may have used supported Node 26; this is not a claim that every subprocess used Node 24.

Publication refresh: rebased once onto 2d2c8a9fb53e5720f69a58af4fa806852cad0a13, producing c9c1c33226c702d2eba9a7675ef963fee535195e; all 13 patch files remained byte-identical. The refreshed managed-command owner installs signal handlers before spawn, so its current 31 tests were added to the focused run: all 428 tests passed. The real rebuilt mixed run also passed 22/22 again, with overlapping readers, immutable exact-head artifacts, normal QA exit and no survivors. The full changed gate against the refreshed base passed all 23 checks (exit 0).

  • Before: the original lifecycle fixture caused the exact missing Anthropic facade target, with 5 failed/4 passed existing model tests. The writer removed the target for about 13 seconds. The fixture itself passed, demonstrating that its success did not protect sibling readers.
  • After, same execution order: collected the actual model module, started the repaired real QA fixture, waited for real Gateway readiness, then ran the unchanged assertions: 9/9 model tests and 1/1 QA scenario passed. Artifact stamps remained byte-identical, all child processes exited, and the Gateway listener closed. One earlier instrumented attempt hit the unchanged no-output watchdog under host contention before model assertions; the isolated retry used the same deadlines and no synthetic heartbeat.
  • Native serial and parallel runs: the existing model 9 + lifecycle 1 passed in both modes. Parallelism 2 admitted overlapping workers; the generated artifact generation stayed unchanged throughout their lifetimes.
  • Mixed E2E coverage: model 9 + lifecycle 1 + launcher E2E 12 passed after combined preparation. The same 22 passed with explicitly supplied prebuilt artifacts, preserving the generation from experiment start and performing no replacement build.
  • Regression coverage: the new admission test failed 6/9 cases against the original scheduler. The fixed focused selection passed 397 tests across five files. Final test-only cleanup reruns passed all 9 admission cases and all 5 raw E2E owner cases, including stdout/stderr and SIGTERM descendant cleanup. Repeated runs are not additional unique tests.
  • CI routing: original and candidate full/compact plan JSON matched exactly: 126 full jobs, 34 PR compact jobs, 25 push compact jobs. Existing QA coverage remains selected.
  • Changed gate: the complete final 13-file gate passed (exit 0), including formatting, all guards, all three dead-export scans with zero entries, extension/script/root-test type checks, and full plugin/script lint. Earlier attempts caught an unnecessary script export, test-library typing issues, and a shadowed callback parameter; targeted lint also caught missing test braces. These were corrected without suppressions, compiler-setting changes, or weakened assertions. Full script lint, focused admission lint, and the nine admission cases also passed.

Named follow-ups from extra targeted lint: pre-existing cleanup throws inside finally in test/scripts/vitest-e2e-global-setup.test.ts, and a pre-existing comparator-free sort in test/scripts/ci-node-test-plan.test.ts. Both are unchanged from the base and outside the required changed-gate lint lanes; this repair does not suppress them or broaden into unrelated cleanup.

Reproducible native commands (Node 24):

node scripts/run-vitest.mjs test/scripts/test-projects-build-admission.test.ts test/scripts/test-projects.test.ts test/scripts/ci-node-test-plan.test.ts test/scripts/ci-changed-node-test-plan.test.ts test/scripts/vitest-e2e-global-setup.test.ts
OPENCLAW_TEST_PROJECTS_PARALLEL=2 OPENCLAW_VITEST_MAX_WORKERS=1 node --import ./scripts/tsx.mjs scripts/test-projects.mts src/agents/embedded-agent-runner/model-resolution-consistency.test.ts extensions/qa-lab/src/suite-process-lifecycle.test.ts -- --reporter=verbose
OPENCLAW_TEST_PROJECTS_PARALLEL=2 OPENCLAW_VITEST_MAX_WORKERS=1 node --import ./scripts/tsx.mjs scripts/test-projects.mts src/agents/embedded-agent-runner/model-resolution-consistency.test.ts extensions/qa-lab/src/suite-process-lifecycle.test.ts test/openclaw-launcher-version.e2e.test.ts -- --reporter=verbose
node scripts/check-changed.mjs --base 79dfa81664fd64a3f6192331af4953ff9f9bf1ef --timed

Provenance: the lifecycle development-command/build-forcing path was introduced in #125924 (88edcd165480, 2026-08-19; code author, PR author and merger @steipete). The related E2E ownership fix #120628 (40385bb5c153, 2026-08-08; code author, PR author and merger @steipete) prepared only its own config; this closes the mixed-project boundary. Its stream/signal repair #120653 (a9012617543c, 2026-08-08; code author, PR author and merger @vincentkoc) is preserved.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts extensions: qa-lab size: L maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 00:10
@steipete
steipete merged commit af52e62 into main Aug 28, 2026
304 checks passed
@steipete
steipete deleted the codex/qa-build-ownership-20260827 branch August 28, 2026 00:30
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant