diff --git a/scripts/pr-lib/gates.sh b/scripts/pr-lib/gates.sh index d233955829e7..ada6024527d2 100644 --- a/scripts/pr-lib/gates.sh +++ b/scripts/pr-lib/gates.sh @@ -193,7 +193,7 @@ run_remote_testbox_full_test_gate() { --ttl 240m \ --timing-json \ --label "$lease_label" \ - -- env CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=install corepack pnpm test + -- env CI=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=install corepack pnpm test } read_remote_testbox_gate_stamp() { diff --git a/scripts/test-projects.test-support.mjs b/scripts/test-projects.test-support.mjs index 02cd206cc824..9b514656641b 100644 --- a/scripts/test-projects.test-support.mjs +++ b/scripts/test-projects.test-support.mjs @@ -171,6 +171,7 @@ const EXTENSION_VOICE_CALL_VITEST_CONFIG = "test/vitest/vitest.extension-voice-c const EXTENSION_WHATSAPP_VITEST_CONFIG = "test/vitest/vitest.extension-whatsapp.config.ts"; const EXTENSION_ZALO_VITEST_CONFIG = "test/vitest/vitest.extension-zalo.config.ts"; const EXTENSIONS_VITEST_CONFIG = "test/vitest/vitest.extensions.config.ts"; +const FULL_AGENTIC_VITEST_CONFIG = "test/vitest/vitest.full-agentic.config.ts"; const FULL_EXTENSIONS_VITEST_CONFIG = "test/vitest/vitest.full-extensions.config.ts"; const GATEWAY_CLIENT_VITEST_CONFIG = "test/vitest/vitest.gateway-client.config.ts"; const GATEWAY_CORE_VITEST_CONFIG = "test/vitest/vitest.gateway-core.config.ts"; @@ -4758,7 +4759,13 @@ export function buildFullSuiteVitestRunPlans(args, cwd = process.cwd()) { ) { return []; } - const expandShard = expandToProjectConfigs; + // The remote Testbox full gate runs every agentic and extension project in one process tree. + // Bound project and worker lifetimes before either aggregate reaches V8's heap limit. + const expandShard = + expandToProjectConfigs || + (process.env.OPENCLAW_TESTBOX_REMOTE_RUN === "1" && + (shard.config === FULL_AGENTIC_VITEST_CONFIG || + shard.config === FULL_EXTENSIONS_VITEST_CONFIG)); const configs = expandShard ? shard.projects : [shard.config]; return configs.flatMap((config) => { if (expandShard && targetArgs.length === 0) { diff --git a/test/scripts/pr-prepare-gates.test.ts b/test/scripts/pr-prepare-gates.test.ts index f7c54610f371..1cfb1eaabf36 100644 --- a/test/scripts/pr-prepare-gates.test.ts +++ b/test/scripts/pr-prepare-gates.test.ts @@ -434,7 +434,8 @@ describe("remote testbox gate delegation", () => { "--blacksmith-ref main " + "--idle-timeout 90m --ttl 240m --timing-json " + "--label pr-424242-gates " + - "-- env CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=install corepack pnpm test", + "-- env CI=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 " + + "PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=install corepack pnpm test", ); }); diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index dc78551870d8..42e2d3836552 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -4645,6 +4645,7 @@ describe("scripts/test-projects full-suite sharding", () => { it("keeps CI=1 full-suite runs on aggregate shard configs", () => { vi.stubEnv("CI", "1"); vi.stubEnv("GITHUB_ACTIONS", ""); + vi.stubEnv("OPENCLAW_TESTBOX_REMOTE_RUN", ""); vi.stubEnv("OPENCLAW_TEST_PROJECTS_LEAF_SHARDS", ""); vi.stubEnv("OPENCLAW_TEST_PROJECTS_PARALLEL", ""); try { @@ -4710,6 +4711,24 @@ describe("scripts/test-projects full-suite sharding", () => { expect(specs[0]?.env.NODE_OPTIONS).toBe("--max-old-space-size=12288 --max_old_space_size=8192"); }); + it("splits the Testbox agentic and extension shards into bounded processes", () => { + vi.stubEnv("CI", "1"); + vi.stubEnv("GITHUB_ACTIONS", ""); + vi.stubEnv("OPENCLAW_TESTBOX_REMOTE_RUN", "1"); + vi.stubEnv("OPENCLAW_TEST_PROJECTS_LEAF_SHARDS", ""); + vi.stubEnv("OPENCLAW_TEST_PROJECTS_PARALLEL", ""); + try { + const configs = buildFullSuiteVitestRunPlans([], process.cwd()).map((plan) => plan.config); + + expect(configs).not.toContain("test/vitest/vitest.full-agentic.config.ts"); + expect(configs).not.toContain("test/vitest/vitest.full-extensions.config.ts"); + expect(configs).toContain("test/vitest/vitest.agents-core.config.ts"); + expect(configs).toContain("test/vitest/vitest.extension-telegram.config.ts"); + } finally { + vi.unstubAllEnvs(); + } + }); + it("keeps explicit parallel overrides ahead of the host-aware profile", () => { expect( resolveParallelFullSuiteConcurrency(