Skip to content

Commit 13f1190

Browse files
Christof Salissteipete
authored andcommitted
CLI: suppress Codex native search summary when web search is off
1 parent 0a89154 commit 13f1190

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

src/agents/codex-native-web-search.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
33
buildCodexNativeWebSearchTool,
4+
describeCodexNativeWebSearch,
45
patchCodexNativeWebSearchPayload,
56
resolveCodexNativeSearchActivation,
67
resolveCodexNativeWebSearchConfig,
@@ -108,6 +109,24 @@ describe("resolveCodexNativeSearchActivation", () => {
108109
});
109110

110111
describe("Codex native web-search payload helpers", () => {
112+
it("omits the summary when global web search is disabled", () => {
113+
expect(
114+
describeCodexNativeWebSearch({
115+
tools: {
116+
web: {
117+
search: {
118+
enabled: false,
119+
openaiCodex: {
120+
enabled: true,
121+
mode: "live",
122+
},
123+
},
124+
},
125+
},
126+
}),
127+
).toBeUndefined();
128+
});
129+
111130
it("normalizes optional config values", () => {
112131
const result = resolveCodexNativeWebSearchConfig({
113132
tools: {

src/agents/codex-native-web-search.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ export function isCodexNativeWebSearchRelevant(params: {
295295
export function describeCodexNativeWebSearch(
296296
config: OpenClawConfig | undefined,
297297
): string | undefined {
298+
if (config?.tools?.web?.search?.enabled === false) {
299+
return undefined;
300+
}
301+
298302
const nativeConfig = resolveCodexNativeWebSearchConfig(config);
299303
if (!nativeConfig.enabled) {
300304
return undefined;

src/wizard/setup.finalize.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,4 +556,54 @@ describe("finalizeSetupWizard", () => {
556556
);
557557
expect(prompter.note).not.toHaveBeenCalledWith(expect.any(String), "Dashboard ready");
558558
});
559+
560+
it("does not show a Codex native search summary when web search is globally disabled", async () => {
561+
const note = vi.fn(async () => {});
562+
const prompter = buildWizardPrompter({
563+
note,
564+
select: vi.fn(async () => "later") as never,
565+
confirm: vi.fn(async () => false),
566+
});
567+
568+
await finalizeSetupWizard({
569+
flow: "advanced",
570+
opts: {
571+
acceptRisk: true,
572+
authChoice: "skip",
573+
installDaemon: false,
574+
skipHealth: true,
575+
skipUi: true,
576+
},
577+
baseConfig: {},
578+
nextConfig: {
579+
tools: {
580+
web: {
581+
search: {
582+
enabled: false,
583+
openaiCodex: {
584+
enabled: true,
585+
mode: "cached",
586+
},
587+
},
588+
},
589+
},
590+
},
591+
workspaceDir: "/tmp",
592+
settings: {
593+
port: 18789,
594+
bind: "loopback",
595+
authMode: "token",
596+
gatewayToken: undefined,
597+
tailscaleMode: "off",
598+
tailscaleResetOnExit: false,
599+
},
600+
prompter,
601+
runtime: createRuntime(),
602+
});
603+
604+
expect(note).not.toHaveBeenCalledWith(
605+
expect.stringContaining("Codex native search:"),
606+
"Codex native search",
607+
);
608+
});
559609
});

0 commit comments

Comments
 (0)