mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 17:50:21 +00:00
CLI: suppress Codex native search summary when web search is off
This commit is contained in:
committed by
Peter Steinberger
parent
0a891543c9
commit
13f1190149
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -556,4 +556,54 @@ describe("finalizeSetupWizard", () => {
|
||||
);
|
||||
expect(prompter.note).not.toHaveBeenCalledWith(expect.any(String), "Dashboard ready");
|
||||
});
|
||||
|
||||
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",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user