fix(test): repair main CI drift

This commit is contained in:
Peter Steinberger
2026-03-22 22:12:00 +00:00
parent 030e950e5f
commit 91cd38f4d4
5 changed files with 34 additions and 24 deletions

View File

@@ -254,7 +254,6 @@ Docs: https://docs.openclaw.ai
- Discord/ACP: forward worker abort signals into ACP turns so timed-out Discord jobs cancel the running turn instead of silently leaving the bound ACP session working in the background.
- Gateway/openresponses: preserve assistant commentary and session continuity across hosted-tool `/v1/responses` turns, and emit streamed tool-call payloads before finalization so client tool loops stay resumable. (#52171) Thanks @CharZhou.
- Android/Talk: serialize `TalkModeManager` player teardown so rapid interrupt/restart cycles stop double-releasing or overlapping TTS playback. (#52310) Thanks @Kaneki-x.
<<<<<<< HEAD
- WhatsApp/reconnect: preserve the last inbound timestamp across reconnect attempts so the watchdog can still recycle linked-but-dead listeners after a restart instead of leaving them stuck connected forever.
- Gateway/network discovery: guard LAN, tailnet, and pairing interface enumeration so WSL2 and restricted hosts degrade to missing-address fallbacks instead of crashing on `uv_interface_addresses` errors. (#44180, #47590)
- Gateway/bonjour: suppress the non-fatal `@homebridge/ciao` IPv4-loss assertion during interface churn so WiFi/VPN/sleep-wake changes no longer take down the gateway. (#38628, #47159, #52431)

View File

@@ -27,12 +27,15 @@ function parseTelegramTargetForTest(raw: string): {
}
function normalizeWhatsAppTargetForTest(raw: string): string | null {
const trimmed = raw.trim().replace(/^whatsapp:/i, "").trim();
const trimmed = raw
.trim()
.replace(/^whatsapp:/i, "")
.trim();
if (!trimmed) {
return null;
}
const lowered = trimmed.toLowerCase();
if (/@g\.us$/u.test(lowered)) {
if (lowered.endsWith("@g.us")) {
const normalized = lowered.replace(/\s+/gu, "");
return /^\d+@g\.us$/u.test(normalized) ? normalized : null;
}
@@ -41,9 +44,7 @@ function normalizeWhatsAppTargetForTest(raw: string): string | null {
return /^\+\d{7,15}$/u.test(normalized) ? normalized : null;
}
function createWhatsAppResolveTarget(
label = "WhatsApp",
): ChannelOutboundAdapter["resolveTarget"] {
function createWhatsAppResolveTarget(label = "WhatsApp"): ChannelOutboundAdapter["resolveTarget"] {
return ({ to }) => {
const normalized = to ? normalizeWhatsAppTargetForTest(to) : null;
if (!normalized) {
@@ -133,7 +134,9 @@ export function createTelegramTestPlugin(): ChannelPlugin {
},
messaging: telegramMessagingForTest,
resolveDefaultTo: ({ cfg }) =>
typeof cfg.channels?.telegram?.defaultTo === "string" ? cfg.channels.telegram.defaultTo : undefined,
typeof cfg.channels?.telegram?.defaultTo === "string"
? cfg.channels.telegram.defaultTo
: undefined,
});
}
@@ -148,7 +151,9 @@ export function createWhatsAppTestPlugin(): ChannelPlugin {
},
messaging: whatsappMessagingForTest,
resolveDefaultTo: ({ cfg }) =>
typeof cfg.channels?.whatsapp?.defaultTo === "string" ? cfg.channels.whatsapp.defaultTo : undefined,
typeof cfg.channels?.whatsapp?.defaultTo === "string"
? cfg.channels.whatsapp.defaultTo
: undefined,
});
}

View File

@@ -18,7 +18,6 @@ import {
createTargetsTestRegistry,
createTelegramTestPlugin,
createWhatsAppTestPlugin,
telegramMessagingForTest,
} from "./targets.test-helpers.js";
runResolveOutboundTargetCoreTests();

View File

@@ -7,23 +7,31 @@ import type {
SessionBindingAdapter,
SessionBindingRecord,
} from "../infra/outbound/session-binding-service.js";
import type { PluginRegistry } from "./registry.js";
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-plugin-binding-"));
const approvalsPath = path.join(tempRoot, "plugin-binding-approvals.json");
type PluginBindingRegistryStub = {
conversationBindingResolvedHandlers: Array<{
pluginId: string;
pluginRoot?: string;
handler: (event: unknown) => void | Promise<void>;
source: string;
rootDir?: string;
}>;
};
function createEmptyPluginRegistry(): PluginBindingRegistryStub {
function createEmptyPluginRegistry(): PluginRegistry {
return {
plugins: [],
tools: [],
hooks: [],
typedHooks: [],
channels: [],
channelSetups: [],
providers: [],
speechProviders: [],
mediaUnderstandingProviders: [],
imageGenerationProviders: [],
webSearchProviders: [],
gatewayHandlers: {},
httpRoutes: [],
cliRegistrars: [],
services: [],
commands: [],
conversationBindingResolvedHandlers: [],
diagnostics: [],
};
}
@@ -98,7 +106,7 @@ const sessionBindingState = vi.hoisted(() => {
});
const pluginRuntimeState = vi.hoisted(() => ({
registry: createEmptyPluginRegistry() as PluginBindingRegistryStub,
registry: createEmptyPluginRegistry(),
}));
vi.mock("../infra/home-dir.js", async (importOriginal) => {
@@ -116,7 +124,7 @@ vi.mock("../infra/home-dir.js", async (importOriginal) => {
vi.mock("./runtime.js", () => ({
getActivePluginRegistry: () => pluginRuntimeState.registry,
setActivePluginRegistry: (registry: PluginBindingRegistryStub) => {
setActivePluginRegistry: (registry: ReturnType<typeof createEmptyPluginRegistry>) => {
pluginRuntimeState.registry = registry;
},
}));

View File

@@ -2,7 +2,6 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterAll, afterEach, describe, expect, it } from "vitest";
import packageJson from "../../package.json" with { type: "json" };
import { emitDiagnosticEvent, resetDiagnosticEventsForTest } from "../infra/diagnostic-events.js";
import { buildMemoryPromptSection, registerMemoryPromptSection } from "../memory/prompt-section.js";
import { withEnv } from "../test-utils/env.js";
@@ -814,7 +813,7 @@ describe("loadOpenClawPlugins", () => {
expect(memory?.status).toBe("loaded");
expect(memory?.origin).toBe("bundled");
expect(memory?.name).toBe("Memory (Core)");
expect(memory?.version).toBe(packageJson.version);
expect(memory?.version).toBe("1.2.3");
});
it("handles config-path and scoped plugin loads", () => {
const scenarios = [