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

推荐订阅源

H
Help Net Security
月光博客
月光博客
IT之家
IT之家
B
Blog RSS Feed
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
博客园_首页
B
Blog
V
V2EX
腾讯CDC
Vercel News
Vercel News
量子位
Microsoft Security Blog
Microsoft Security Blog

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
test: tighten model catalog assertions · openclaw/opencla...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -105,6 +105,45 @@ function emptyPluginMetadataSnapshot() {

105105

};

106106

}

107107108+

type ModelCatalogEntry = Awaited<

109+

ReturnType<typeof import("./model-catalog.js").loadModelCatalog>

110+

>[number];

111+112+

function findCatalogEntry(

113+

entries: readonly ModelCatalogEntry[],

114+

provider: string,

115+

id: string,

116+

): ModelCatalogEntry | undefined {

117+

return entries.find((entry) => entry.provider === provider && entry.id === id);

118+

}

119+120+

function requireCatalogEntry(

121+

entries: readonly ModelCatalogEntry[],

122+

provider: string,

123+

id: string,

124+

): ModelCatalogEntry {

125+

const entry = findCatalogEntry(entries, provider, id);

126+

if (!entry) {

127+

throw new Error(`expected catalog entry ${provider}/${id}`);

128+

}

129+

return entry;

130+

}

131+132+

function expectNoCatalogEntry(entries: readonly ModelCatalogEntry[], provider: string, id: string) {

133+

expect(findCatalogEntry(entries, provider, id)).toBeUndefined();

134+

}

135+136+

function requireMockCallParam(

137+

mock: ReturnType<typeof vi.fn>,

138+

label: string,

139+

): Record<string, unknown> {

140+

const first = mock.mock.calls[0]?.[0];

141+

if (!first || typeof first !== "object" || Array.isArray(first)) {

142+

throw new Error(`expected ${label}`);

143+

}

144+

return first as Record<string, unknown>;

145+

}

146+108147

describe("loadModelCatalog", () => {

109148

beforeAll(async () => {

110149

readFileMock = vi.fn();

@@ -278,9 +317,8 @@ describe("loadModelCatalog", () => {

278317

readOnly: true,

279318

});

280319281-

expect(result).toContainEqual(

282-

expect.objectContaining({ id: "gpt-test", name: "GPT Test", provider: "openai" }),

283-

);

320+

const entry = requireCatalogEntry(result, "openai", "gpt-test");

321+

expect(entry.name).toBe("GPT Test");

284322

expect(ensureOpenClawModelsJsonMock).not.toHaveBeenCalled();

285323

expect(importPiSdk).not.toHaveBeenCalled();

286324

expect(loadPluginMetadataSnapshotMock).not.toHaveBeenCalled();

@@ -484,19 +522,9 @@ describe("loadModelCatalog", () => {

484522

]);

485523486524

const result = await loadModelCatalog({ config: {} as OpenClawConfig });

487-

expect(result).not.toContainEqual(

488-

expect.objectContaining({

489-

provider: "openai-codex",

490-

id: "gpt-5.3-codex-spark",

491-

}),

492-

);

493-

expect(result).toContainEqual(

494-

expect.objectContaining({

495-

provider: "openai-codex",

496-

id: "gpt-5.4",

497-

name: "GPT-5.3 Codex",

498-

}),

499-

);

525+

expectNoCatalogEntry(result, "openai-codex", "gpt-5.3-codex-spark");

526+

const entry = requireCatalogEntry(result, "openai-codex", "gpt-5.4");

527+

expect(entry.name).toBe("GPT-5.3 Codex");

500528

});

501529502530

it("filters stale gpt-5.3-codex-spark built-ins from the catalog", async () => {

@@ -528,24 +556,9 @@ describe("loadModelCatalog", () => {

528556

]);

529557530558

const result = await loadModelCatalog({ config: {} as OpenClawConfig });

531-

expect(result).not.toContainEqual(

532-

expect.objectContaining({

533-

provider: "openai",

534-

id: "gpt-5.3-codex-spark",

535-

}),

536-

);

537-

expect(result).not.toContainEqual(

538-

expect.objectContaining({

539-

provider: "azure-openai-responses",

540-

id: "gpt-5.3-codex-spark",

541-

}),

542-

);

543-

expect(result).not.toContainEqual(

544-

expect.objectContaining({

545-

provider: "openai-codex",

546-

id: "gpt-5.3-codex-spark",

547-

}),

548-

);

559+

expectNoCatalogEntry(result, "openai", "gpt-5.3-codex-spark");

560+

expectNoCatalogEntry(result, "azure-openai-responses", "gpt-5.3-codex-spark");

561+

expectNoCatalogEntry(result, "openai-codex", "gpt-5.3-codex-spark");

549562

});

550563551564

it("filters stale openai-codex 5.1/5.2/5.3 built-ins from the catalog", async () => {

@@ -585,18 +598,10 @@ describe("loadModelCatalog", () => {

585598

]);

586599587600

const result = await loadModelCatalog({ config: {} as OpenClawConfig });

588-

expect(result).not.toContainEqual(

589-

expect.objectContaining({ provider: "openai-codex", id: "gpt-5.1-codex-mini" }),

590-

);

591-

expect(result).not.toContainEqual(

592-

expect.objectContaining({ provider: "openai-codex", id: "gpt-5.2-codex" }),

593-

);

594-

expect(result).not.toContainEqual(

595-

expect.objectContaining({ provider: "openai-codex", id: "gpt-5.3-codex" }),

596-

);

597-

expect(result).toContainEqual(

598-

expect.objectContaining({ provider: "openai-codex", id: "gpt-5.5" }),

599-

);

601+

expectNoCatalogEntry(result, "openai-codex", "gpt-5.1-codex-mini");

602+

expectNoCatalogEntry(result, "openai-codex", "gpt-5.2-codex");

603+

expectNoCatalogEntry(result, "openai-codex", "gpt-5.3-codex");

604+

expect(requireCatalogEntry(result, "openai-codex", "gpt-5.5").name).toBe("GPT-5.5");

600605

});

601606602607

it("does not synthesize gpt-5.4 OpenAI forward-compat entries from template models", async () => {

@@ -648,13 +653,8 @@ describe("loadModelCatalog", () => {

648653

expect(

649654

result.some((entry) => entry.provider === "openai" && entry.id.startsWith("gpt-5.4")),

650655

).toBe(false);

651-

expect(result).toContainEqual(

652-

expect.objectContaining({

653-

provider: "openai-codex",

654-

id: "gpt-5.4",

655-

name: "GPT-5.3 Codex",

656-

}),

657-

);

656+

const entry = requireCatalogEntry(result, "openai-codex", "gpt-5.4");

657+

expect(entry.name).toBe("GPT-5.3 Codex");

658658

expect(

659659

result.some((entry) => entry.provider === "openai-codex" && entry.id === "gpt-5.4-mini"),

660660

).toBe(false);

@@ -675,13 +675,8 @@ describe("loadModelCatalog", () => {

675675676676

const result = await loadModelCatalog({ config: {} as OpenClawConfig });

677677678-

expect(result).toContainEqual(

679-

expect.objectContaining({

680-

provider: "kilocode",

681-

id: "google/gemini-3.1-pro-preview",

682-

name: "Gemini 3 Pro Preview",

683-

}),

684-

);

678+

const entry = requireCatalogEntry(result, "kilocode", "google/gemini-3.1-pro-preview");

679+

expect(entry.name).toBe("Gemini 3 Pro Preview");

685680

});

686681687682

it("loads manifest catalog rows from the current metadata snapshot without provider runtime", () => {

@@ -743,11 +738,8 @@ describe("loadModelCatalog", () => {

743738

fallbackToMetadataScan: false,

744739

});

745740746-

expect(currentPluginMetadataSnapshotMock).toHaveBeenCalledWith(

747-

expect.objectContaining({

748-

allowWorkspaceScopedSnapshot: true,

749-

}),

750-

);

741+

const call = requireMockCallParam(currentPluginMetadataSnapshotMock, "current snapshot params");

742+

expect(call.allowWorkspaceScopedSnapshot).toBe(true);

751743

expect(loadPluginMetadataSnapshotMock).not.toHaveBeenCalled();

752744

});

753745

@@ -760,12 +752,9 @@ describe("loadModelCatalog", () => {

760752

fallbackToMetadataScan: false,

761753

});

762754763-

expect(currentPluginMetadataSnapshotMock).toHaveBeenCalledWith(

764-

expect.objectContaining({

765-

env,

766-

allowWorkspaceScopedSnapshot: true,

767-

}),

768-

);

755+

const call = requireMockCallParam(currentPluginMetadataSnapshotMock, "current snapshot params");

756+

expect(call.env).toBe(env);

757+

expect(call.allowWorkspaceScopedSnapshot).toBe(true);

769758

expect(loadPluginMetadataSnapshotMock).not.toHaveBeenCalled();

770759

});

771760

@@ -789,9 +778,7 @@ describe("loadModelCatalog", () => {

789778790779

const result = await loadModelCatalog({ config: {} as OpenClawConfig });

791780792-

expect(result).toContainEqual(

793-

expect.objectContaining({ provider: "ollama", id: "llama3.2", name: "Llama 3.2" }),

794-

);

781+

expect(requireCatalogEntry(result, "ollama", "llama3.2").name).toBe("Llama 3.2");

795782

expect(

796783

result.filter((entry) => entry.provider === "openai" && entry.id === "gpt-4.1"),

797784

).toHaveLength(1);

@@ -823,16 +810,11 @@ describe("loadModelCatalog", () => {

823810

} as OpenClawConfig,

824811

});

825812826-

expect(result).toContainEqual(

827-

expect.objectContaining({

828-

provider: "modelscope",

829-

id: "Qwen/Qwen3.5-35B-A3B",

830-

name: "Qwen3.5 35B",

831-

input: ["text", "image"],

832-

reasoning: true,

833-

contextWindow: 128_000,

834-

}),

835-

);

813+

const entry = requireCatalogEntry(result, "modelscope", "Qwen/Qwen3.5-35B-A3B");

814+

expect(entry.name).toBe("Qwen3.5 35B");

815+

expect(entry.input).toEqual(["text", "image"]);

816+

expect(entry.reasoning).toBe(true);

817+

expect(entry.contextWindow).toBe(128_000);

836818

});

837819838820

it("dedupes configured models against discovered provider aliases", async () => {

@@ -863,7 +845,10 @@ describe("loadModelCatalog", () => {

863845864846

const matches = result.filter((entry) => findModelInCatalog([entry], "z-ai", "glm-5"));

865847

expect(matches).toHaveLength(1);

866-

expect(matches[0]).toMatchObject({ provider: "z.ai", id: "glm-5", name: "GLM-5" });

848+

const match = matches[0];

849+

expect(match?.provider).toBe("z.ai");

850+

expect(match?.id).toBe("glm-5");

851+

expect(match?.name).toBe("GLM-5");

867852

});

868853869854

it("does not add unrelated models when provider plugins return nothing", async () => {