fix(test-planner): shrink local extension batches on constrained hosts

This commit is contained in:
Tak Hoffman 2026-03-27 01:58:58 -05:00
parent cfddce4196
commit 6f92148da9
No known key found for this signature in database
2 changed files with 37 additions and 1 deletions

View File

@ -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 = {

View File

@ -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",