fix(web-search): honor late-bound disabled config · openclaw/openclaw@304fa09
vincentkoc
·
2026-05-04
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,7 @@ Docs: https://docs.openclaw.ai
|
61 | 61 | |
62 | 62 | ### Fixes |
63 | 63 | |
| 64 | +- Web search: honor late-bound `tools.web.search.enabled: false` during tool execution so config reloads cannot leave an already-created `web_search` tool runnable. Thanks @vincentkoc. |
64 | 65 | - Plugins/packages: reject inferred built runtime entries that exist but fail package-boundary checks instead of falling back to TypeScript source for installed packages. Thanks @vincentkoc. |
65 | 66 | - Plugins/loader: do not retry native-loaded JavaScript plugin modules through the source transformer after native evaluation has already reached a missing dependency, avoiding duplicate top-level side effects. Thanks @vincentkoc. |
66 | 67 | - Plugins/packages: reject blank `openclaw.runtimeExtensions` entries instead of silently ignoring them and falling back to inferred TypeScript runtime entries. Thanks @vincentkoc. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -162,4 +162,20 @@ describe("web_search late-bound runtime fallback", () => {
|
162 | 162 | }), |
163 | 163 | ); |
164 | 164 | }); |
| 165 | + |
| 166 | +it("honors late-bound disabled search config at execute time", async () => { |
| 167 | +mocks.getActiveSecretsRuntimeSnapshot.mockReturnValue({ |
| 168 | +config: { tools: { web: { search: { enabled: false } } } }, |
| 169 | +}); |
| 170 | +const { createWebSearchTool } = await import("./web-search.js"); |
| 171 | +const tool = createWebSearchTool({ |
| 172 | +config: { tools: { web: { search: { provider: "brave" } } } }, |
| 173 | +lateBindRuntimeConfig: true, |
| 174 | +}); |
| 175 | + |
| 176 | +await expect(tool?.execute("call-search", { query: "openclaw" }, undefined)).rejects.toThrow( |
| 177 | +"web_search is disabled.", |
| 178 | +); |
| 179 | +expect(mocks.runWebSearch).not.toHaveBeenCalled(); |
| 180 | +}); |
165 | 181 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -91,6 +91,9 @@ export function createWebSearchTool(options?: {
|
91 | 91 | lateBindRuntimeConfig: options?.lateBindRuntimeConfig, |
92 | 92 | runtimeWebSearch: options?.runtimeWebSearch, |
93 | 93 | }); |
| 94 | +if (isWebSearchDisabled(config)) { |
| 95 | +throw new Error("web_search is disabled."); |
| 96 | +} |
94 | 97 | const result = await runWebSearch({ |
95 | 98 | config, |
96 | 99 | sandboxed: options?.sandboxed, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。