mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 08:50:21 +00:00
fix(models): keep codex spark codex-only
This commit is contained in:
@@ -347,5 +347,55 @@ describe("modelsListCommand forward-compat", () => {
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("suppresses direct openai gpt-5.3-codex-spark rows in --all output", async () => {
|
||||
mocks.resolveConfiguredEntries.mockReturnValueOnce({ entries: [] });
|
||||
mocks.loadModelRegistry.mockResolvedValueOnce({
|
||||
models: [
|
||||
{
|
||||
provider: "openai",
|
||||
id: "gpt-5.3-codex-spark",
|
||||
name: "GPT-5.3 Codex Spark",
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
input: ["text", "image"],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 32000,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
{
|
||||
provider: "azure-openai-responses",
|
||||
id: "gpt-5.3-codex-spark",
|
||||
name: "GPT-5.3 Codex Spark",
|
||||
api: "azure-openai-responses",
|
||||
baseUrl: "https://example.openai.azure.com/openai/v1",
|
||||
input: ["text", "image"],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 32000,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
{ ...OPENAI_CODEX_53_MODEL },
|
||||
],
|
||||
availableKeys: new Set([
|
||||
"openai/gpt-5.3-codex-spark",
|
||||
"azure-openai-responses/gpt-5.3-codex-spark",
|
||||
"openai-codex/gpt-5.3-codex",
|
||||
]),
|
||||
registry: {
|
||||
getAll: () => [{ ...OPENAI_CODEX_53_MODEL }],
|
||||
},
|
||||
});
|
||||
mocks.loadModelCatalog.mockResolvedValueOnce([]);
|
||||
const runtime = createRuntime();
|
||||
|
||||
await modelsListCommand({ all: true, json: true }, runtime as never);
|
||||
|
||||
expect(mocks.printModelTable).toHaveBeenCalled();
|
||||
expect(lastPrintedRows<{ key: string }>()).toEqual([
|
||||
expect.objectContaining({
|
||||
key: "openai-codex/gpt-5.3-codex",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
resolveAwsSdkEnvVarName,
|
||||
resolveEnvApiKey,
|
||||
} from "../../agents/model-auth.js";
|
||||
import { shouldSuppressBuiltInModel } from "../../agents/model-suppression.js";
|
||||
import { discoverAuthStorage, discoverModels } from "../../agents/pi-model-discovery.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import {
|
||||
@@ -87,7 +88,9 @@ function loadAvailableModels(registry: ModelRegistry): Model<Api>[] {
|
||||
throw normalizeAvailabilityError(err);
|
||||
}
|
||||
try {
|
||||
return validateAvailableModels(availableModels);
|
||||
return validateAvailableModels(availableModels).filter(
|
||||
(model) => !shouldSuppressBuiltInModel({ provider: model.provider, id: model.id }),
|
||||
);
|
||||
} catch (err) {
|
||||
throw normalizeAvailabilityError(err);
|
||||
}
|
||||
@@ -100,7 +103,9 @@ export async function loadModelRegistry(
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const registry = discoverModels(authStorage, agentDir);
|
||||
const models = registry.getAll();
|
||||
const models = registry
|
||||
.getAll()
|
||||
.filter((model) => !shouldSuppressBuiltInModel({ provider: model.provider, id: model.id }));
|
||||
let availableKeys: Set<string> | undefined;
|
||||
let availabilityErrorMessage: string | undefined;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import type { ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
|
||||
import { loadModelCatalog } from "../../agents/model-catalog.js";
|
||||
import { shouldSuppressBuiltInModel } from "../../agents/model-suppression.js";
|
||||
import { resolveModelWithRegistry } from "../../agents/pi-embedded-runner/model.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { loadModelRegistry, toModelRow } from "./list.registry.js";
|
||||
@@ -79,6 +80,9 @@ export function appendDiscoveredRows(params: {
|
||||
});
|
||||
|
||||
for (const model of sorted) {
|
||||
if (shouldSuppressBuiltInModel({ provider: model.provider, id: model.id })) {
|
||||
continue;
|
||||
}
|
||||
if (!matchesRowFilter(params.context.filter, model)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user