From e5abc7b7eee41da24cab33e3891c5625c6cc028a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Aug 2026 20:38:19 -0700 Subject: [PATCH] fix(codex): keep native effort config canonical --- .../src/app-server/thread-model-selection.ts | 13 ------- .../codex/src/app-server/thread-requests.ts | 39 +++++++++---------- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/extensions/codex/src/app-server/thread-model-selection.ts b/extensions/codex/src/app-server/thread-model-selection.ts index f99612d8c7f1..42255d86705b 100644 --- a/extensions/codex/src/app-server/thread-model-selection.ts +++ b/extensions/codex/src/app-server/thread-model-selection.ts @@ -1,6 +1,5 @@ import type { EmbeddedRunAttemptParamsV2 as EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness-runtime"; import { - readCodexSupportedReasoningEfforts, resolveCodexAppServerReasoningEffort, type CodexReasoningEffort, } from "./reasoning-effort.js"; @@ -148,15 +147,3 @@ export function resolveReasoningEffort( supportedReasoningEfforts, }); } - -/** Resolve effort from the selected catalog row carried by an attempt. */ -export function resolveAttemptReasoningEffort( - params: EmbeddedRunAttemptParams, - modelId: string, -): CodexReasoningEffort | null { - return resolveReasoningEffort( - params.thinkLevel, - modelId, - readCodexSupportedReasoningEfforts(params.model?.compat), - ); -} diff --git a/extensions/codex/src/app-server/thread-requests.ts b/extensions/codex/src/app-server/thread-requests.ts index 9e102314e255..541c3bfaf3d4 100644 --- a/extensions/codex/src/app-server/thread-requests.ts +++ b/extensions/codex/src/app-server/thread-requests.ts @@ -206,22 +206,20 @@ export function buildThreadStartParams( personality: CODEX_NATIVE_PERSONALITY_NONE, serviceName: "OpenClaw", ...(ringZeroActive ? { baseInstructions: CODEX_RING_ZERO_BASE_INSTRUCTIONS } : {}), - config: { - ...buildCodexRuntimeThreadConfigForRun(params, options.config, { - nativeCodeModeEnabled: options.nativeCodeModeEnabled, - nativeProviderWebSearchSupport: options.nativeProviderWebSearchSupport, - nativeCodeModeOnlyEnabled: options.nativeCodeModeOnlyEnabled, - directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools), - webSearchAllowed: options.webSearchAllowed, - appServer: options.appServer, - hostSystemAgentActive: options.hostSystemAgentActive, - restrictedToolSurfaceInheritedMcpServerNames: - options.restrictedToolSurfaceInheritedMcpServerNames, - shellEnvironment: options.shellEnvironment, - disableLoginShell: options.disableLoginShell, - }), - ...(options.reasoningEffort && { model_reasoning_effort: options.reasoningEffort }), - }, + config: buildCodexRuntimeThreadConfigForRun(params, options.config, { + nativeCodeModeEnabled: options.nativeCodeModeEnabled, + nativeProviderWebSearchSupport: options.nativeProviderWebSearchSupport, + nativeCodeModeOnlyEnabled: options.nativeCodeModeOnlyEnabled, + directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools), + webSearchAllowed: options.webSearchAllowed, + appServer: options.appServer, + hostSystemAgentActive: options.hostSystemAgentActive, + restrictedToolSurfaceInheritedMcpServerNames: + options.restrictedToolSurfaceInheritedMcpServerNames, + shellEnvironment: options.shellEnvironment, + disableLoginShell: options.disableLoginShell, + reasoningEffort: options.reasoningEffort, + }), ...resolveCodexThreadEnvironmentSelection(options), developerInstructions: options.developerInstructions ?? @@ -256,6 +254,7 @@ export function buildThreadResumeParams( restrictedToolSurfaceInheritedMcpServerNames?: readonly string[]; shellEnvironment?: Readonly>; disableLoginShell?: boolean; + reasoningEffort?: string | null; preserveNativeModel?: boolean; }, ): CodexThreadResumeParams { @@ -482,6 +481,7 @@ export function buildCodexRuntimeThreadConfigForRun( params.authoredContextTokenCap === undefined ? undefined : { model_context_window: params.authoredContextTokenCap }, + options.reasoningEffort ? { model_reasoning_effort: options.reasoningEffort } : undefined, ) ?? baseConfig; const contextConfig = params.bootstrapContextMode !== "lightweight" @@ -719,12 +719,11 @@ function hasNonEmptyJsonValue(value: JsonValue): boolean { return true; } -export function resolveCodexThreadApprovalsReviewer( +export const resolveCodexThreadApprovalsReviewer = ( appServer: CodexAppServerRuntimeOptions, config?: JsonObject, -): CodexAppServerRuntimeOptions["approvalsReviewer"] { - return config?.approvals_reviewer === "user" ? "user" : appServer.approvalsReviewer; -} +): CodexAppServerRuntimeOptions["approvalsReviewer"] => + config?.approvals_reviewer === "user" ? "user" : appServer.approvalsReviewer; export function codexThreadSandboxOrPermissions( appServer: Pick,