test(config): cover codex plugin auto-enable boundaries

This commit is contained in:
Peter Steinberger
2026-04-24 06:36:34 +01:00
parent 4f4d2ef1df
commit cc28989b4b

View File

@@ -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: {