From 3922396bc4e5800a1a6525073074bccfc77e5114 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Thu, 25 Sep 2025 18:45:28 -0600 Subject: [PATCH] fix(codex): improve oauth error guidance and correct comment on default reasoning effort --- src/api/providers/openai-native-codex.ts | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/api/providers/openai-native-codex.ts b/src/api/providers/openai-native-codex.ts index 1b17b0acd9..6039d111be 100644 --- a/src/api/providers/openai-native-codex.ts +++ b/src/api/providers/openai-native-codex.ts @@ -112,24 +112,26 @@ export class OpenAiNativeCodexHandler extends BaseProvider { try { raw = await fs.readFile(explicitPath, "utf8") } catch (e: any) { - throw new Error( - t("common:errors.openaiNativeCodex.oauthReadFailed", { - path: explicitPath, - error: e?.message || String(e), - }), - ) + const base = t("common:errors.openaiNativeCodex.oauthReadFailed", { + path: explicitPath, + error: e?.message || String(e), + }) + const tip = + " Tip: Authenticate with the Codex CLI to generate auth.json (defaults to ~/.codex/auth.json), then retry." + throw new Error(base + tip) } let j: any try { j = JSON.parse(raw) } catch (e: any) { - throw new Error( - t("common:errors.openaiNativeCodex.oauthParseFailed", { - path: explicitPath, - error: e?.message || String(e), - }), - ) + const base = t("common:errors.openaiNativeCodex.oauthParseFailed", { + path: explicitPath, + error: e?.message || String(e), + }) + const tip = + " Tip: Ensure the file is valid JSON or re-authenticate via the Codex CLI to regenerate auth.json." + throw new Error(base + tip) } const tokens = (j?.tokens as any) || {} @@ -277,8 +279,8 @@ export class OpenAiNativeCodexHandler extends BaseProvider { metadata?: ApiHandlerCreateMessageMetadata, ) { // For Codex provider: - // - Regular "gpt-5" should default to minimal reasoning unless explicitly overridden in settings. - // - The "gpt-5-codex" variant should NOT force minimal; use provided/default effort. + // - Use the model's default reasoning effort (currently "medium") unless explicitly overridden in settings. + // - Both "gpt-5" and "gpt-5-codex" follow the provided/default effort without forcing "minimal". let effectiveEffort: ReasoningEffortWithMinimal | undefined = reasoningEffort const body: any = {