Files
openclaw/src/agents/model-selection-cli.test.ts
Val Alexander 62ccd8b644 Fix model and tool normalization regressions
Summary:
- Fix model and tool normalization regressions, including explicit tool-policy grants for messaging profile warnings.
- Keep Codex and Microsoft Foundry auth handling compatible with aws-sdk auth profile modes after rebasing onto current main.

Verification:
- pnpm test src/agents/pi-tools.policy.test.ts
- pnpm tsgo:extensions
- pnpm tsgo:extensions:test
- pnpm test extensions/codex/src/app-server/auth-bridge.test.ts extensions/microsoft-foundry/index.test.ts
- pnpm test:extensions:package-boundary
- pnpm lint --threads=8
- git diff --check
- GitHub PR checks green on 4ad136106b
2026-05-07 02:29:28 -05:00

36 lines
1.2 KiB
TypeScript

import { afterEach, beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/types.js";
import { __testing as setupRegistryRuntimeTesting } from "../plugins/setup-registry.runtime.js";
import { isCliProvider } from "./model-selection-cli.js";
describe("isCliProvider", () => {
beforeEach(() => {
setupRegistryRuntimeTesting.resetRuntimeState();
setupRegistryRuntimeTesting.setRuntimeModuleForTest({
resolvePluginSetupCliBackend: ({ backend }) =>
backend === "claude-cli"
? {
pluginId: "anthropic",
backend: { id: "claude-cli", config: { command: "claude" } },
}
: undefined,
});
});
afterEach(() => {
setupRegistryRuntimeTesting.resetRuntimeState();
});
it("returns true for setup-registered cli backends", () => {
expect(isCliProvider("claude-cli", {} as OpenClawConfig)).toBe(true);
});
it("accepts the anthropic-cli auth-choice id as a Claude CLI provider alias", () => {
expect(isCliProvider("anthropic-cli", {} as OpenClawConfig)).toBe(true);
});
it("returns false for provider ids", () => {
expect(isCliProvider("example-cli", {} as OpenClawConfig)).toBe(false);
});
});