Gateway tests: accept allowlisted refs absent from catalog

This commit is contained in:
Vincent Koc
2026-02-24 19:08:04 -05:00
parent f34325ec01
commit f7cf3d0dad

View File

@@ -243,6 +243,38 @@ describe("gateway sessions patch", () => {
expect(res.entry.modelOverride).toBe("claude-sonnet-4-6");
});
test("accepts explicit allowlisted refs absent from bundled catalog", async () => {
const store: Record<string, SessionEntry> = {};
const cfg = {
agents: {
defaults: {
model: { primary: "openai/gpt-5.2" },
models: {
"anthropic/claude-sonnet-4-6": { alias: "sonnet" },
},
},
},
} as OpenClawConfig;
const res = await applySessionsPatchToStore({
cfg,
store,
storeKey: "agent:main:main",
patch: { key: "agent:main:main", model: "anthropic/claude-sonnet-4-6" },
loadGatewayModelCatalog: async () => [
{ provider: "anthropic", id: "claude-sonnet-4-5", name: "Claude Sonnet 4.5" },
{ provider: "openai", id: "gpt-5.2", name: "GPT-5.2" },
],
});
expect(res.ok).toBe(true);
if (!res.ok) {
return;
}
expect(res.entry.providerOverride).toBe("anthropic");
expect(res.entry.modelOverride).toBe("claude-sonnet-4-6");
});
test("sets spawnDepth for subagent sessions", async () => {
const store: Record<string, SessionEntry> = {};
const res = await applySessionsPatchToStore({