diff --git a/src/agents/model-selection.plugin-runtime.test.ts b/src/agents/model-selection.plugin-runtime.test.ts index b334fd2d21b..99f1f69b67b 100644 --- a/src/agents/model-selection.plugin-runtime.test.ts +++ b/src/agents/model-selection.plugin-runtime.test.ts @@ -1,12 +1,32 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; const normalizeProviderModelIdWithPluginMock = vi.fn(); +const emptyPluginMetadataSnapshot = vi.hoisted(() => ({ + configFingerprint: "model-selection-plugin-runtime-test-empty-plugin-metadata", + plugins: [ + { + modelIdNormalization: { + providers: { + google: { + aliases: { + "gemini-3.1-pro": "gemini-3.1-pro-preview", + }, + }, + }, + }, + }, + ], +})); vi.mock("./provider-model-normalization.runtime.js", () => ({ normalizeProviderModelIdWithRuntime: (params: unknown) => normalizeProviderModelIdWithPluginMock(params), })); +vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ + getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot, +})); + describe("model-selection plugin runtime normalization", () => { beforeEach(() => { vi.resetModules(); diff --git a/src/commands/models/list.configured.test.ts b/src/commands/models/list.configured.test.ts index 45cb21c9461..5c80b337d52 100644 --- a/src/commands/models/list.configured.test.ts +++ b/src/commands/models/list.configured.test.ts @@ -1,11 +1,20 @@ import { describe, expect, it, vi } from "vitest"; +const emptyPluginMetadataSnapshot = vi.hoisted(() => ({ + configFingerprint: "models-list-configured-test-empty-plugin-metadata", + plugins: [], +})); + vi.mock("../../agents/provider-model-normalization.runtime.js", () => ({ normalizeProviderModelIdWithRuntime: vi.fn(() => { throw new Error("runtime model normalization should not load for models list entries"); }), })); +vi.mock("../../plugins/current-plugin-metadata-snapshot.js", () => ({ + getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot, +})); + import { resolveConfiguredEntries } from "./list.configured.js"; describe("resolveConfiguredEntries", () => { diff --git a/src/gateway/session-utils.plugin-runtime.test.ts b/src/gateway/session-utils.plugin-runtime.test.ts index 24188800f2b..ba9c345c74e 100644 --- a/src/gateway/session-utils.plugin-runtime.test.ts +++ b/src/gateway/session-utils.plugin-runtime.test.ts @@ -3,12 +3,20 @@ import type { OpenClawConfig } from "../config/config.js"; import type { SessionEntry } from "../config/sessions.js"; const normalizeProviderModelIdWithPluginMock = vi.fn(); +const emptyPluginMetadataSnapshot = vi.hoisted(() => ({ + configFingerprint: "gateway-session-utils-plugin-runtime-test-empty-plugin-metadata", + plugins: [], +})); vi.mock("../agents/provider-model-normalization.runtime.js", () => ({ normalizeProviderModelIdWithRuntime: (params: unknown) => normalizeProviderModelIdWithPluginMock(params), })); +vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ + getCurrentPluginMetadataSnapshot: () => emptyPluginMetadataSnapshot, +})); + describe("gateway session list plugin runtime normalization", () => { beforeEach(() => { vi.resetModules();