#19063: CI/macOS: disable Vitest vmForks for TS tests to stop mock-state leakage flakes
size: XS
## Summary
This PR stabilizes the macOS TypeScript CI job by disabling Vitest `vmForks` for that job only.
The macOS workflow currently runs:
- `pnpm test`
On CI, `scripts/test-parallel.mjs` enables `vmForks` by default. In that mode, we observed cross-file mock/module-state contamination leading to order-dependent false negatives (for example, `vi.fn()` call-count assertions unexpectedly at 0, missing mocked exports, and unrelated suites failing together).
## Root Cause
The failures are caused by test-runner isolation behavior under `CI + vmForks`, not by the feature code in the failing PRs.
Evidence from reproduction:
- `CI=true pnpm test` -> reproducible random mock-related failures across unrelated suites.
- `CI=true pnpm test -- src/web/inbound/send-api.test.ts src/process/supervisor/adapters/child.test.ts` -> both pass in isolation.
- `CI=true OPENCLAW_TEST_VM_FORKS=0 pnpm test` -> full suite passes.
## Change
In `.github/workflows/ci.yml`, for `macos` -> `TS tests (macOS)`:
- Add `OPENCLAW_TEST_VM_FORKS: "0"`
This keeps the fix narrowly scoped to the flaky job while preserving existing behavior elsewhere.
## Why This Scope
- The observed blocker is the macOS CI TS job.
- This patch avoids broad test runner policy changes and minimizes risk.
- We can evaluate broader `vmForks` policy separately if needed.
## Validation
- Reproduced CI-only flake locally with `CI=true`.
- Verified deterministic pass with `OPENCLAW_TEST_VM_FORKS=0`.
- Confirmed targeted failing tests pass in isolation.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Disabled Vitest `vmForks` for macOS CI to prevent cross-file mock-state contamination causing flaky test failures. The change sets `OPENCLAW_TEST_VM_FORKS: "0"` which `scripts/test-parallel.mjs` respects to fall back to standard forks-based test execution. This is a targeted fix for observed CI-only flakes without affecting other platforms or local development.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Single-line config change that disables a specific test runner feature for one CI job. The environment variable is explicitly supported by the test infrastructure (test-parallel.mjs:55-57), fallback behavior is well-tested, and the scope is narrowly limited to macOS CI without affecting other platforms or local development
- No files require special attention
<sub>Last reviewed commit: 4a46bcd</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17393: fix(ci): resolve TS2742 type error blocking all PRs
by miloudbelarebia · 2026-02-15
77.4%
#21500: fix(test): resolve vi.mock hoisting failures on macOS runners
by irchelper · 2026-02-20
76.6%
#17934: fix: macOS CI hangs for 2+ hours due to unhandled SSE stream errors
by MisterGuy420 · 2026-02-16
74.1%
#22721: fix(exec): keep child runs attached on macOS for reliable output
by rylena · 2026-02-21
73.8%
#21075: fix(media): use sips on Node.js + darwin to prevent Photos TCC prompt
by irchelper · 2026-02-19
73.5%
#20390: fix(daemon): fall back to /tmp for launchd logs on removable volumes
by lemoz · 2026-02-18
72.5%
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
72.0%
#17426: ci(formal): don't fail on fork PRs when PR comment is blocked
by mitre88 · 2026-02-15
71.7%
#9438: fix: auto-detect low-memory environments and prevent test OOM
by CompassHXM · 2026-02-05
71.5%
#18112: fix(daemon): gateway install on macOS ignores fnm/nvm node (#18090)
by yinghaosang · 2026-02-16
71.2%