diff --git a/src/agents/codex-native-web-search.test.ts b/src/agents/codex-native-web-search.test.ts index 941ae281059..33db6d4f018 100644 --- a/src/agents/codex-native-web-search.test.ts +++ b/src/agents/codex-native-web-search.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from "vitest"; import { buildCodexNativeWebSearchTool, + describeCodexNativeWebSearch, patchCodexNativeWebSearchPayload, resolveCodexNativeSearchActivation, resolveCodexNativeWebSearchConfig, @@ -108,6 +109,24 @@ describe("resolveCodexNativeSearchActivation", () => { }); describe("Codex native web-search payload helpers", () => { + it("omits the summary when global web search is disabled", () => { + expect( + describeCodexNativeWebSearch({ + tools: { + web: { + search: { + enabled: false, + openaiCodex: { + enabled: true, + mode: "live", + }, + }, + }, + }, + }), + ).toBeUndefined(); + }); + it("normalizes optional config values", () => { const result = resolveCodexNativeWebSearchConfig({ tools: { diff --git a/src/agents/codex-native-web-search.ts b/src/agents/codex-native-web-search.ts index e220d5ff80b..a9787685a1c 100644 --- a/src/agents/codex-native-web-search.ts +++ b/src/agents/codex-native-web-search.ts @@ -295,6 +295,10 @@ export function isCodexNativeWebSearchRelevant(params: { export function describeCodexNativeWebSearch( config: OpenClawConfig | undefined, ): string | undefined { + if (config?.tools?.web?.search?.enabled === false) { + return undefined; + } + const nativeConfig = resolveCodexNativeWebSearchConfig(config); if (!nativeConfig.enabled) { return undefined; diff --git a/src/wizard/setup.finalize.test.ts b/src/wizard/setup.finalize.test.ts index 67e7a77066f..444428d2b07 100644 --- a/src/wizard/setup.finalize.test.ts +++ b/src/wizard/setup.finalize.test.ts @@ -357,4 +357,54 @@ describe("finalizeSetupWizard", () => { "Codex native search", ); }); + + it("does not show a Codex native search summary when web search is globally disabled", async () => { + const note = vi.fn(async () => {}); + const prompter = buildWizardPrompter({ + note, + select: vi.fn(async () => "later") as never, + confirm: vi.fn(async () => false), + }); + + await finalizeSetupWizard({ + flow: "advanced", + opts: { + acceptRisk: true, + authChoice: "skip", + installDaemon: false, + skipHealth: true, + skipUi: true, + }, + baseConfig: {}, + nextConfig: { + tools: { + web: { + search: { + enabled: false, + openaiCodex: { + enabled: true, + mode: "cached", + }, + }, + }, + }, + }, + workspaceDir: "/tmp", + settings: { + port: 18789, + bind: "loopback", + authMode: "token", + gatewayToken: undefined, + tailscaleMode: "off", + tailscaleResetOnExit: false, + }, + prompter, + runtime: createRuntime(), + }); + + expect(note).not.toHaveBeenCalledWith( + expect.stringContaining("Codex native search:"), + "Codex native search", + ); + }); });