Skip to content

fix(auth): support remote Codex OAuth manual input#51631

Merged
obviyus merged 2 commits into
openclaw:mainfrom
cash-echo-bot:fix/codex-oauth-remote-manual-input
Mar 21, 2026
Merged

fix(auth): support remote Codex OAuth manual input#51631
obviyus merged 2 commits into
openclaw:mainfrom
cash-echo-bot:fix/codex-oauth-remote-manual-input

Conversation

@cash-echo-bot

Copy link
Copy Markdown
Contributor

Summary

Fix remote/VPS OpenAI Codex OAuth after the @mariozechner/pi-ai@0.60.0 auth flow changes.

This wires OpenClaw's remote Codex OAuth wrapper into Pi's newer manual-input path by passing onManualCodeInput when isRemote is true.

Closes #51630.

What changed

  • pass onManualCodeInput through src/plugins/provider-openai-codex-oauth.ts for remote flows
  • add/update tests to cover the remote manual input hook
  • keep local authorize URL handling coverage intact

Why

Pi 0.60.0 changed Codex OAuth behavior around callback/manual input handling. OpenClaw had updated the dependency, but the wrapper code was still using the older integration pattern.

That meant remote OAuth could stall/fail instead of cleanly accepting the pasted authorization code or redirect URL.

Testing

  • pnpm -C /home/cash/src/clawdis test src/commands/openai-codex-oauth.test.ts

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Mar 21, 2026
@greptile-apps

greptile-apps Bot commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR correctly fixes remote/VPS Codex OAuth by wiring the onManualCodeInput callback introduced in @mariozechner/pi-ai@0.60.0, ensuring that Pi's newer manual-input path receives a handler for remote flows instead of stalling.

Key changes:

  • src/plugins/provider-openai-codex-oauth.ts: Passes onManualCodeInput (delegating to onPrompt) when isRemote === true, and undefined for local flows — matching Pi's new API contract.
  • src/commands/openai-codex-oauth.test.ts: Removes the createVpsAwareOAuthHandlers mock (now using the real implementation), adds prompter.text to the test fixture, and adds a new integration-style test that verifies the full remote onManualCodeInputonPromptprompter.text round-trip.

One minor note: The message: "Paste the authorization code (or full redirect URL):" string passed inside onManualCodeInput is effectively dead code in normal operation — onPrompt short-circuits with the cached manualCodePromise started by onAuth, so the actual prompt users see is "Paste the redirect URL" from createVpsAwareOAuthHandlers. No user-facing impact, but worth aligning for clarity.

Confidence Score: 5/5

  • Safe to merge — the fix is correct and well-tested with no regressions introduced.
  • The core change is minimal and targeted: a single onManualCodeInput field added for remote flows. The integration tests cover the new path end-to-end using the real createVpsAwareOAuthHandlers, the existing local-flow tests continue to pass, and the only open comment is a P2 style suggestion about a dead message string with no user-visible impact.
  • No files require special attention.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugins/provider-openai-codex-oauth.ts
Line: 56-59

Comment:
**Dead message string in `onManualCodeInput`**

The `message: "Paste the authorization code (or full redirect URL):"` passed to `onPrompt` here is never shown to users in the normal remote OAuth flow.

In `createVpsAwareOAuthHandlers`, when `isRemote === true`, `onAuth` eagerly fires `prompter.text({ message: "Paste the redirect URL", ... })` and caches the result in `manualCodePromise`. When `onManualCodeInput` later calls `onPrompt(...)`, `onPrompt` short-circuits — it returns `manualCodePromise` immediately without consuming the `message` parameter (see `provider-oauth-flow.ts:42-43`).

This string would only surface if Pi called `onManualCodeInput` before `onAuth` (which the tests don't cover and the normal flow doesn't do). Consider passing the desired prompt text through `createVpsAwareOAuthHandlers` via its existing `manualPromptMessage` option instead, so there's a single source of truth for what users see.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "fix(auth): support r..."

Comment on lines +56 to +59
? async () =>
await onPrompt({
message: "Paste the authorization code (or full redirect URL):",
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Dead message string in onManualCodeInput

The message: "Paste the authorization code (or full redirect URL):" passed to onPrompt here is never shown to users in the normal remote OAuth flow.

In createVpsAwareOAuthHandlers, when isRemote === true, onAuth eagerly fires prompter.text({ message: "Paste the redirect URL", ... }) and caches the result in manualCodePromise. When onManualCodeInput later calls onPrompt(...), onPrompt short-circuits — it returns manualCodePromise immediately without consuming the message parameter (see provider-oauth-flow.ts:42-43).

This string would only surface if Pi called onManualCodeInput before onAuth (which the tests don't cover and the normal flow doesn't do). Consider passing the desired prompt text through createVpsAwareOAuthHandlers via its existing manualPromptMessage option instead, so there's a single source of truth for what users see.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/plugins/provider-openai-codex-oauth.ts
Line: 56-59

Comment:
**Dead message string in `onManualCodeInput`**

The `message: "Paste the authorization code (or full redirect URL):"` passed to `onPrompt` here is never shown to users in the normal remote OAuth flow.

In `createVpsAwareOAuthHandlers`, when `isRemote === true`, `onAuth` eagerly fires `prompter.text({ message: "Paste the redirect URL", ... })` and caches the result in `manualCodePromise`. When `onManualCodeInput` later calls `onPrompt(...)`, `onPrompt` short-circuits — it returns `manualCodePromise` immediately without consuming the `message` parameter (see `provider-oauth-flow.ts:42-43`).

This string would only surface if Pi called `onManualCodeInput` before `onAuth` (which the tests don't cover and the normal flow doesn't do). Consider passing the desired prompt text through `createVpsAwareOAuthHandlers` via its existing `manualPromptMessage` option instead, so there's a single source of truth for what users see.

How can I resolve this? If you propose a fix, please make it concise.

@obviyus obviyus self-assigned this Mar 21, 2026
@obviyus obviyus force-pushed the fix/codex-oauth-remote-manual-input branch from 0449aa7 to 9d04a0a Compare March 21, 2026 14:10
@obviyus obviyus merged commit 11aff6e into openclaw:main Mar 21, 2026
13 checks passed
@obviyus

obviyus commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Landed on main.

Thanks @cash-echo-bot.

frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(auth): support remote codex oauth manual input

* fix: support remote Codex OAuth manual input (openclaw#51631) (thanks @cash-echo-bot)

---------

Co-authored-by: Cash Williams <cashwilliams@gmail.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(auth): support remote Codex OAuth manual input with pi-ai 0.60.0

3 participants