mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 03:32:54 +00:00
* refactor: unify OpenAI provider identity * refactor: move legacy oauth sidecar doctor helpers * test: align OpenAI fixtures after rebase * test: clean OpenAI provider unification * fix: finish OpenAI provider cleanup * fix: finish OpenAI cleanup follow-through * fix: finish OpenAI CI cleanup
111 lines
2.7 KiB
TypeScript
111 lines
2.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";
|
|
import { validateConfigObjectWithPlugins } from "./validation.js";
|
|
|
|
function createModelSuppressionRegistry(): PluginManifestRegistry {
|
|
return {
|
|
diagnostics: [],
|
|
plugins: [
|
|
{
|
|
id: "openai",
|
|
origin: "bundled",
|
|
channels: [],
|
|
providers: ["openai", "openai"],
|
|
contracts: {},
|
|
cliBackends: [],
|
|
skills: [],
|
|
hooks: [],
|
|
rootDir: "/tmp/plugins/openai",
|
|
source: "test",
|
|
manifestPath: "/tmp/plugins/openai/openclaw.plugin.json",
|
|
modelCatalog: {
|
|
suppressions: [
|
|
{
|
|
provider: "openai",
|
|
model: "gpt-5.3-codex-spark",
|
|
reason:
|
|
"gpt-5.3-codex-spark is no longer exposed by the OpenAI or Codex catalogs. Use openai/gpt-5.5.",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
};
|
|
}
|
|
|
|
describe("config model reference validation", () => {
|
|
it("rejects statically suppressed provider/model pairs during config validation", () => {
|
|
const res = validateConfigObjectWithPlugins(
|
|
{
|
|
agents: {
|
|
defaults: {
|
|
model: {
|
|
primary: "openai/gpt-5.3-codex-spark",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
pluginMetadataSnapshot: {
|
|
manifestRegistry: createModelSuppressionRegistry(),
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(res.ok).toBe(false);
|
|
if (res.ok) {
|
|
return;
|
|
}
|
|
expect(res.issues).toEqual([
|
|
{
|
|
path: "agents.defaults.model.primary",
|
|
message:
|
|
"Unknown model: openai/gpt-5.3-codex-spark. gpt-5.3-codex-spark is no longer exposed by the OpenAI or Codex catalogs. Use openai/gpt-5.5.",
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("accepts supported openai provider/model pairs", () => {
|
|
const res = validateConfigObjectWithPlugins(
|
|
{
|
|
agents: {
|
|
defaults: {
|
|
model: {
|
|
primary: "openai/gpt-5.4-mini",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
pluginMetadataSnapshot: {
|
|
manifestRegistry: createModelSuppressionRegistry(),
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(res.ok).toBe(true);
|
|
});
|
|
|
|
it("accepts available openai fallback model pairs", () => {
|
|
const res = validateConfigObjectWithPlugins(
|
|
{
|
|
agents: {
|
|
defaults: {
|
|
model: {
|
|
primary: "openai/gpt-5.4-mini",
|
|
fallbacks: ["openai/gpt-5.2-codex", "openai/gpt-5.3-codex"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
pluginMetadataSnapshot: {
|
|
manifestRegistry: createModelSuppressionRegistry(),
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(res.ok).toBe(true);
|
|
});
|
|
});
|