mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:30:44 +00:00
test(config): cover codex plugin auto-enable boundaries
This commit is contained in:
@@ -228,6 +228,94 @@ describe("applyPluginAutoEnable core", () => {
|
||||
expect(result.changes).toContain("codex/gpt-5.4 model configured, enabled automatically.");
|
||||
});
|
||||
|
||||
it("does not auto-enable Codex when only the OpenAI plugin is explicitly enabled", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
plugins: {
|
||||
allow: ["openai"],
|
||||
entries: {
|
||||
openai: { enabled: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
env,
|
||||
manifestRegistry: makeRegistry([
|
||||
{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
|
||||
{
|
||||
id: "codex",
|
||||
channels: [],
|
||||
providers: ["codex"],
|
||||
activation: { onAgentHarnesses: ["codex"] },
|
||||
},
|
||||
]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.codex).toBeUndefined();
|
||||
expect(result.config.plugins?.allow).toEqual(["openai"]);
|
||||
expect(result.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps OpenAI Codex OAuth model refs owned by the OpenAI plugin", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: "openai-codex/gpt-5.5",
|
||||
},
|
||||
},
|
||||
},
|
||||
env,
|
||||
manifestRegistry: makeRegistry([
|
||||
{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
|
||||
{
|
||||
id: "codex",
|
||||
channels: [],
|
||||
providers: ["codex"],
|
||||
activation: { onAgentHarnesses: ["codex"] },
|
||||
},
|
||||
]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.openai?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.codex).toBeUndefined();
|
||||
expect(result.changes).toEqual([
|
||||
"openai-codex/gpt-5.5 model configured, enabled automatically.",
|
||||
]);
|
||||
});
|
||||
|
||||
it("auto-enables Codex only for the native Codex harness with OpenAI model refs", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: "openai/gpt-5.5",
|
||||
embeddedHarness: {
|
||||
runtime: "codex",
|
||||
fallback: "none",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
env,
|
||||
manifestRegistry: makeRegistry([
|
||||
{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
|
||||
{
|
||||
id: "codex",
|
||||
channels: [],
|
||||
providers: ["codex"],
|
||||
activation: { onAgentHarnesses: ["codex"] },
|
||||
},
|
||||
]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.openai?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.codex?.enabled).toBe(true);
|
||||
expect(result.changes).toEqual([
|
||||
"openai/gpt-5.5 model configured, enabled automatically.",
|
||||
"codex agent harness runtime configured, enabled automatically.",
|
||||
]);
|
||||
});
|
||||
|
||||
it("auto-enables an opt-in plugin when an embedded agent harness runtime is configured", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
|
||||
Reference in New Issue
Block a user