diff --git a/src/config/plugin-auto-enable.providers.test.ts b/src/config/plugin-auto-enable.providers.test.ts index efbbdd4e6d3..dbe59a2351a 100644 --- a/src/config/plugin-auto-enable.providers.test.ts +++ b/src/config/plugin-auto-enable.providers.test.ts @@ -104,6 +104,52 @@ describe("applyPluginAutoEnable providers", () => { expect(result.changes).toContain("brave web search provider selected, enabled automatically."); }); + it("does not auto-enable selected web search provider plugins when web search is disabled", () => { + const result = applyPluginAutoEnable({ + config: { + tools: { + web: { + search: { + enabled: false, + provider: "brave", + }, + }, + }, + plugins: { + allow: ["telegram"], + }, + agents: { + defaults: { + model: "codex/gpt-5.4", + }, + }, + }, + env, + manifestRegistry: makeRegistry([ + { + id: "brave", + channels: [], + contracts: { + webSearchProviders: ["brave"], + }, + }, + { + id: "codex", + channels: [], + providers: ["codex"], + }, + ]), + }); + + expect(result.config.plugins?.entries?.codex?.enabled).toBe(true); + expect(result.config.plugins?.entries?.brave).toBeUndefined(); + expect(result.config.plugins?.allow).toEqual(["telegram", "codex"]); + expect(result.changes).toContain("codex/gpt-5.4 model configured, enabled automatically."); + expect(result.changes).not.toContain( + "brave web search provider selected, enabled automatically.", + ); + }); + it("materializes xai setup auto-enable when the plugin-owned x_search tool is configured", () => { const result = materializePluginAutoEnableCandidates({ config: { diff --git a/src/config/plugin-auto-enable.shared.ts b/src/config/plugin-auto-enable.shared.ts index d420c6c00bb..257273d3daa 100644 --- a/src/config/plugin-auto-enable.shared.ts +++ b/src/config/plugin-auto-enable.shared.ts @@ -280,7 +280,7 @@ function collectPluginIdsForConfiguredChannel( } if (claims.length === 0) { - return []; + return builtInId ? [builtInId] : []; } const claimIds = new Set(claims.map((claim) => claim.plugin.id)); @@ -645,8 +645,9 @@ export function resolveConfiguredPluginAutoEnableCandidates(params: { } } + const webSearchConfig = params.config.tools?.web?.search; const webSearchProvider = - typeof params.config.tools?.web?.search?.provider === "string" + webSearchConfig?.enabled !== false && typeof webSearchConfig?.provider === "string" ? params.config.tools.web.search.provider : undefined; const webSearchPluginId = resolvePluginIdForConfiguredWebSearchProvider(