mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 23:12:54 +00:00
fix(cron): respect subagents.model in isolated cron sessions (#11474)
* fix(cron): respect subagents.model in isolated cron sessions * fix(cron): enforce model allowlist for subagents.model * Cron: fix isolated subagent model gate regressions --------- Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -6,8 +6,9 @@ import {
|
||||
inferUniqueProviderFromConfiguredModels,
|
||||
parseModelRef,
|
||||
buildModelAliasIndex,
|
||||
modelKey,
|
||||
normalizeModelSelection,
|
||||
normalizeProviderId,
|
||||
modelKey,
|
||||
resolveAllowedModelRef,
|
||||
resolveConfiguredModelRef,
|
||||
resolveModelRefFromString,
|
||||
@@ -470,3 +471,31 @@ describe("model-selection", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizeModelSelection", () => {
|
||||
it("returns trimmed string for string input", () => {
|
||||
expect(normalizeModelSelection("ollama/llama3.2:3b")).toBe("ollama/llama3.2:3b");
|
||||
});
|
||||
|
||||
it("returns undefined for empty/whitespace string", () => {
|
||||
expect(normalizeModelSelection("")).toBeUndefined();
|
||||
expect(normalizeModelSelection(" ")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("extracts primary from object", () => {
|
||||
expect(normalizeModelSelection({ primary: "google/gemini-2.5-flash" })).toBe(
|
||||
"google/gemini-2.5-flash",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns undefined for object without primary", () => {
|
||||
expect(normalizeModelSelection({ fallbacks: ["a"] })).toBeUndefined();
|
||||
expect(normalizeModelSelection({})).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns undefined for null/undefined/number", () => {
|
||||
expect(normalizeModelSelection(undefined)).toBeUndefined();
|
||||
expect(normalizeModelSelection(null)).toBeUndefined();
|
||||
expect(normalizeModelSelection(42)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user