惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 聂微东
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
D
Docker
B
Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
月光博客
月光博客
F
Fortinet All Blogs
爱范儿
爱范儿
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Cloudflare Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
U
Unit 42

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(web-search): keep runtime legacy merge out of validat...
luoyanglang · 2026-05-27 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

import { resolvePluginWebSearchConfig } from "../../config/plugin-web-search-config.js";

22

import type { OpenClawConfig } from "../../config/types.openclaw.js";

3+

import { isLegacyWebSearchProviderConfigKey } from "../../config/web-search-legacy-provider-keys.js";

34
45

export function getTopLevelCredentialValue(searchConfig?: Record<string, unknown>): unknown {

56

return searchConfig?.apiKey;

@@ -52,13 +53,22 @@ export function mergeScopedSearchConfig(

5253

!Array.isArray(searchConfig[key])

5354

? (searchConfig[key] as Record<string, unknown>)

5455

: {};

55-

const next: Record<string, unknown> = {

56-

...searchConfig,

57-

[key]: {

56+

const next: Record<string, unknown> = { ...searchConfig };

57+

const existingDescriptor = searchConfig

58+

? Object.getOwnPropertyDescriptor(searchConfig, key)

59+

: undefined;

60+

const shouldHideRuntimeInjectedLegacyShape =

61+

isLegacyWebSearchProviderConfigKey(key) && existingDescriptor === undefined;

62+
63+

Object.defineProperty(next, key, {

64+

value: {

5865

...currentScoped,

5966

...pluginConfig,

6067

},

61-

};

68+

enumerable: !shouldHideRuntimeInjectedLegacyShape,

69+

configurable: true,

70+

writable: true,

71+

});

6272
6373

if (options?.mirrorApiKeyToTopLevel && pluginConfig.apiKey !== undefined) {

6474

next.apiKey = pluginConfig.apiKey;

Original file line numberDiff line numberDiff line change

@@ -144,4 +144,15 @@ describe("web_search scoped config merge", () => {

144144

brave: { count: 5, apiKey: "brave-test-key" },

145145

});

146146

});

147+
148+

it("keeps newly injected legacy provider config runtime-only for validation", () => {

149+

const merged = mergeScopedSearchConfig({ enabled: true, provider: "gemini" }, "perplexity", {

150+

apiKey: "perplexity-test-key",

151+

});

152+
153+

expect(merged?.perplexity).toEqual({ apiKey: "perplexity-test-key" });

154+

expect(Object.keys(merged ?? {})).toEqual(["enabled", "provider"]);

155+
156+

expect(Object.getOwnPropertyDescriptor(merged, "perplexity")?.enumerable).toBe(false);

157+

});

147158

});

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures";

22

import { describe, expect, it } from "vitest";

3+

import { mergeScopedSearchConfig } from "../agents/tools/web-search-provider-config.js";

34

import { validateConfigObjectRaw } from "./validation.js";

45
56

describe("web search Codex native config validation", () => {

@@ -54,6 +55,23 @@ describe("web search Codex native config validation", () => {

5455

}

5556

});

5657
58+

it("accepts runtime-only legacy provider entries injected by web search merge", () => {

59+

const search = mergeScopedSearchConfig({ enabled: true, provider: "gemini" }, "perplexity", {

60+

apiKey: "perplexity-test-key",

61+

});

62+

const result = validateConfigObjectRaw({

63+

tools: {

64+

web: {

65+

search,

66+

},

67+

},

68+

});

69+
70+

expect(search?.perplexity).toEqual({ apiKey: "perplexity-test-key" });

71+

expect(Object.keys(search ?? {})).toEqual(["enabled", "provider"]);

72+

expect(result.ok).toBe(true);

73+

});

74+
5775

it.each(["__proto__", "prototype", "constructor"])(

5876

"rejects blocked tools.web.search key %s",

5977

(key) => {

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,18 @@

1+

export const LEGACY_WEB_SEARCH_PROVIDER_CONFIG_KEYS = new Set([

2+

"brave",

3+

"duckduckgo",

4+

"exa",

5+

"firecrawl",

6+

"gemini",

7+

"grok",

8+

"kimi",

9+

"minimax",

10+

"ollama",

11+

"perplexity",

12+

"searxng",

13+

"tavily",

14+

]);

15+
16+

export function isLegacyWebSearchProviderConfigKey(key: string): boolean {

17+

return LEGACY_WEB_SEARCH_PROVIDER_CONFIG_KEYS.has(key);

18+

}

Original file line numberDiff line numberDiff line change

@@ -10,6 +10,7 @@ import {

1010

} from "../shared/string-coerce.js";

1111

import { uniqueStrings } from "../shared/string-normalization.js";

1212

import { isBlockedObjectKey } from "./prototype-keys.js";

13+

import { LEGACY_WEB_SEARCH_PROVIDER_CONFIG_KEYS } from "./web-search-legacy-provider-keys.js";

1314

import { AgentModelSchema, AgentToolModelSchema } from "./zod-schema.agent-model.js";

1415

import {

1516

GroupChatSchema,

@@ -352,21 +353,6 @@ const CodexUserLocationSchema = z

352353

})

353354

.optional();

354355
355-

const LEGACY_WEB_SEARCH_PROVIDER_CONFIG_KEYS = new Set([

356-

"brave",

357-

"duckduckgo",

358-

"exa",

359-

"firecrawl",

360-

"gemini",

361-

"grok",

362-

"kimi",

363-

"minimax",

364-

"ollama",

365-

"perplexity",

366-

"searxng",

367-

"tavily",

368-

]);

369-
370356

const BLOCKED_WEB_SEARCH_KEYS_ISSUE_FIELD = "__openclawBlockedWebSearchKeys";

371357
372358

const ToolsWebSearchSchema = z