惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
GbyAI
GbyAI
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 叶小钗
A
About on SuperTechFans
M
MIT News - Artificial intelligence
宝玉的分享
宝玉的分享
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Martin Fowler
Martin Fowler
Google DeepMind News
Google DeepMind News
博客园 - Franky
B
Blog RSS Feed
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(channels): cache selected channel registry lookups · ...
samzong · 2026-05-11 · via Recent Commits to openclaw:main

@@ -2,12 +2,16 @@ import { afterEach, describe, expect, it } from "vitest";

22

import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";

33

import {

44

pinActivePluginChannelRegistry,

5+

getActivePluginChannelRegistryVersion,

56

resetPluginRuntimeStateForTest,

67

setActivePluginRegistry,

78

} from "../plugins/runtime.js";

9+

import { createTestRegistry } from "../test-utils/channel-plugins.js";

810

import { listChatChannels } from "./chat-meta.js";

11+

import { normalizeAnyChannelId as normalizeAnyChannelIdLight } from "./registry-normalize.js";

912

import {

1013

formatChannelSelectionLine,

14+

getRegisteredChannelPluginMeta,

1115

listRegisteredChannelPluginIds,

1216

normalizeAnyChannelId,

1317

} from "./registry.js";

@@ -32,6 +36,16 @@ describe("channel registry helpers", () => {

3236

return label ?? path ?? "";

3337

}

343839+

function createRegistryWithRegisteredChannel(id: string, aliases: string[] = []) {

40+

return createTestRegistry([

41+

{

42+

pluginId: id,

43+

plugin: { id, meta: { aliases } },

44+

source: "test",

45+

},

46+

]);

47+

}

48+3549

it("keeps Feishu first in the current default order", () => {

3650

const channels = listChatChannels();

3751

expect(channels[0]?.id).toBe("feishu");

@@ -53,47 +67,62 @@ describe("channel registry helpers", () => {

5367

});

54685569

it("prefers the pinned channel registry when resolving registered plugin channels", () => {

56-

const startupRegistry = createEmptyPluginRegistry();

57-

startupRegistry.channels = [

58-

{

59-

pluginId: "openclaw-weixin",

60-

plugin: { id: "openclaw-weixin", meta: { aliases: ["weixin"] } },

61-

source: "test",

62-

},

63-

] as never;

70+

const startupRegistry = createRegistryWithRegisteredChannel("openclaw-weixin", ["weixin"]);

6471

setActivePluginRegistry(startupRegistry);

6572

pinActivePluginChannelRegistry(startupRegistry);

667367-

const replacementRegistry = createEmptyPluginRegistry();

68-

replacementRegistry.channels = [

69-

{

70-

pluginId: "qqbot",

71-

plugin: { id: "qqbot", meta: { aliases: ["qq"] } },

72-

source: "test",

73-

},

74-

] as never;

74+

const replacementRegistry = createRegistryWithRegisteredChannel("qqbot", ["qq"]);

7575

setActivePluginRegistry(replacementRegistry);

76767777

expect(listRegisteredChannelPluginIds()).toEqual(["openclaw-weixin"]);

7878

expect(normalizeAnyChannelId("weixin")).toBe("openclaw-weixin");

79+

expect(getRegisteredChannelPluginMeta("OPENCLAW-WEIXIN")?.aliases).toEqual(["weixin"]);

7980

});

80818182

it("falls back to the active registry when the pinned channel registry has no channels", () => {

8283

const startupRegistry = createEmptyPluginRegistry();

8384

setActivePluginRegistry(startupRegistry);

8485

pinActivePluginChannelRegistry(startupRegistry);

858686-

const replacementRegistry = createEmptyPluginRegistry();

87-

replacementRegistry.channels = [

88-

{

89-

pluginId: "qqbot",

90-

plugin: { id: "qqbot", meta: { aliases: ["qq"] } },

91-

source: "test",

92-

},

93-

] as never;

87+

const replacementRegistry = createRegistryWithRegisteredChannel("qqbot", ["qq"]);

9488

setActivePluginRegistry(replacementRegistry);

95899690

expect(listRegisteredChannelPluginIds()).toEqual(["qqbot"]);

9791

expect(normalizeAnyChannelId("qq")).toBe("qqbot");

9892

});

93+94+

it("rebuilds registered channel lookups when pinned-empty fallback active registry changes", () => {

95+

const startupRegistry = createEmptyPluginRegistry();

96+

setActivePluginRegistry(startupRegistry);

97+

pinActivePluginChannelRegistry(startupRegistry);

98+99+

const alphaRegistry = createRegistryWithRegisteredChannel("alpha", ["a"]);

100+

setActivePluginRegistry(alphaRegistry);

101+102+

const channelVersion = getActivePluginChannelRegistryVersion();

103+

expect(normalizeAnyChannelId("a")).toBe("alpha");

104+

expect(normalizeAnyChannelIdLight("a")).toBe("alpha");

105+106+

const betaRegistry = createRegistryWithRegisteredChannel("beta", ["b"]);

107+

setActivePluginRegistry(betaRegistry);

108+109+

expect(getActivePluginChannelRegistryVersion()).not.toBe(channelVersion);

110+

expect(normalizeAnyChannelId("a")).toBeNull();

111+

expect(normalizeAnyChannelId("b")).toBe("beta");

112+

expect(normalizeAnyChannelIdLight("a")).toBeNull();

113+

expect(normalizeAnyChannelIdLight("b")).toBe("beta");

114+

});

115+116+

it("refreshes registered channel lookups when selected registry channels grow in place", () => {

117+

const registry = createEmptyPluginRegistry();

118+

setActivePluginRegistry(registry);

119+120+

expect(normalizeAnyChannelId("a")).toBeNull();

121+

expect(normalizeAnyChannelIdLight("a")).toBeNull();

122+123+

registry.channels.push(createRegistryWithRegisteredChannel("alpha", ["a"]).channels[0]);

124+125+

expect(normalizeAnyChannelId("a")).toBe("alpha");

126+

expect(normalizeAnyChannelIdLight("a")).toBe("alpha");

127+

});

99128

});