@openclaw/codex 2026.5.31-beta.3 → 2026.5.31-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  //#region extensions/codex/src/app-server/client-factory.ts
2
2
  let sharedClientModulePromise = null;
3
3
  const loadSharedClientModule = async () => {
4
- sharedClientModulePromise ??= import("./shared-client-DBlR-rV2.js").then((n) => n.s);
4
+ sharedClientModulePromise ??= import("./shared-client-ByKKWtYX.js").then((n) => n.s);
5
5
  return await sharedClientModulePromise;
6
6
  };
7
7
  const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
@@ -1,12 +1,12 @@
1
1
  import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier } from "./config-AlzuNKCY.js";
2
- import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-mbjSisZL.js";
2
+ import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-DEgJXKQy.js";
3
3
  import { l as isJsonObject } from "./client-BnOmn0y-.js";
4
4
  import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
5
- import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
5
+ import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-DYdA1i4c.js";
6
6
  import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-BykOI_jh.js";
7
7
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
8
- import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-KUDxop-C.js";
9
- import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-D-0EFJBJ.js";
8
+ import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-ffCScZef.js";
9
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-BbqwzKz3.js";
10
10
  import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
11
11
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
12
12
  import crypto from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
2
2
  import { a as readCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
3
3
  import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
4
- import { t as defaultCodexAppServerClientFactory } from "./client-factory-B8dh39UW.js";
4
+ import { t as defaultCodexAppServerClientFactory } from "./client-factory-DBgo1xC5.js";
5
5
  import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
6
6
  //#region extensions/codex/src/app-server/compact.ts
7
7
  const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
@@ -1,5 +1,5 @@
1
1
  import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-AlzuNKCY.js";
2
- import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
2
+ import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-DYdA1i4c.js";
3
3
  import { existsSync } from "node:fs";
4
4
  //#region extensions/codex/src/app-server/computer-use.ts
5
5
  var CodexComputerUseSetupError = class extends Error {
@@ -2,9 +2,9 @@ import { d as resolveCodexAppServerRuntimeOptions, i as codexSandboxPolicyForTur
2
2
  import { l as isJsonObject } from "./client-BnOmn0y-.js";
3
3
  import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-Bnlv_Q8u.js";
4
4
  import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
5
- import { r as CODEX_CONTROL_METHODS } from "./request-DuFgTwRU.js";
5
+ import { r as CODEX_CONTROL_METHODS } from "./request-DYdA1i4c.js";
6
6
  import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
7
- import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-DBlR-rV2.js";
7
+ import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-ByKKWtYX.js";
8
8
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
9
9
  import { resolveTimerTimeoutMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
10
10
  import os from "node:os";
package/dist/harness.js CHANGED
@@ -28,21 +28,21 @@ function createCodexAppServerAgentHarness(options) {
28
28
  };
29
29
  },
30
30
  runAttempt: async (params) => {
31
- const { runCodexAppServerAttempt } = await import("./run-attempt-DczP9cMX.js");
31
+ const { runCodexAppServerAttempt } = await import("./run-attempt-BHkuGybn.js");
32
32
  return runCodexAppServerAttempt(params, {
33
33
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
34
34
  nativeHookRelay: { enabled: true }
35
35
  });
36
36
  },
37
37
  runSideQuestion: async (params) => {
38
- const { runCodexAppServerSideQuestion } = await import("./side-question-SjBLGANT.js");
38
+ const { runCodexAppServerSideQuestion } = await import("./side-question-6HqYQ06R.js");
39
39
  return runCodexAppServerSideQuestion(params, {
40
40
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
41
41
  nativeHookRelay: { enabled: true }
42
42
  });
43
43
  },
44
44
  compact: async (params) => {
45
- const { maybeCompactCodexAppServerSession } = await import("./compact-BXLjhUHX.js");
45
+ const { maybeCompactCodexAppServerSession } = await import("./compact-Dgz_jIBU.js");
46
46
  return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
47
47
  },
48
48
  reset: async (params) => {
@@ -52,7 +52,7 @@ function createCodexAppServerAgentHarness(options) {
52
52
  }
53
53
  },
54
54
  dispose: async () => {
55
- const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DBlR-rV2.js").then((n) => n.s);
55
+ const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-ByKKWtYX.js").then((n) => n.s);
56
56
  await clearSharedCodexAppServerClientAndWait();
57
57
  }
58
58
  };
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import { d as resolveCodexAppServerRuntimeOptions, s as isCodexPluginsMarketplac
3
3
  import { buildCodexProvider } from "./provider.js";
4
4
  import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-Bnlv_Q8u.js";
5
5
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
6
- import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
6
+ import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-DYdA1i4c.js";
7
7
  import { s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
8
- import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-DBlR-rV2.js";
9
- import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-KUDxop-C.js";
8
+ import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-ByKKWtYX.js";
9
+ import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-ffCScZef.js";
10
10
  import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
11
11
  import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
12
12
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
@@ -48,7 +48,7 @@ async function handleCodexCommand(ctx, options = {}) {
48
48
  }
49
49
  }
50
50
  async function loadDefaultCodexSubcommandHandler() {
51
- const { handleCodexSubcommand } = await import("./command-handlers-B8-28KIp.js");
51
+ const { handleCodexSubcommand } = await import("./command-handlers-82GqsKYq.js");
52
52
  return handleCodexSubcommand;
53
53
  }
54
54
  //#endregion
@@ -1355,7 +1355,9 @@ function isCodexPluginLoadWarningItem(item) {
1355
1355
  return item.kind === "plugin" && item.action === "install" && item.status === "warning" && item.details?.warningReason === CODEX_PLUGIN_LOAD_WARNING;
1356
1356
  }
1357
1357
  async function sleep(ms) {
1358
- await new Promise((resolve) => setTimeout(resolve, ms));
1358
+ await new Promise((resolve) => {
1359
+ setTimeout(resolve, ms);
1360
+ });
1359
1361
  }
1360
1362
  async function buildTargetCodexPluginAppCacheKey(ctx) {
1361
1363
  const targets = resolveCodexMigrationTargets(ctx);
@@ -1,7 +1,7 @@
1
1
  import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
2
2
  import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
3
3
  import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DIt7cXIp.js";
4
- import { i as readModelListResult } from "./models-mbjSisZL.js";
4
+ import { i as readModelListResult } from "./models-DEgJXKQy.js";
5
5
  import { l as isJsonObject } from "./client-BnOmn0y-.js";
6
6
  import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-Bnlv_Q8u.js";
7
7
  import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
@@ -64,7 +64,7 @@ async function runBoundedCodexVisionTurn(params) {
64
64
  const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
65
65
  const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
66
66
  const ownsClient = !params.options.clientFactory;
67
- const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-DBlR-rV2.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
67
+ const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-ByKKWtYX.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
68
68
  startOptions: appServer.start,
69
69
  timeoutMs,
70
70
  authProfileId: params.profile
@@ -40,7 +40,7 @@ async function listAllCodexAppServerModels(options = {}) {
40
40
  async function withCodexAppServerModelClient(options, run) {
41
41
  const timeoutMs = options.timeoutMs ?? 2500;
42
42
  const useSharedClient = options.sharedClient !== false;
43
- const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-DBlR-rV2.js").then((n) => n.s);
43
+ const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-ByKKWtYX.js").then((n) => n.s);
44
44
  const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
45
45
  startOptions: options.startOptions,
46
46
  timeoutMs,
@@ -113,10 +113,10 @@ async function waitForPluginApprovalDecision(params) {
113
113
  let onAbort;
114
114
  const abortPromise = new Promise((_, reject) => {
115
115
  if (params.signal.aborted) {
116
- reject(params.signal.reason);
116
+ reject(toLintErrorObject(params.signal.reason, "Non-Error rejection"));
117
117
  return;
118
118
  }
119
- onAbort = () => reject(params.signal.reason);
119
+ onAbort = () => reject(toLintErrorObject(params.signal.reason, "Non-Error rejection"));
120
120
  params.signal.addEventListener("abort", onAbort, { once: true });
121
121
  });
122
122
  try {
@@ -134,6 +134,13 @@ function mapExecDecisionToOutcome(decision) {
134
134
  function truncateForGateway(value, maxLength) {
135
135
  return value.length <= maxLength ? value : `${value.slice(0, Math.max(0, maxLength - 3))}...`;
136
136
  }
137
+ function toLintErrorObject(value, fallbackMessage) {
138
+ if (value instanceof Error) return value;
139
+ if (typeof value === "string") return new Error(value);
140
+ const error = new Error(fallbackMessage, { cause: value });
141
+ if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
142
+ return error;
143
+ }
137
144
  //#endregion
138
145
  //#region extensions/codex/src/app-server/approval-bridge.ts
139
146
  const PERMISSION_DESCRIPTION_MAX_LENGTH = 700;
@@ -2098,7 +2105,8 @@ function buildCodexNativeHookRelayConfig(params) {
2098
2105
  for (const event of CODEX_NATIVE_HOOK_RELAY_EVENTS) {
2099
2106
  const codexEvent = CODEX_HOOK_EVENT_BY_NATIVE_EVENT[event];
2100
2107
  const selected = selectedEvents.has(event);
2101
- if (!selected || !params.relay.shouldRelayEvent(event)) {
2108
+ const shouldRelay = params.relay.shouldRelayEvent(event);
2109
+ if (!selected || !shouldRelay && !(selected && event === "pre_tool_use" && !shouldRelay)) {
2102
2110
  if (selected || params.clearOmittedEvents) config[`hooks.${codexEvent}`] = [];
2103
2111
  if (params.clearOmittedEvents) for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT[event]}:0:0`] = { enabled: false };
2104
2112
  continue;
package/dist/provider.js CHANGED
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
123
123
  }
124
124
  }
125
125
  async function listCodexAppServerModelsLazy(options) {
126
- const { listCodexAppServerModels } = await import("./models-mbjSisZL.js").then((n) => n.r);
126
+ const { listCodexAppServerModels } = await import("./models-DEgJXKQy.js").then((n) => n.r);
127
127
  return listCodexAppServerModels(options);
128
128
  }
129
129
  function normalizeTimeoutMs(value) {
@@ -1,6 +1,6 @@
1
1
  import { n as CodexAppServerRpcError } from "./client-BnOmn0y-.js";
2
2
  import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-Bnlv_Q8u.js";
3
- import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-DBlR-rV2.js";
3
+ import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-ByKKWtYX.js";
4
4
  import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-DMCJlzmz.js";
5
5
  import { createHash } from "node:crypto";
6
6
  //#region extensions/codex/src/app-server/capabilities.ts
@@ -3,20 +3,20 @@ import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCod
3
3
  import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-BnOmn0y-.js";
4
4
  import { C as sanitizeCodexHistoryImagePayloads, D as resolveCodexContextEngineProjectionReserveTokens, E as resolveCodexContextEngineProjectionMaxChars, T as projectContextEngineAssemblyForCodex, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-Bnlv_Q8u.js";
5
5
  import { a as readCodexAppServerBinding, n as clearCodexAppServerBindingForThread, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
6
- import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-DuFgTwRU.js";
6
+ import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-DYdA1i4c.js";
7
7
  import { _ as shouldRefreshCodexRateLimitsForUsageLimitMessage, g as resolveCodexUsageLimitResetAtMs, h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-BykOI_jh.js";
8
- import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-DBlR-rV2.js";
8
+ import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-ByKKWtYX.js";
9
9
  import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-DMCJlzmz.js";
10
- import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-B8dh39UW.js";
11
- import { C as resolveCodexTurnAssistantCompletionIdleTimeoutMs, E as withCodexStartupTimeout, S as resolveCodexStartupTimeoutMs, T as resolveCodexTurnTerminalIdleTimeoutMs, _ as normalizeCodexDynamicToolName$1, a as createCodexNativeHookRelay, b as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as isForcedPrivateQaCodexRuntime, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, n as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, o as resolveCodexNativeHookRelayEvents, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, s as resolveCodexNativeHookRelayTtlMs, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, w as resolveCodexTurnCompletionIdleTimeoutMs, x as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-DCxPRaBN.js";
12
- import { t as ensureCodexComputerUse } from "./computer-use-D-0EFJBJ.js";
10
+ import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-DBgo1xC5.js";
11
+ import { C as resolveCodexTurnAssistantCompletionIdleTimeoutMs, E as withCodexStartupTimeout, S as resolveCodexStartupTimeoutMs, T as resolveCodexTurnTerminalIdleTimeoutMs, _ as normalizeCodexDynamicToolName$1, a as createCodexNativeHookRelay, b as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as isForcedPrivateQaCodexRuntime, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, n as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, o as resolveCodexNativeHookRelayEvents, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, s as resolveCodexNativeHookRelayTtlMs, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, w as resolveCodexTurnCompletionIdleTimeoutMs, x as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-D_LPgQFs.js";
12
+ import { t as ensureCodexComputerUse } from "./computer-use-BbqwzKz3.js";
13
13
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
14
14
  import { asDateTimestampMs, parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
15
15
  import { createHash, randomUUID } from "node:crypto";
16
16
  import fsSync from "node:fs";
17
17
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
18
18
  import { asBoolean, asFiniteNumber, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
19
- import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
19
+ import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, filterProviderNormalizableTools, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
20
20
  import { spawn } from "node:child_process";
21
21
  import { once } from "node:events";
22
22
  import { WebSocketServer } from "ws";
@@ -1266,7 +1266,11 @@ async function buildDynamicTools(input) {
1266
1266
  }
1267
1267
  });
1268
1268
  toolBuildStages.mark("create-openclaw-coding-tools");
1269
- const codexFilteredTools = addNodeShellDynamicToolsIfNeeded(addSandboxShellDynamicToolsIfAvailable(isCodexMemoryFlushRun(params) ? filterCodexMemoryFlushDynamicTools(allTools) : filterCodexDynamicTools(allTools, input.pluginConfig), allTools, input), allTools, input);
1269
+ const preNormalizationDiagnostics = [];
1270
+ const readableAllToolProjection = filterProviderNormalizableTools(allTools);
1271
+ preNormalizationDiagnostics.push(...readableAllToolProjection.diagnostics);
1272
+ const readableAllTools = [...readableAllToolProjection.tools];
1273
+ const codexFilteredTools = addNodeShellDynamicToolsIfNeeded(addSandboxShellDynamicToolsIfAvailable(isCodexMemoryFlushRun(params) ? filterCodexMemoryFlushDynamicTools(readableAllTools) : filterCodexDynamicTools(readableAllTools, input.pluginConfig), readableAllTools, input), readableAllTools, input);
1270
1274
  toolBuildStages.mark("codex-filtering");
1271
1275
  const visionFilteredTools = filterToolsForVisionInputs(codexFilteredTools, {
1272
1276
  modelHasVision,
@@ -1284,9 +1288,20 @@ async function buildDynamicTools(input) {
1284
1288
  env: process.env,
1285
1289
  modelId: params.modelId,
1286
1290
  modelApi: params.model.api,
1287
- model: params.model
1291
+ model: params.model,
1292
+ onPreNormalizationSchemaDiagnostics: (diagnostics) => preNormalizationDiagnostics.push(...diagnostics)
1288
1293
  });
1289
1294
  toolBuildStages.mark("runtime-normalization");
1295
+ if (preNormalizationDiagnostics.length > 0) embeddedAgentLog.warn(`codex app-server quarantined ${preNormalizationDiagnostics.length} unsupported runtime tool schema${preNormalizationDiagnostics.length === 1 ? "" : "s"} before dynamic tool registration`, {
1296
+ runId: params.runId,
1297
+ sessionId: params.sessionId,
1298
+ diagnostics: preNormalizationDiagnostics.map((diagnostic) => ({
1299
+ index: diagnostic.toolIndex,
1300
+ tool: diagnostic.toolName,
1301
+ violations: diagnostic.violations.slice(0, 12),
1302
+ violationCount: diagnostic.violations.length
1303
+ }))
1304
+ });
1290
1305
  const summary = toolBuildStages.snapshot();
1291
1306
  if (shouldWarnCodexDynamicToolBuildStageSummary(summary)) {
1292
1307
  const phase = input.forceHeartbeatTool ? "registered-tools" : "runtime-tools";
@@ -1296,7 +1311,7 @@ async function buildDynamicTools(input) {
1296
1311
  phase,
1297
1312
  totalMs: summary.totalMs,
1298
1313
  stages: summary.stages,
1299
- allToolCount: allTools.length,
1314
+ allToolCount: readableAllTools.length,
1300
1315
  codexFilteredToolCount: codexFilteredTools.length,
1301
1316
  visionFilteredToolCount: visionFilteredTools.length,
1302
1317
  filteredToolCount: filteredTools.length,
@@ -2819,7 +2834,6 @@ async function startCodexAttemptThread(params) {
2819
2834
  const failedClient = attemptedClient;
2820
2835
  const clearedSharedClient = clearSharedCodexAppServerClientIfCurrent(failedClient);
2821
2836
  if (startupClientForAbandonedRequestCleanup === failedClient) startupClientForAbandonedRequestCleanup = void 0;
2822
- attemptedClient = void 0;
2823
2837
  if (attempt >= CODEX_APP_SERVER_STARTUP_CONNECTION_CLOSE_MAX_ATTEMPTS) {
2824
2838
  embeddedAgentLog.warn("codex app-server connection closed during startup; retries exhausted", {
2825
2839
  attempt,
@@ -5474,6 +5488,7 @@ var CodexNativeSubagentTaskMirror = class {
5474
5488
  this.params = params;
5475
5489
  this.runtime = runtime;
5476
5490
  this.mirroredThreadIds = /* @__PURE__ */ new Set();
5491
+ this.failedMirrorThreadIds = /* @__PURE__ */ new Set();
5477
5492
  this.terminalRunIds = /* @__PURE__ */ new Set();
5478
5493
  this.now = params.now ?? Date.now;
5479
5494
  }
@@ -5503,7 +5518,7 @@ var CodexNativeSubagentTaskMirror = class {
5503
5518
  const label = trimOptional(spawn.agent_nickname) ?? trimOptional(thread.agentNickname) ?? trimOptional(spawn.agent_role) ?? trimOptional(thread.agentRole) ?? "Codex subagent";
5504
5519
  const task = trimOptional(thread.preview) ?? `Codex native subagent${label === "Codex subagent" ? "" : ` ${label}`}`;
5505
5520
  const createdAt = secondsToMillis$1(thread.createdAt) ?? this.now();
5506
- this.runtime.createRunningTaskRun({
5521
+ if (!this.runtime.tryCreateRunningTaskRun({
5507
5522
  sourceId: runId,
5508
5523
  agentId: this.params.agentId,
5509
5524
  runId,
@@ -5515,7 +5530,13 @@ var CodexNativeSubagentTaskMirror = class {
5515
5530
  startedAt: createdAt,
5516
5531
  lastEventAt: this.now(),
5517
5532
  progressSummary: "Codex native subagent started."
5518
- });
5533
+ })) {
5534
+ this.mirroredThreadIds.delete(threadId);
5535
+ this.failedMirrorThreadIds.add(threadId);
5536
+ return;
5537
+ }
5538
+ this.failedMirrorThreadIds.delete(threadId);
5539
+ this.terminalRunIds.delete(runId);
5519
5540
  this.applyStatus(threadId, thread.status);
5520
5541
  }
5521
5542
  handleThreadStatusChanged(params) {
@@ -5524,6 +5545,7 @@ var CodexNativeSubagentTaskMirror = class {
5524
5545
  this.applyStatus(notification.threadId, notification.status);
5525
5546
  }
5526
5547
  applyStatus(threadId, status) {
5548
+ if (!this.mirroredThreadIds.has(threadId) && this.failedMirrorThreadIds.has(threadId)) return;
5527
5549
  const statusType = status?.type;
5528
5550
  if (!statusType) return;
5529
5551
  const runId = codexNativeSubagentRunId(threadId);
@@ -5603,7 +5625,7 @@ var CodexNativeSubagentTaskMirror = class {
5603
5625
  const prompt = trimOptional(readString$3(item, "prompt"));
5604
5626
  const runId = codexNativeSubagentRunId(normalizedThreadId);
5605
5627
  const createdAt = this.now();
5606
- this.runtime.createRunningTaskRun({
5628
+ if (!this.runtime.tryCreateRunningTaskRun({
5607
5629
  sourceId: runId,
5608
5630
  agentId: this.params.agentId,
5609
5631
  runId,
@@ -5615,9 +5637,16 @@ var CodexNativeSubagentTaskMirror = class {
5615
5637
  startedAt: createdAt,
5616
5638
  lastEventAt: createdAt,
5617
5639
  progressSummary: "Codex native subagent spawned."
5618
- });
5640
+ })) {
5641
+ this.mirroredThreadIds.delete(normalizedThreadId);
5642
+ this.failedMirrorThreadIds.add(normalizedThreadId);
5643
+ return;
5644
+ }
5645
+ this.failedMirrorThreadIds.delete(normalizedThreadId);
5646
+ this.terminalRunIds.delete(runId);
5619
5647
  }
5620
5648
  applyCollabAgentStatus(threadId, status, message) {
5649
+ if (!this.mirroredThreadIds.has(threadId) && this.failedMirrorThreadIds.has(threadId)) return;
5621
5650
  const normalizedStatus = normalizeAgentStateStatus(status);
5622
5651
  if (!normalizedStatus) return;
5623
5652
  const runId = codexNativeSubagentRunId(threadId);
@@ -7301,17 +7330,21 @@ async function runCodexAppServerAttempt(params, options = {}) {
7301
7330
  else params.abortSignal?.addEventListener("abort", abortFromUpstream, { once: true });
7302
7331
  const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, sessionAgentId);
7303
7332
  preDynamicStartupStages.mark("session-agent");
7333
+ const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
7334
+ const isInactiveThreadBootstrapBinding = (binding) => !activeContextEngine && binding?.contextEngine?.projection?.mode === "thread_bootstrap";
7304
7335
  let startupBinding = await readCodexAppServerBinding(params.sessionFile);
7305
7336
  preDynamicStartupStages.mark("read-binding");
7306
7337
  const startupBindingAuthProfileId = startupBinding?.authProfileId;
7338
+ const initialStartupBindingHadInactiveThreadBootstrap = isInactiveThreadBootstrapBinding(startupBinding);
7307
7339
  startupBinding = await rotateOversizedCodexAppServerStartupBinding({
7308
7340
  binding: startupBinding,
7309
7341
  sessionFile: params.sessionFile,
7310
7342
  agentDir,
7311
7343
  codexHome: appServer.start.env?.CODEX_HOME,
7312
7344
  config: params.config,
7313
- contextEngineActive: isActiveHarnessContextEngine(params.contextEngine)
7345
+ contextEngineActive: Boolean(activeContextEngine)
7314
7346
  });
7347
+ const initialInactiveThreadBootstrapBindingForcedFreshStart = initialStartupBindingHadInactiveThreadBootstrap && !startupBinding?.threadId;
7315
7348
  preDynamicStartupStages.mark("rotate-binding");
7316
7349
  const startupAuthProfileCandidate = params.runtimePlan?.auth.forwardedAuthProfileId ?? params.authProfileId ?? startupBinding?.authProfileId ?? startupBindingAuthProfileId;
7317
7350
  const startupAuthProfileId = params.authProfileStore ? resolveCodexAppServerAuthProfileId({
@@ -7366,7 +7399,6 @@ async function runCodexAppServerAttempt(params, options = {}) {
7366
7399
  });
7367
7400
  preDynamicStartupStages.mark("native-tool-surface");
7368
7401
  for (const diagnostic of bundleMcpThreadConfig.diagnostics) embeddedAgentLog.warn(`bundle-mcp: ${diagnostic.pluginId}: ${diagnostic.message}`);
7369
- const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
7370
7402
  if (activeContextEngine) assertContextEngineHostSupport({
7371
7403
  contextEngine: activeContextEngine,
7372
7404
  operation: "agent-run",
@@ -7502,6 +7534,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
7502
7534
  let contextEngineProjection;
7503
7535
  let precomputedStaleBindingContinuityProjectionApplied = false;
7504
7536
  let staleBindingContinuityForcedFreshStart = false;
7537
+ let inactiveThreadBootstrapBindingForcedFreshStart = initialInactiveThreadBootstrapBindingForcedFreshStart;
7505
7538
  const applyFreshThreadContinuityProjection = () => {
7506
7539
  const projection = projectContextEngineAssemblyForCodex({
7507
7540
  assembledMessages: historyMessages,
@@ -7632,6 +7665,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
7632
7665
  precomputedStaleBindingContinuityProjectionApplied = false;
7633
7666
  staleBindingContinuityForcedFreshStart = false;
7634
7667
  if (activeContextEngine || !binding?.threadId) return false;
7668
+ if (isInactiveThreadBootstrapBinding(binding)) {
7669
+ inactiveThreadBootstrapBindingForcedFreshStart = true;
7670
+ return false;
7671
+ }
7635
7672
  const projected = applyResumeStaleBindingContinuityProjection(binding);
7636
7673
  precomputedStaleBindingContinuityProjectionApplied = projected;
7637
7674
  return projected;
@@ -7640,6 +7677,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
7640
7677
  if (activeContextEngine || !historyMessages.some((message) => message.role === "user")) return false;
7641
7678
  if (action === "resumed" && precomputedStaleBindingContinuityProjectionApplied) return true;
7642
7679
  if (action === "started" && staleBindingContinuityForcedFreshStart) return true;
7680
+ if (action === "started" && inactiveThreadBootstrapBindingForcedFreshStart) return false;
7643
7681
  if (action === "resumed" && binding) return applyResumeStaleBindingContinuityProjection(binding);
7644
7682
  if (action === "started") {
7645
7683
  applyFreshThreadContinuityProjection();
@@ -7651,6 +7689,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
7651
7689
  const rotateStartupBindingForProjectedTurn = async () => {
7652
7690
  if (!startupBinding?.threadId) return;
7653
7691
  const previousThreadId = startupBinding.threadId;
7692
+ const hadInactiveThreadBootstrapBinding = isInactiveThreadBootstrapBinding(startupBinding);
7654
7693
  const projectedTurnTokens = estimateCodexAppServerProjectedTurnTokens({
7655
7694
  prompt: codexTurnPromptText,
7656
7695
  developerInstructions: buildRenderedCodexDeveloperInstructions()
@@ -7665,7 +7704,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
7665
7704
  projectedTurnTokens
7666
7705
  });
7667
7706
  if (startupBinding?.threadId) return;
7668
- staleBindingContinuityForcedFreshStart = precomputedStaleBindingContinuityProjectionApplied;
7707
+ inactiveThreadBootstrapBindingForcedFreshStart = hadInactiveThreadBootstrapBinding;
7708
+ staleBindingContinuityForcedFreshStart = precomputedStaleBindingContinuityProjectionApplied && !inactiveThreadBootstrapBindingForcedFreshStart;
7669
7709
  if (activeContextEngine) {
7670
7710
  contextEngineProjection = void 0;
7671
7711
  try {
@@ -7703,8 +7743,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
7703
7743
  let client;
7704
7744
  let thread;
7705
7745
  let trajectoryEndRecorded = false;
7746
+ const markTrajectoryEndRecorded = () => {
7747
+ trajectoryEndRecorded = true;
7748
+ };
7706
7749
  let nativeHookRelay;
7707
7750
  let releaseSharedClientLease;
7751
+ const releaseSharedClientLeaseOnce = () => {
7752
+ const release = releaseSharedClientLease;
7753
+ if (!release) return;
7754
+ releaseSharedClientLease = void 0;
7755
+ release();
7756
+ };
7708
7757
  let sandboxExecEnvironmentAcquired = false;
7709
7758
  const releaseSandboxExecEnvironment = async () => {
7710
7759
  if (sandboxExecEnvironmentAcquired) {
@@ -8465,7 +8514,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8465
8514
  aborted: runAbortController.signal.aborted,
8466
8515
  promptError: turnStartErrorMessage
8467
8516
  });
8468
- trajectoryEndRecorded = true;
8517
+ markTrajectoryEndRecorded();
8469
8518
  runAgentHarnessLlmOutputHook({
8470
8519
  event: {
8471
8520
  runId: params.runId,
@@ -8522,8 +8571,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8522
8571
  }
8523
8572
  });
8524
8573
  params.abortSignal?.removeEventListener("abort", abortFromUpstream);
8525
- releaseSharedClientLease?.();
8526
- releaseSharedClientLease = void 0;
8574
+ releaseSharedClientLeaseOnce();
8527
8575
  if (usageLimitError) {
8528
8576
  await markCodexAuthProfileBlockedFromRateLimits({
8529
8577
  params,
@@ -8541,8 +8589,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8541
8589
  }
8542
8590
  }
8543
8591
  if (!turn) {
8544
- releaseSharedClientLease?.();
8545
- releaseSharedClientLease = void 0;
8592
+ releaseSharedClientLeaseOnce();
8546
8593
  throw new Error("codex app-server turn/start failed without an error");
8547
8594
  }
8548
8595
  turnIdRef.current = turn.turn.id;
@@ -8717,7 +8764,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8717
8764
  yieldDetected,
8718
8765
  promptError: normalizeCodexTrajectoryError(finalPromptError)
8719
8766
  });
8720
- trajectoryEndRecorded = true;
8767
+ markTrajectoryEndRecorded();
8721
8768
  await mirrorTranscriptBestEffort({
8722
8769
  params,
8723
8770
  agentId: sessionAgentId,
@@ -8855,7 +8902,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8855
8902
  notificationCleanup();
8856
8903
  requestCleanup();
8857
8904
  closeCleanup?.();
8858
- releaseSharedClientLease?.();
8905
+ releaseSharedClientLeaseOnce();
8859
8906
  if (nativeHookRelay) if (shouldDelayNativeHookRelayUnregister) scheduleCodexNativeHookRelayUnregister({
8860
8907
  relay: nativeHookRelay,
8861
8908
  hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
@@ -12,6 +12,8 @@ import { fileURLToPath } from "node:url";
12
12
  import { withTimeout } from "openclaw/plugin-sdk/security-runtime";
13
13
  //#region extensions/codex/src/app-server/auth-bridge.ts
14
14
  const CODEX_APP_SERVER_AUTH_PROVIDER = "openai";
15
+ const LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER = "codex-cli";
16
+ const CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS = [CODEX_APP_SERVER_AUTH_PROVIDER, LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER];
15
17
  const OPENAI_PROVIDER = "openai";
16
18
  const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default";
17
19
  const CODEX_HOME_ENV_VAR = "CODEX_HOME";
@@ -65,7 +67,7 @@ function ensureCodexAppServerAuthProfileStore(params) {
65
67
  return ensureAuthProfileStore(params.agentDir, {
66
68
  allowKeychainPrompt: false,
67
69
  config: params.config,
68
- externalCliProviderIds: [CODEX_APP_SERVER_AUTH_PROVIDER],
70
+ externalCliProviderIds: CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS,
69
71
  ...params.authProfileId ? { externalCliProfileIds: [params.authProfileId] } : {}
70
72
  });
71
73
  }
@@ -365,7 +367,8 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
365
367
  } : candidate;
366
368
  }
367
369
  function isCodexAppServerAuthProvider(provider, config) {
368
- return resolveProviderIdForAuth(provider, { config }) === CODEX_APP_SERVER_AUTH_PROVIDER;
370
+ const resolvedProvider = resolveProviderIdForAuth(provider, { config });
371
+ return resolvedProvider === CODEX_APP_SERVER_AUTH_PROVIDER || resolvedProvider === LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER;
369
372
  }
370
373
  function isOpenAIApiKeyBackupCredential(credential, config) {
371
374
  return credential.type === "api_key" && resolveProviderIdForAuth(credential.provider, { config }) === OPENAI_PROVIDER;
@@ -4,9 +4,9 @@ import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./clien
4
4
  import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-Bnlv_Q8u.js";
5
5
  import { a as readCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
6
6
  import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-BykOI_jh.js";
7
- import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-DBlR-rV2.js";
7
+ import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-ByKKWtYX.js";
8
8
  import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
9
- import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-DCxPRaBN.js";
9
+ import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-D_LPgQFs.js";
10
10
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
11
11
  import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
12
12
  //#region extensions/codex/src/app-server/side-question.ts
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.5.31-beta.3",
3
+ "version": "2026.5.31-beta.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/codex",
9
- "version": "2026.5.31-beta.3",
9
+ "version": "2026.5.31-beta.4",
10
10
  "dependencies": {
11
11
  "@openai/codex": "0.135.0",
12
12
  "typebox": "1.1.39",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.5.31-beta.3",
3
+ "version": "2026.5.31-beta.4",
4
4
  "description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,10 +26,10 @@
26
26
  "minHostVersion": ">=2026.5.1-beta.1"
27
27
  },
28
28
  "compat": {
29
- "pluginApi": ">=2026.5.31-beta.3"
29
+ "pluginApi": ">=2026.5.31-beta.4"
30
30
  },
31
31
  "build": {
32
- "openclawVersion": "2026.5.31-beta.3"
32
+ "openclawVersion": "2026.5.31-beta.4"
33
33
  },
34
34
  "release": {
35
35
  "publishToClawHub": true,
@@ -47,7 +47,7 @@
47
47
  "README.md"
48
48
  ],
49
49
  "peerDependencies": {
50
- "openclaw": ">=2026.5.31-beta.3"
50
+ "openclaw": ">=2026.5.31-beta.4"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "openclaw": {