Skip to content

Commit 88aaeef

Browse files
committed
fix(codex): improve oauth error guidance and correct comment on default reasoning effort
1 parent d27575a commit 88aaeef

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/api/providers/openai-native-codex.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,26 @@ export class OpenAiNativeCodexHandler extends BaseProvider {
112112
try {
113113
raw = await fs.readFile(explicitPath, "utf8")
114114
} catch (e: any) {
115-
throw new Error(
116-
t("common:errors.openaiNativeCodex.oauthReadFailed", {
117-
path: explicitPath,
118-
error: e?.message || String(e),
119-
}),
120-
)
115+
const base = t("common:errors.openaiNativeCodex.oauthReadFailed", {
116+
path: explicitPath,
117+
error: e?.message || String(e),
118+
})
119+
const tip =
120+
" Tip: Authenticate with the Codex CLI to generate auth.json (defaults to ~/.codex/auth.json), then retry."
121+
throw new Error(base + tip)
121122
}
122123

123124
let j: any
124125
try {
125126
j = JSON.parse(raw)
126127
} catch (e: any) {
127-
throw new Error(
128-
t("common:errors.openaiNativeCodex.oauthParseFailed", {
129-
path: explicitPath,
130-
error: e?.message || String(e),
131-
}),
132-
)
128+
const base = t("common:errors.openaiNativeCodex.oauthParseFailed", {
129+
path: explicitPath,
130+
error: e?.message || String(e),
131+
})
132+
const tip =
133+
" Tip: Ensure the file is valid JSON or re-authenticate via the Codex CLI to regenerate auth.json."
134+
throw new Error(base + tip)
133135
}
134136

135137
const tokens = (j?.tokens as any) || {}
@@ -277,8 +279,8 @@ export class OpenAiNativeCodexHandler extends BaseProvider {
277279
metadata?: ApiHandlerCreateMessageMetadata,
278280
) {
279281
// For Codex provider:
280-
// - Regular "gpt-5" should default to minimal reasoning unless explicitly overridden in settings.
281-
// - The "gpt-5-codex" variant should NOT force minimal; use provided/default effort.
282+
// - Use the model's default reasoning effort (currently "medium") unless explicitly overridden in settings.
283+
// - Both "gpt-5" and "gpt-5-codex" follow the provided/default effort without forcing "minimal".
282284
let effectiveEffort: ReasoningEffortWithMinimal | undefined = reasoningEffort
283285

284286
const body: any = {

0 commit comments

Comments
 (0)