From c62a1eb1514d99fcb0d6fb16e2d28268a2ab9417 Mon Sep 17 00:00:00 2001 From: Haoqing Wang <78337154+hqhq1025@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:44:06 +0800 Subject: [PATCH] fix(cli,hub): resolve typecheck errors in codex reasoning effort (#432) * fix(cli,hub): resolve typecheck errors in codex reasoning effort and notification test - Cast `getModelReasoningEffort()` return (string | null) to `ReasoningEffort | undefined` at three call sites in codexLocalLauncher.ts and runCodex.ts where the narrower type is expected. - Add missing `modelReasoningEffort: null` default in notificationHub.test.ts to satisfy the Session type contract. These errors were introduced in 79a13d2 and have been failing CI on main since 2026-04-10. * fix(cli): add missing getModelReasoningEffort to test mock session The test stub in codexLocalLauncher.test.ts was missing the getModelReasoningEffort method added in 79a13d2, causing runtime TypeError in CI. --- cli/src/codex/codexLocalLauncher.test.ts | 1 + cli/src/codex/codexLocalLauncher.ts | 3 ++- cli/src/codex/runCodex.ts | 4 ++-- hub/src/notifications/notificationHub.test.ts | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/src/codex/codexLocalLauncher.test.ts b/cli/src/codex/codexLocalLauncher.test.ts index 5a72c179..98741bab 100644 --- a/cli/src/codex/codexLocalLauncher.test.ts +++ b/cli/src/codex/codexLocalLauncher.test.ts @@ -79,6 +79,7 @@ function createSessionStub(permissionMode: 'default' | 'read-only' | 'safe-yolo' } }, getPermissionMode: () => permissionMode, + getModelReasoningEffort: () => null, onSessionFound: () => {}, sendSessionEvent: (event: { type: string; message?: string }) => { sessionEvents.push(event); diff --git a/cli/src/codex/codexLocalLauncher.ts b/cli/src/codex/codexLocalLauncher.ts index 8f05ae91..e13ae75b 100644 --- a/cli/src/codex/codexLocalLauncher.ts +++ b/cli/src/codex/codexLocalLauncher.ts @@ -1,5 +1,6 @@ import { logger } from '@/ui/logger'; import { codexLocal } from './codexLocal'; +import type { ReasoningEffort } from './appServerTypes'; import { CodexSession } from './session'; import { createCodexSessionScanner } from './utils/codexSessionScanner'; import { convertCodexEvent } from './utils/codexEventConverter'; @@ -42,7 +43,7 @@ export async function codexLocalLauncher(session: CodexSession): Promise<'switch await codexLocal({ path: session.path, sessionId: resumeSessionId, - modelReasoningEffort: session.getModelReasoningEffort() ?? undefined, + modelReasoningEffort: (session.getModelReasoningEffort() ?? undefined) as ReasoningEffort | undefined, onSessionFound: handleSessionFound, abort: abortSignal, codexArgs, diff --git a/cli/src/codex/runCodex.ts b/cli/src/codex/runCodex.ts index c62b28ba..5f11f642 100644 --- a/cli/src/codex/runCodex.ts +++ b/cli/src/codex/runCodex.ts @@ -82,7 +82,7 @@ export async function runCodex(opts: { } const sessionModelReasoningEffort = sessionInstance.getModelReasoningEffort(); if (sessionModelReasoningEffort !== undefined) { - currentModelReasoningEffort = sessionModelReasoningEffort ?? undefined; + currentModelReasoningEffort = (sessionModelReasoningEffort ?? undefined) as ReasoningEffort | undefined; } sessionInstance.setPermissionMode(currentPermissionMode); sessionInstance.setModel(currentModel ?? null); @@ -106,7 +106,7 @@ export async function runCodex(opts: { } const sessionModelReasoningEffort = sessionWrapperRef.current?.getModelReasoningEffort(); if (sessionModelReasoningEffort !== undefined) { - currentModelReasoningEffort = sessionModelReasoningEffort ?? undefined; + currentModelReasoningEffort = (sessionModelReasoningEffort ?? undefined) as ReasoningEffort | undefined; } const sessionCollaborationMode = sessionWrapperRef.current?.getCollaborationMode(); if (sessionCollaborationMode) { diff --git a/hub/src/notifications/notificationHub.test.ts b/hub/src/notifications/notificationHub.test.ts index 4dfad8a7..0cfaa7c4 100644 --- a/hub/src/notifications/notificationHub.test.ts +++ b/hub/src/notifications/notificationHub.test.ts @@ -58,6 +58,7 @@ function createSession(overrides: Partial = {}): Session { thinking: false, thinkingAt: 0, model: null, + modelReasoningEffort: null, effort: null, ...overrides }