diff --git a/scripts/test-planner/runtime-profile.mjs b/scripts/test-planner/runtime-profile.mjs index 79977570f4d..4b33d111e95 100644 --- a/scripts/test-planner/runtime-profile.mjs +++ b/scripts/test-planner/runtime-profile.mjs @@ -104,6 +104,7 @@ const LOCAL_MEMORY_BUDGETS = { memoryHeavyFileLimit: 8, unitFastBatchTargetMs: 10_000, channelsBatchTargetMs: 0, + extensionsBatchTargetMs: 60_000, }, moderate: { vitestCap: 3, @@ -121,6 +122,7 @@ const LOCAL_MEMORY_BUDGETS = { memoryHeavyFileLimit: 12, unitFastBatchTargetMs: 15_000, channelsBatchTargetMs: 0, + extensionsBatchTargetMs: 120_000, }, mid: { vitestCap: 4, @@ -138,6 +140,7 @@ const LOCAL_MEMORY_BUDGETS = { memoryHeavyFileLimit: 16, unitFastBatchTargetMs: 0, channelsBatchTargetMs: 0, + extensionsBatchTargetMs: 180_000, }, high: { vitestCap: 6, @@ -155,6 +158,7 @@ const LOCAL_MEMORY_BUDGETS = { memoryHeavyFileLimit: 16, unitFastBatchTargetMs: 45_000, channelsBatchTargetMs: 30_000, + extensionsBatchTargetMs: 300_000, }, }; @@ -313,7 +317,7 @@ export function resolveExecutionBudget(runtimeCapabilities) { unitFastLaneCount: 1, unitFastBatchTargetMs: bandBudget.unitFastBatchTargetMs, channelsBatchTargetMs: bandBudget.channelsBatchTargetMs ?? 0, - extensionsBatchTargetMs: 300_000, + extensionsBatchTargetMs: bandBudget.extensionsBatchTargetMs ?? 300_000, }; const loadAdjustedBudget = { diff --git a/test/scripts/test-planner.test.ts b/test/scripts/test-planner.test.ts index 526b220e06f..99fd6a0f2fa 100644 --- a/test/scripts/test-planner.test.ts +++ b/test/scripts/test-planner.test.ts @@ -50,6 +50,38 @@ describe("test planner", () => { artifacts.cleanupTempArtifacts(); }); + it("uses smaller shared extension batches on constrained local hosts", () => { + const env = { + RUNNER_OS: "macOS", + OPENCLAW_TEST_HOST_CPU_COUNT: "8", + OPENCLAW_TEST_HOST_MEMORY_GIB: "16", + OPENCLAW_TEST_LOAD_AWARE: "0", + }; + const artifacts = createExecutionArtifacts(env); + const plan = buildExecutionPlan( + { + profile: null, + mode: "local", + surfaces: ["extensions"], + passthroughArgs: [], + }, + { + env, + platform: "darwin", + writeTempJsonArtifact: artifacts.writeTempJsonArtifact, + }, + ); + + const sharedExtensionBatches = plan.selectedUnits.filter((unit) => + unit.id.startsWith("extensions-batch-"), + ); + + expect(plan.runtimeCapabilities.memoryBand).toBe("constrained"); + expect(plan.executionBudget.extensionsBatchTargetMs).toBe(60_000); + expect(sharedExtensionBatches.length).toBeGreaterThan(3); + artifacts.cleanupTempArtifacts(); + }); + it("scales down mid-tier local concurrency under saturated load", () => { const artifacts = createExecutionArtifacts({ RUNNER_OS: "Linux",