mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 09:52:13 +00:00
Validates forced plugin harness support for the requested provider/model before pinning Codex or any other plugin harness. This prevents an explicitly forced Codex runtime from accepting unsupported OpenAI-like providers through a hardcoded bypass while preserving implicit PI fallback and CLI runtime alias passthrough. Regression coverage covers forced Codex rejection for unsupported openai/openai-codex support, Codex provider support declarations, CLI attempt routing, pi-embedded auth/profile forwarding fakes, Testbox scenario probes, and live Docker Codex plugin E2E. Thanks @cathrynlavery.
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
|
|
describe("Codex agent harness supports()", () => {
|
|
const harness = createCodexAppServerAgentHarness();
|
|
|
|
it("supports the canonical codex virtual provider", () => {
|
|
expect(harness.supports({ provider: "codex", requestedRuntime: "codex" })).toEqual({
|
|
supported: true,
|
|
priority: 100,
|
|
});
|
|
});
|
|
|
|
it("supports openai-codex as the primary OpenClaw routing id", () => {
|
|
expect(harness.supports({ provider: "openai-codex", requestedRuntime: "codex" })).toEqual({
|
|
supported: true,
|
|
priority: 100,
|
|
});
|
|
});
|
|
|
|
it("supports the canonical openai routing id (documented Codex path)", () => {
|
|
expect(harness.supports({ provider: "openai", requestedRuntime: "codex" })).toEqual({
|
|
supported: true,
|
|
priority: 100,
|
|
});
|
|
});
|
|
|
|
it("rejects providers Codex app-server cannot resolve from its own config", () => {
|
|
const result = harness.supports({ provider: "9router", requestedRuntime: "codex" });
|
|
expect(result.supported).toBe(false);
|
|
expect(!result.supported ? (result.reason ?? "") : "").toContain("codex");
|
|
});
|
|
|
|
it("normalizes provider casing", () => {
|
|
expect(harness.supports({ provider: "OpenAI-Codex", requestedRuntime: "codex" })).toEqual({
|
|
supported: true,
|
|
priority: 100,
|
|
});
|
|
});
|
|
|
|
it("honors explicit provider id overrides", () => {
|
|
const narrowHarness = createCodexAppServerAgentHarness({ providerIds: ["codex"] });
|
|
const result = narrowHarness.supports({ provider: "openai", requestedRuntime: "codex" });
|
|
expect(result.supported).toBe(false);
|
|
});
|
|
});
|