mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:00:43 +00:00
fix(config): respect disabled web search auto-enable
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user