Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

ci: cap Windows server Vitest workers at 2 to avoid 0xC0000142 worker-startup crashes (#10114)

Adam Eivycf2d59b0d760
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6d868df529..bab4a3950b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -798,6 +798,9 @@ jobs:
CI_SHARD: ${{ matrix.shard }}/${{ strategy.job-total }}
PORTOS_TEST_QUIET: 1
PGPASSWORD: portos
+ # Windows runners lose Vitest workers at startup with 0xC0000142
+ # (STATUS_DLL_INIT_FAILED) under per-file process churn (#10114).
+ PORTOS_CI_MAX_WORKERS: 2
run: node scripts/run-ci-tests.js server
- name: Report the failure, then cancel sibling CI jobs
diff --git a/scripts/vitestCiPool.js b/scripts/vitestCiPool.js
index f47a216710..924f81c2fe 100644
--- a/scripts/vitestCiPool.js
+++ b/scripts/vitestCiPool.js
@@ -11,10 +11,19 @@
* independent files. The DB suite already serializes files because those
* tests share one Postgres.
*
+ * `PORTOS_CI_MAX_WORKERS` (CI only) lowers the cap for one job, e.g. Windows.
+ *
* Vitest 5 exposes `maxWorkers` only — there is no `minWorkers` / `minThreads`.
*/
export function vitestCiPool({ maxWorkers = 4 } = {}) {
- if (process.env.CI) return { maxWorkers };
+ if (process.env.CI) {
+ // The Windows server job lowers the cap (#10114): one process per test file
+ // exhausts Windows process-creation resources on the runner (0xC0000142).
+ // Like the pregate budget, it can only lower the proven cap.
+ const raw = process.env.PORTOS_CI_MAX_WORKERS;
+ const ci = /^[1-9]\d*$/.test(raw ?? '') ? Number(raw) : null;
+ return { maxWorkers: ci === null ? maxWorkers : Math.min(maxWorkers, ci) };
+ }
const raw = process.env.PORTOS_PREGATE_MAX_WORKERS;
const pregate = /^[1-9]\d*$/.test(raw ?? '') ? Number(raw) : null;
return pregate === null ? {} : { maxWorkers: Math.min(maxWorkers, pregate) };
diff --git a/scripts/vitestCiPool.test.js b/scripts/vitestCiPool.test.js
index 2b06b6b837..f4f47cd4a6 100644
--- a/scripts/vitestCiPool.test.js
+++ b/scripts/vitestCiPool.test.js
@@ -9,6 +9,7 @@ import { vitestCiPool } from './vitestCiPool.js';
describe('vitestCiPool', () => {
const original = process.env.CI;
+ const originalCi = process.env.PORTOS_CI_MAX_WORKERS;
const originalPregate = process.env.PORTOS_PREGATE_MAX_WORKERS;
const restore = (key, value) => {
if (value === undefined) delete process.env[key];
@@ -18,6 +19,19 @@ describe('vitestCiPool', () => {
afterEach(() => {
restore('CI', original);
restore('PORTOS_PREGATE_MAX_WORKERS', originalPregate);
+ restore('PORTOS_CI_MAX_WORKERS', originalCi);
+ });
+
+ it('lets a CI job lower the cap but never raise it or use a malformed value', () => {
+ process.env.CI = 'true';
+ process.env.PORTOS_CI_MAX_WORKERS = '2';
+ expect(vitestCiPool()).toEqual({ maxWorkers: 2 });
+ process.env.PORTOS_CI_MAX_WORKERS = '16';
+ expect(vitestCiPool()).toEqual({ maxWorkers: 4 });
+ for (const bad of ['0', 'abc', '2.5', '']) {
+ process.env.PORTOS_CI_MAX_WORKERS = bad;
+ expect(vitestCiPool()).toEqual({ maxWorkers: 4 });
+ }
});
it('bounds local pregate workers, never above the workspace cap', () => {