Skip to content

perf(tests): run source test projects in forked workers - #11016

Merged
morluto merged 1 commit into
perf/mcp-output-schema-definitionsfrom
perf/source-tests-forked-workers
Nov 15, 2026
Merged

morluto merged 1 commit into
perf/mcp-output-schema-definitionsfrom
perf/source-tests-forked-workers

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

The source test lane (npm run test:fast: domain, services, adapters, composition, conformance and evaluation) ran five of its six projects in threads workers. All of those workers share one Node process, so the lane's largest process reached 3.8–5.0 GiB. These projects now run in forks workers and keep isolate: false, so each worker process still reuses its module graph across files. The largest single process drops to 1.2–1.8 GiB.

Stacked on #11005. That PR fixes the two tests that overflowed the main-thread stack under forks (analysisDetail, BrowserScenarioViews). This PR depends on that fix.

Problem and expected behavior

  • With threads, the lane's four CI workers each keep a high-water heap inside one process. The source-lane CI job was reported to fail with spawnSync … ENOMEM from that process. I did not reproduce the ENOMEM locally. The memory measurements below are executed.
  • A thread worker gets a 4 MiB stack. A forked worker runs on the main thread's default stack, which is how the two oversized validator frames fixed in perf(mcp): advertise large output union alternatives as shared definitions #11005 were found.

Expected: no single test process holds the whole source lane.

Change and scope

  • vitest.config.ts: domain, services, composition, conformance and evaluation use pool: "forks". Worker counts are unchanged (4 on GitHub Actions, otherwise 2). isolate: false still shares each worker's module graph across files.
  • docs/development/testing.md states that source projects run their shared graphs in forked workers.

Not included: mcp-boundary remains on threads. Its peak is addressed by #10960 and the client-validation slices. No test was pruned or skipped.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the Vitest project policy in vitest.config.ts.
  • Contribution scope fit and linked maintainer decision: test infrastructure. The switch was approved by the coordinating maintainer decision for this workstream.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none. CI test history entries are keyed by pool, so the sequencer has no history for these projects on their first forked run.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

The commands below were executed on macOS arm64 with Node 24.22.1 and GITHUB_ACTIONS=true, which selects 4 workers as on CI. Each run used node node_modules/vitest/vitest.mjs run --project domain --project services --project adapters --project composition --project conformance --project evaluation. Peak RSS was sampled every 200 ms over the process family. CPU comes from getrusage of the reaped children. "Cold" means node_modules/.vite/vitest was removed first. The host was shared with other agents at load average 12–25 on 10 cores, so wall time is noisy and CPU time is the steadier comparison.

Run Wall User + sys CPU Peak family RSS Largest single process
threads, cold (this base) 226 s 517 + 93 s 5,024 MiB 5,007 MiB
threads, warm (earlier run, same host, before #10960) 355 s 545 + 129 s 3,851 MiB 3,834 MiB
forks, cold 234 s 508 + 95 s 5,172 MiB 1,784 MiB
forks, warm 288 s 535 + 110 s 4,748 MiB 1,185 MiB

All four runs completed 1,591 files / 30,281 tests passed (65 skipped) except the earlier threads warm run, whose result is not repeated here. The forked lane's total is about the same as the threads lane's total (≈5 GiB, within a 16 GiB hosted runner). The difference is that no single process holds the lane. Wall time and CPU are within noise: the earlier warm measurement (355 → 258 s) was not reproduced under today's load, so this PR claims memory, not speed.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • The full source lane, cold and warm with forks and cold with threads, as listed above: each run passed 1,591 files / 30,281 tests, 65 skipped.
  • npm run check:fast passed.
  • npx oxfmt --check vitest.config.ts docs/development/testing.md passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Thread workers of the source lane share one process, which grew to 3.8-5.0 GiB; forked workers keep each heap separate so the largest process stays near 1.2-1.8 GiB.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T10:13:48.914551Z e0fa523 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

Moves five source test projects from threads to forked workers. Worker limits and module sharing stay unchanged.

  • Five source test projects now run in separate forked workers.

Reviews (2) · Last reviewed commit: "perf(tests): run source test projects in..." · Reviewed by Greptile

@morluto
morluto merged commit c07c5bd into perf/mcp-output-schema-definitions Nov 15, 2026
1 check passed
@morluto
morluto deleted the perf/source-tests-forked-workers branch November 15, 2026 10:19
morluto added a commit that referenced this pull request Nov 15, 2026
…tions (#11005)

* perf(mcp): advertise large output union alternatives as shared definitions

inspect_analysis_view's advertised output schema held every view result inline in one union definition, which the MCP SDK's default validator compiled into one function: about 1.7 s CPU and 500 MiB peak. Large union alternatives now become definitions of their own and identical definitions are merged, at the owning output projection. Tests that check results against the advertised output contract now compile that schema instead of a separate inline projection, which overflowed the main-thread stack under forked workers.

* perf(tests): run source test projects in forked workers (#11016)

Thread workers of the source lane share one process, which grew to 3.8-5.0 GiB; forked workers keep each heap separate so the largest process stays near 1.2-1.8 GiB.

* test(mcp): select the analysis view contract from its family
@morluto morluto added area: tests Test suite and verification performance Performance regressions, scaling limits, and bounded-resource work labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant