QA: keep explicit Matrix model overrides lazy

Avoid loading the qa-lab runtime model-default seam when the Matrix runner was
already given both primary and alternate model refs explicitly.

Behavior stays the same, but the helper becomes easier to read and avoids an
unnecessary runtime dependency on the fully-explicit path.
This commit is contained in:
Gustavo Madeira Santana
2026-04-14 13:11:47 -04:00
parent 5f418609aa
commit ff0cb40712
2 changed files with 13 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ describe("matrix qa model selection", () => {
primaryModel: "custom-primary",
alternateModel: "custom-alt",
});
expect(loadQaLabRuntimeModule).not.toHaveBeenCalled();
expect(defaultQaRuntimeModelForMode).not.toHaveBeenCalled();
});
});

View File

@@ -13,14 +13,21 @@ export function resolveMatrixQaModels(params: {
alternateModel?: string;
}): ResolvedMatrixQaModels {
const providerMode = normalizeQaProviderMode(params.providerMode ?? "live-frontier");
const primaryModel = params.primaryModel?.trim();
const alternateModel = params.alternateModel?.trim();
if (primaryModel && alternateModel) {
return {
providerMode,
primaryModel,
alternateModel,
};
}
const qaLabRuntime = loadQaLabRuntimeModule();
return {
providerMode,
primaryModel:
params.primaryModel?.trim() ||
qaLabRuntime.defaultQaRuntimeModelForMode(providerMode),
primaryModel: primaryModel || qaLabRuntime.defaultQaRuntimeModelForMode(providerMode),
alternateModel:
params.alternateModel?.trim() ||
qaLabRuntime.defaultQaRuntimeModelForMode(providerMode, { alternate: true }),
alternateModel || qaLabRuntime.defaultQaRuntimeModelForMode(providerMode, { alternate: true }),
};
}