fix(openai): clarify remote Codex OAuth prompt

This commit is contained in:
Rubén Cuevas
2026-05-13 13:06:55 +00:00
committed by Peter Steinberger
parent 48fb4bade8
commit 83549774cd
3 changed files with 22 additions and 2 deletions

View File

@@ -278,7 +278,8 @@ export async function loginOpenAICodexOAuth(params: {
? [
"You are running in a remote/VPS environment.",
"A URL will be shown for you to open in your LOCAL browser.",
"After signing in, paste the redirect URL back here.",
"Open it, sign in, then paste the redirect URL here.",
"If this OpenClaw process can receive the browser callback, sign-in may finish automatically before you paste.",
].join("\n")
: [
"Browser will open for OpenAI authentication.",

View File

@@ -212,6 +212,24 @@ describe("loginOpenAICodexOAuth", () => {
);
});
it("describes remote OAuth paste first while noting automatic callback completion", async () => {
const creds = createCodexCredentials();
mocks.loginOpenAICodex.mockResolvedValue(creds);
const { prompter } = await runCodexOAuth({ isRemote: true });
const noteCalls = (prompter.note as unknown as { mock?: { calls?: Array<Array<unknown>> } })
.mock?.calls;
const [message, title] = noteCalls?.[0] ?? [];
expect(title).toBe("OpenAI Codex OAuth");
expect(message).toContain("A URL will be shown for you to open in your LOCAL browser.");
expect(message).toContain("Open it, sign in, then paste the redirect URL here.");
expect(message).toContain(
"If this OpenClaw process can receive the browser callback, sign-in may finish automatically before you paste.",
);
expect(message).not.toContain("After signing in, paste");
});
it("explains OpenAI unsupported region token exchange failures", async () => {
mocks.loginOpenAICodex.mockRejectedValue(new Error("403 unsupported_country_region_territory"));

View File

@@ -166,7 +166,8 @@ export async function loginOpenAICodexOAuth(params: {
? [
"You are running in a remote/VPS environment.",
"A URL will be shown for you to open in your LOCAL browser.",
"After signing in, paste the redirect URL back here.",
"Open it, sign in, then paste the redirect URL here.",
"If this OpenClaw process can receive the browser callback, sign-in may finish automatically before you paste.",
].join("\n")
: [
"Browser will open for OpenAI authentication.",