perf(test): avoid bundled channel fallback in model override tests

This commit is contained in:
Peter Steinberger
2026-04-22 06:57:59 +01:00
parent 4d6756d45d
commit b24d153f23
3 changed files with 11 additions and 9 deletions

View File

@@ -1,12 +1,13 @@
import { beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
import { createTestRegistry } from "../test-utils/channel-plugins.js";
import { createSessionConversationTestRegistry } from "../test-utils/session-conversation-registry.js";
import { resolveChannelModelOverride } from "./model-overrides.js";
describe("resolveChannelModelOverride", () => {
beforeEach(() => {
resetPluginRuntimeStateForTest();
setActivePluginRegistry(createSessionConversationTestRegistry());
});

View File

@@ -68,15 +68,15 @@ function buildChannelCandidates(
normalizeMessageChannel(params.channel ?? "") ??
normalizeOptionalLowercaseString(params.channel);
const groupId = normalizeOptionalString(params.groupId);
const sessionConversation = resolveSessionConversationRef(params.parentSessionKey);
const rawParentConversation = parseRawSessionConversationRef(params.parentSessionKey);
const channelPlugin = normalizedChannel ? getChannelPlugin(normalizedChannel) : undefined;
const parentOverrideFallbacks =
(normalizedChannel
? getChannelPlugin(
normalizedChannel,
)?.conversationBindings?.buildModelOverrideParentCandidates?.({
parentConversationId: sessionConversation?.rawId,
})
: null) ?? [];
channelPlugin?.conversationBindings?.buildModelOverrideParentCandidates?.({
parentConversationId: rawParentConversation?.rawId,
}) ?? [];
const sessionConversation = resolveSessionConversationRef(params.parentSessionKey, {
bundledFallback: parentOverrideFallbacks.length === 0,
});
const groupConversationKind =
normalizeChatType(params.groupChatType ?? undefined) === "channel"
? "channel"

View File

@@ -54,6 +54,7 @@ function resolveMatrixSingleAccountPromotionTarget(params: {
}
beforeEach(() => {
resetPluginRuntimeStateForTest();
setActivePluginRegistry(
createTestRegistry([
{