






























@@ -228,6 +228,94 @@ describe("applyPluginAutoEnable core", () => {
228228expect(result.changes).toContain("codex/gpt-5.4 model configured, enabled automatically.");
229229});
230230231+it("does not auto-enable Codex when only the OpenAI plugin is explicitly enabled", () => {
232+const result = applyPluginAutoEnable({
233+config: {
234+plugins: {
235+allow: ["openai"],
236+entries: {
237+openai: { enabled: true },
238+},
239+},
240+},
241+ env,
242+manifestRegistry: makeRegistry([
243+{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
244+{
245+id: "codex",
246+channels: [],
247+providers: ["codex"],
248+activation: { onAgentHarnesses: ["codex"] },
249+},
250+]),
251+});
252+253+expect(result.config.plugins?.entries?.codex).toBeUndefined();
254+expect(result.config.plugins?.allow).toEqual(["openai"]);
255+expect(result.changes).toEqual([]);
256+});
257+258+it("keeps OpenAI Codex OAuth model refs owned by the OpenAI plugin", () => {
259+const result = applyPluginAutoEnable({
260+config: {
261+agents: {
262+defaults: {
263+model: "openai-codex/gpt-5.5",
264+},
265+},
266+},
267+ env,
268+manifestRegistry: makeRegistry([
269+{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
270+{
271+id: "codex",
272+channels: [],
273+providers: ["codex"],
274+activation: { onAgentHarnesses: ["codex"] },
275+},
276+]),
277+});
278+279+expect(result.config.plugins?.entries?.openai?.enabled).toBe(true);
280+expect(result.config.plugins?.entries?.codex).toBeUndefined();
281+expect(result.changes).toEqual([
282+"openai-codex/gpt-5.5 model configured, enabled automatically.",
283+]);
284+});
285+286+it("auto-enables Codex only for the native Codex harness with OpenAI model refs", () => {
287+const result = applyPluginAutoEnable({
288+config: {
289+agents: {
290+defaults: {
291+model: "openai/gpt-5.5",
292+embeddedHarness: {
293+runtime: "codex",
294+fallback: "none",
295+},
296+},
297+},
298+},
299+ env,
300+manifestRegistry: makeRegistry([
301+{ id: "openai", channels: [], providers: ["openai", "openai-codex"] },
302+{
303+id: "codex",
304+channels: [],
305+providers: ["codex"],
306+activation: { onAgentHarnesses: ["codex"] },
307+},
308+]),
309+});
310+311+expect(result.config.plugins?.entries?.openai?.enabled).toBe(true);
312+expect(result.config.plugins?.entries?.codex?.enabled).toBe(true);
313+expect(result.changes).toEqual([
314+"openai/gpt-5.5 model configured, enabled automatically.",
315+"codex agent harness runtime configured, enabled automatically.",
316+]);
317+});
318+231319it("auto-enables an opt-in plugin when an embedded agent harness runtime is configured", () => {
232320const result = applyPluginAutoEnable({
233321config: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。