@openclaw/codex 2026.6.5-beta.1 → 2026.6.5-beta.2

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.
package/dist/harness.js CHANGED
@@ -32,7 +32,7 @@ function createCodexAppServerAgentHarness(options) {
32
32
  };
33
33
  },
34
34
  runAttempt: async (params) => {
35
- const { runCodexAppServerAttempt } = await import("./run-attempt-B_6VkFQN.js");
35
+ const { runCodexAppServerAttempt } = await import("./run-attempt-CWfXFq9Q.js");
36
36
  return runCodexAppServerAttempt(params, {
37
37
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
38
38
  nativeHookRelay: { enabled: true }
@@ -1174,21 +1174,17 @@ const CODEX_APP_SERVER_MISSING_TERMINAL_EVENT_SIDE_EFFECT_USER_MESSAGE = "Codex
1174
1174
  function collectTerminalAssistantText(result) {
1175
1175
  return result.assistantTexts.join("\n\n").trim();
1176
1176
  }
1177
- /** Returns whether attempt metadata saw potential side effects. */
1178
- function hasCodexAppServerPotentialSideEffectEvidence(result) {
1179
- return result.replayMetadata.hadPotentialSideEffects;
1180
- }
1181
1177
  /**
1182
1178
  * Builds the user-facing timeout outcome when Codex stops without a terminal
1183
1179
  * turn event.
1184
1180
  */
1185
1181
  function buildCodexAppServerPromptTimeoutOutcome(params) {
1186
- const completionIdleTimeoutHadPotentialSideEffects = hasCodexAppServerPotentialSideEffectEvidence(params.result);
1182
+ if (!params.turnCompletionIdleTimedOut) return;
1183
+ if (params.turnWatchTimeoutKind !== void 0 && params.turnWatchTimeoutKind !== "completion") return;
1187
1184
  const replayBlockedReason = resolveCodexAppServerReplayBlockedReason(params.result);
1188
- if (!params.turnCompletionIdleTimedOut || params.result.itemLifecycle.completedCount === 0 && !completionIdleTimeoutHadPotentialSideEffects && replayBlockedReason === void 0) return;
1189
1185
  return {
1190
- message: completionIdleTimeoutHadPotentialSideEffects ? CODEX_APP_SERVER_MISSING_TERMINAL_EVENT_SIDE_EFFECT_USER_MESSAGE : CODEX_APP_SERVER_MISSING_TERMINAL_EVENT_USER_MESSAGE,
1191
- ...completionIdleTimeoutHadPotentialSideEffects ? {
1186
+ message: replayBlockedReason === "tool_activity" || replayBlockedReason === "potential_side_effect" || replayBlockedReason === "active_item" ? CODEX_APP_SERVER_MISSING_TERMINAL_EVENT_SIDE_EFFECT_USER_MESSAGE : CODEX_APP_SERVER_MISSING_TERMINAL_EVENT_USER_MESSAGE,
1187
+ ...replayBlockedReason ? {
1192
1188
  replayInvalid: true,
1193
1189
  livenessState: "abandoned"
1194
1190
  } : {}
@@ -3484,12 +3480,21 @@ function createCodexAttemptTurnWatchController(params) {
3484
3480
  scheduleCompletionIdleWatch();
3485
3481
  return;
3486
3482
  }
3483
+ const details = {
3484
+ ...completionLastActivityDetails,
3485
+ activeAppServerTurnRequests: params.getActiveAppServerTurnRequests(),
3486
+ activeTurnItemCount: params.getActiveTurnItemCount(),
3487
+ terminalTurnNotificationQueued: params.isTerminalTurnNotificationQueued(),
3488
+ completionIdleWatchArmed,
3489
+ assistantCompletionIdleWatchArmed,
3490
+ terminalIdleWatchArmed
3491
+ };
3487
3492
  const timeout = {
3488
3493
  kind: "completion",
3489
3494
  idleMs,
3490
3495
  timeoutMs,
3491
3496
  lastActivityReason: completionLastActivityReason,
3492
- details: completionLastActivityDetails
3497
+ details
3493
3498
  };
3494
3499
  params.onTimeout(timeout);
3495
3500
  params.onMarkTimedOut();
@@ -4246,6 +4251,10 @@ var CodexAppServerEventProjector = class {
4246
4251
  getCompletedTurnStatus() {
4247
4252
  return this.completedTurn?.status;
4248
4253
  }
4254
+ hasCompletedTerminalAssistantText() {
4255
+ const finalItem = this.resolveFinalAssistantTextItem();
4256
+ return finalItem !== void 0 && this.completedItemIds.has(finalItem.itemId);
4257
+ }
4249
4258
  async handleNotification(notification) {
4250
4259
  const params = isJsonObject(notification.params) ? notification.params : void 0;
4251
4260
  if (!params) return;
@@ -5275,12 +5284,18 @@ var CodexAppServerEventProjector = class {
5275
5284
  return finalText ? [finalText] : [];
5276
5285
  }
5277
5286
  resolveFinalAssistantText() {
5287
+ return this.resolveFinalAssistantTextItem()?.text;
5288
+ }
5289
+ resolveFinalAssistantTextItem() {
5278
5290
  for (let i = this.assistantItemOrder.length - 1; i >= 0; i -= 1) {
5279
5291
  const itemId = this.assistantItemOrder[i];
5280
5292
  if (!itemId) continue;
5281
5293
  const text = this.assistantTextByItem.get(itemId)?.trim();
5282
5294
  if (this.assistantPhaseByItem.get(itemId) === "commentary") continue;
5283
- if (text && !this.toolProgressTexts.has(text)) return text;
5295
+ if (text && !this.toolProgressTexts.has(text)) return {
5296
+ itemId,
5297
+ text
5298
+ };
5284
5299
  }
5285
5300
  }
5286
5301
  rememberAssistantItem(itemId) {
@@ -8343,6 +8358,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
8343
8358
  let timedOut = false;
8344
8359
  let turnCompletionIdleTimedOut = false;
8345
8360
  let turnWatchTimeoutKind;
8361
+ let turnWatchTimeoutIdleMs;
8362
+ let turnWatchTimeoutMs;
8363
+ let turnWatchTimeoutLastActivityReason;
8364
+ let turnWatchTimeoutDetails;
8346
8365
  let turnCompletionIdleTimeoutMessage;
8347
8366
  let clientClosedPromptError;
8348
8367
  let clientClosedAbort = false;
@@ -8403,6 +8422,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
8403
8422
  timedOut = true;
8404
8423
  turnCompletionIdleTimedOut = true;
8405
8424
  turnWatchTimeoutKind = timeout.kind;
8425
+ turnWatchTimeoutIdleMs = timeout.idleMs;
8426
+ turnWatchTimeoutMs = timeout.timeoutMs;
8427
+ turnWatchTimeoutLastActivityReason = timeout.lastActivityReason;
8428
+ turnWatchTimeoutDetails = timeout.details;
8406
8429
  turnCompletionIdleTimeoutMessage = "codex app-server turn idle timed out waiting for turn/completed";
8407
8430
  },
8408
8431
  onMarkTimedOut: () => projectorRef.current?.markTimedOut(),
@@ -9197,7 +9220,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
9197
9220
  await notificationQueue;
9198
9221
  const result = activeProjector.buildResult(toolBridge.telemetry, { yieldDetected });
9199
9222
  const finalAborted = result.aborted || runAbortController.signal.aborted && !clientClosedAbort;
9200
- let finalPromptError = clientClosedPromptError ?? (turnCompletionIdleTimedOut ? turnCompletionIdleTimeoutMessage : timedOut ? "codex app-server attempt timed out" : result.promptError);
9223
+ const canUseCompletedAssistantTextAfterClientClose = activeProjector.hasCompletedTerminalAssistantText() && activeAppServerTurnRequests === 0 && activeTurnItemIds.size === 0 && pendingOpenClawDynamicToolCompletionIds.size === 0;
9224
+ const clientClosedPromptErrorForFinal = clientClosedPromptError && canUseCompletedAssistantTextAfterClientClose ? void 0 : clientClosedPromptError;
9225
+ let finalPromptError = clientClosedPromptErrorForFinal ?? (turnCompletionIdleTimedOut ? turnCompletionIdleTimeoutMessage : timedOut ? "codex app-server attempt timed out" : result.promptError);
9201
9226
  const finalPromptErrorMessage = typeof finalPromptError === "string" ? finalPromptError : finalPromptError ? formatErrorMessage(finalPromptError) : void 0;
9202
9227
  if (isInvalidCodexImagePayloadError(finalPromptErrorMessage)) await clearCodexBindingAfterInvalidImagePayload(activeSessionFile, {
9203
9228
  phase: "turn_completed",
@@ -9226,13 +9251,20 @@ async function runCodexAppServerAttempt(params, options = {}) {
9226
9251
  signal: runAbortController.signal
9227
9252
  });
9228
9253
  if (refreshedUsageLimitPromptError) finalPromptError = refreshedUsageLimitPromptError;
9229
- const finalPromptErrorSource = timedOut || clientClosedPromptError ? "prompt" : result.promptErrorSource;
9230
- const codexAppServerFailureKind = clientClosedPromptError ? "client_closed_before_turn_completed" : turnCompletionIdleTimedOut ? "turn_completion_idle_timeout" : void 0;
9254
+ const finalPromptErrorSource = timedOut || clientClosedPromptErrorForFinal ? "prompt" : result.promptErrorSource;
9255
+ const codexAppServerFailureKind = clientClosedPromptErrorForFinal ? "client_closed_before_turn_completed" : turnCompletionIdleTimedOut ? "turn_completion_idle_timeout" : void 0;
9231
9256
  const codexAppServerReplayBlockedReason = codexAppServerFailureKind ? resolveCodexAppServerReplayBlockedReason(result) : void 0;
9232
9257
  const promptTimeoutOutcome = buildCodexAppServerPromptTimeoutOutcome({
9233
9258
  result,
9234
- turnCompletionIdleTimedOut
9259
+ turnCompletionIdleTimedOut,
9260
+ turnWatchTimeoutKind
9235
9261
  });
9262
+ const codexAppServerFailureDiagnostics = codexAppServerFailureKind === "turn_completion_idle_timeout" && turnWatchTimeoutKind === "completion" ? buildCodexAppServerTimeoutDiagnostics({
9263
+ idleMs: turnWatchTimeoutIdleMs,
9264
+ timeoutMs: turnWatchTimeoutMs,
9265
+ lastActivityReason: turnWatchTimeoutLastActivityReason,
9266
+ details: turnWatchTimeoutDetails
9267
+ }) : void 0;
9236
9268
  const modelCallFailureKind = classifyCodexModelCallFailureKind({
9237
9269
  error: finalPromptError,
9238
9270
  timedOut,
@@ -9363,7 +9395,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
9363
9395
  threadId: thread.threadId,
9364
9396
  turnId: activeTurnId,
9365
9397
  replaySafe: codexAppServerReplayBlockedReason === void 0,
9366
- ...codexAppServerReplayBlockedReason ? { replayBlockedReason: codexAppServerReplayBlockedReason } : {}
9398
+ ...codexAppServerReplayBlockedReason ? { replayBlockedReason: codexAppServerReplayBlockedReason } : {},
9399
+ ...codexAppServerFailureDiagnostics ? { diagnostics: codexAppServerFailureDiagnostics } : {}
9367
9400
  } } : {},
9368
9401
  ...promptTimeoutOutcome ? { promptTimeoutOutcome } : {},
9369
9402
  systemPromptReport
@@ -9472,6 +9505,36 @@ function waitForCodexNotificationDispatchTurn() {
9472
9505
  setImmediate(resolve);
9473
9506
  });
9474
9507
  }
9508
+ function buildCodexAppServerTimeoutDiagnostics(params) {
9509
+ const readString = (key) => {
9510
+ const value = params.details?.[key];
9511
+ return typeof value === "string" && value.trim() ? value : void 0;
9512
+ };
9513
+ const readNumber = (key) => {
9514
+ const value = params.details?.[key];
9515
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
9516
+ };
9517
+ const readBoolean = (key) => {
9518
+ const value = params.details?.[key];
9519
+ return typeof value === "boolean" ? value : void 0;
9520
+ };
9521
+ return {
9522
+ ...params.idleMs !== void 0 ? { idleMs: params.idleMs } : {},
9523
+ ...params.timeoutMs !== void 0 ? { timeoutMs: params.timeoutMs } : {},
9524
+ ...params.lastActivityReason ? { lastActivityReason: params.lastActivityReason } : {},
9525
+ ...readString("lastNotificationMethod") ? { lastNotificationMethod: readString("lastNotificationMethod") } : {},
9526
+ ...readString("lastNotificationItemId") ? { lastNotificationItemId: readString("lastNotificationItemId") } : {},
9527
+ ...readString("lastNotificationItemType") ? { lastNotificationItemType: readString("lastNotificationItemType") } : {},
9528
+ ...readString("lastNotificationItemRole") ? { lastNotificationItemRole: readString("lastNotificationItemRole") } : {},
9529
+ ...readString("lastAssistantTextPreview") ? { lastAssistantTextPreview: readString("lastAssistantTextPreview") } : {},
9530
+ ...readNumber("activeAppServerTurnRequests") !== void 0 ? { activeAppServerTurnRequests: readNumber("activeAppServerTurnRequests") } : {},
9531
+ ...readNumber("activeTurnItemCount") !== void 0 ? { activeTurnItemCount: readNumber("activeTurnItemCount") } : {},
9532
+ ...readBoolean("terminalTurnNotificationQueued") !== void 0 ? { terminalTurnNotificationQueued: readBoolean("terminalTurnNotificationQueued") } : {},
9533
+ ...readBoolean("completionIdleWatchArmed") !== void 0 ? { completionIdleWatchArmed: readBoolean("completionIdleWatchArmed") } : {},
9534
+ ...readBoolean("assistantCompletionIdleWatchArmed") !== void 0 ? { assistantCompletionIdleWatchArmed: readBoolean("assistantCompletionIdleWatchArmed") } : {},
9535
+ ...readBoolean("terminalIdleWatchArmed") !== void 0 ? { terminalIdleWatchArmed: readBoolean("terminalIdleWatchArmed") } : {}
9536
+ };
9537
+ }
9475
9538
  function handleApprovalRequest(params) {
9476
9539
  return handleCodexAppServerApprovalRequest({
9477
9540
  method: params.method,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.6.5-beta.1",
3
+ "version": "2026.6.5-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/codex",
9
- "version": "2026.6.5-beta.1",
9
+ "version": "2026.6.5-beta.2",
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.6.5-beta.1",
3
+ "version": "2026.6.5-beta.2",
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.6.5-beta.1"
29
+ "pluginApi": ">=2026.6.5-beta.2"
30
30
  },
31
31
  "build": {
32
- "openclawVersion": "2026.6.5-beta.1"
32
+ "openclawVersion": "2026.6.5-beta.2"
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.6.5-beta.1"
50
+ "openclaw": ">=2026.6.5-beta.2"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "openclaw": {