openclaw - ✅(Solved) Fix [Feature]: Add callback-settled signal for remote OpenAI Codex OAuth prompts [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#81405Fetched 2026-05-14 03:32:37
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
1
Author
Timeline (top)
renamed ×2commented ×1cross-referenced ×1

Remote OpenAI Codex OAuth should eventually expose an explicit browser-callback-settled signal so OpenClaw can dismiss a visible manual paste prompt when SSH-tunneled sign-in completes automatically.

This is a longer-term prompt lifecycle improvement for the OpenAI Codex / ChatGPT OAuth provider. It is not required for the near-term copy-only fix in #81301.

Root Cause

  1. Remote/VPS flow shows the auth URL and paste input immediately.
  2. Paste-only users can paste the redirect URL immediately.
  3. SSH-tunneled users can still complete automatically through the browser callback.
  4. When the browser callback is received, OpenClaw dismisses or cancels the manual paste prompt because no pasted input is needed anymore.
  5. Local non-remote browser flows keep their existing delayed manual fallback behavior.

Fix Action

Fix / Workaround

Maintainer impact: A proper contract would keep prompt lifecycle logic clear and avoid future workarounds based on token exchange timing, global fetch wrapping, or arbitrary delays.

PR fix notes

PR #81301: fix(openai): clarify remote Codex OAuth prompt

Description (problem / solution / changelog)

Summary

  • Problem: Remote/VPS OpenAI Codex OAuth copy said to paste after signing in, but SSH-tunneled users can have the browser callback complete automatically before they paste anything.
  • What changed: The remote note now gives paste-first instructions for the redirect URL and adds a final caveat that sign-in may finish automatically if the OpenClaw process can receive the browser callback.
  • What did NOT change: manualInputPromptMessage, OAuth timing, callback handling, prompt cancellation, token exchange behavior, provider contracts, and config surface are unchanged.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Related #81405
  • This PR fixes a bug or regression

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: OpenAI Codex OAuth in a remote/VPS shell should present the redirect-URL paste path first, while warning SSH-tunneled users that sign-in may still finish automatically before they paste.
  • Real environment tested: Local OpenClaw source checkout on Linux at PR head c7285edebb5611c461dd3895fd114ece7cada5a2, Node v22.22.2. The proof command inspected the production core provider and bundled OpenAI plugin runtime strings that ship this user-visible copy.
  • Exact steps or command run after this patch: node <<'NODE' ... verify production OpenAI Codex OAuth prompt strings, unchanged manual prompt, and old remote fallback-first wording absence ... NODE
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Console output from the source-string smoke at the PR head:
head: c7285edebb5611c461dd3895fd114ece7cada5a2
node: v22.22.2
remote note: A URL will be shown for you to open in your LOCAL browser. / 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.
manual prompt unchanged from origin/main: Paste the authorization code (or full redirect URL):
old remote fallback-first wording present: no
  • Observed result after fix: Both OpenAI Codex OAuth implementations now present redirect-URL paste as the primary remote instruction, preserve LOCAL browser emphasis, and mention automatic callback completion only as the tunneled-case caveat. The manual input prompt remains the current origin/main text.
  • What was not tested: A live third-party OpenAI browser/account login; this PR changes only displayed text and does not change OAuth control flow.
  • Before evidence (optional but encouraged): Current base remote note contains After signing in, paste the redirect URL back here. in src/plugins/provider-openai-codex-oauth.ts and extensions/openai/openai-codex-oauth.runtime.ts.

Root Cause (if applicable)

  • Root cause: The remote/VPS copy was written for paste-only remote/headless setups, but SSH port forwarding can make the local OAuth callback reachable from the user's local browser.
  • Missing detection / guardrail: The test suite did not lock the remote explanatory copy against the intended paste-first wording plus tunneled-callback caveat.
  • Contributing context (if known): No-tunnel users still need paste instructions immediately, so delaying or hiding paste would regress that path.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/plugins/provider-openai-codex-oauth.test.ts
  • Scenario the test should lock in: Remote OpenAI Codex OAuth notes describe redirect-URL paste as the primary remote path and automatic callback completion as a possible tunneled-case outcome.
  • Why this is the smallest reliable guardrail: The bug is the displayed provider-owned copy, not OAuth transport behavior.
  • Existing test that already covers this (if any): Existing remote manual-input tests covered the prompt path but not the explanatory note wording.
  • If no new test is added, why not: N/A; a regression assertion was added.

User-visible / Behavior Changes

Remote OpenAI Codex OAuth wording now tells users to open the URL in their LOCAL browser, sign in, and paste the redirect URL. It also warns that sign-in may finish automatically before paste if the browser callback can reach OpenClaw. The manual paste prompt text itself is unchanged.

Diagram (if applicable)

Before:
remote auth URL -> copy says paste after sign-in -> tunneled callback may still complete automatically -> confusing stale expectation

After:
remote auth URL -> paste-first redirect URL instruction -> optional auto-completion caveat for tunneled callbacks

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: Node v22.22.2, pnpm repo wrapper
  • Model/provider: OpenAI Codex OAuth provider copy
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Steps

  1. Compare the remote OpenAI Codex OAuth note and manual input prompt on origin/main.
  2. Apply this patch.
  3. Run the source-string smoke, focused provider test, whitespace check, and Codex review.

Expected

  • Remote copy gives paste-first redirect URL instructions and separately warns that callback completion may happen automatically for tunneled setups.
  • The manual paste prompt is unchanged.

Actual

  • Remote copy and regression test match that expectation.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Verification

  • pnpm exec oxfmt --write --threads=1 src/plugins/provider-openai-codex-oauth.ts src/plugins/provider-openai-codex-oauth.test.ts extensions/openai/openai-codex-oauth.runtime.ts
  • pnpm test src/plugins/provider-openai-codex-oauth.test.ts -- --reporter=verbose (17 tests passed)
  • git diff --check origin/main...HEAD
  • source-string smoke for core provider and bundled OpenAI plugin runtime, including unchanged manual prompt proof
  • codex review --base origin/main (clean on the current head)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: The exact production copy at the PR head, focused provider tests, source-string smoke for both implementations, and local Codex review.
  • Edge cases checked: The old fallback-first remote wording is absent from both the core provider and bundled OpenAI plugin runtime; manualInputPromptMessage remains identical to origin/main; no OAuth lifecycle code changed.
  • What you did not verify: A live third-party OpenAI browser/account login.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

The existing top-level ClawSweeper comment refers to the previous callback-cancellation implementation. This branch has since been rewritten to the narrower wording-only patch and should receive fresh automation/maintainer review on the new head.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: The prompt can still remain visible after an SSH-forwarded callback succeeds, because this PR intentionally avoids the heavier callback-cancellation implementation.
    • Mitigation: The wording now warns that automatic completion may happen before paste; #81405 tracks the optional longer-term contract if maintainers want active prompt dismissal later.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/openai/openai-codex-oauth.runtime.ts (modified, +2/-1)
  • src/plugins/provider-openai-codex-oauth.test.ts (modified, +18/-0)
  • src/plugins/provider-openai-codex-oauth.ts (modified, +2/-1)
RAW_BUFFERClick to expand / collapse

Summary

Remote OpenAI Codex OAuth should eventually expose an explicit browser-callback-settled signal so OpenClaw can dismiss a visible manual paste prompt when SSH-tunneled sign-in completes automatically.

This is a longer-term prompt lifecycle improvement for the OpenAI Codex / ChatGPT OAuth provider. It is not required for the near-term copy-only fix in #81301.

Current behavior

Remote OpenAI Codex OAuth has two valid completion paths:

  • Paste-only/headless users open the auth URL in their local browser, sign in, then paste the redirect URL back into OpenClaw. The existing manual prompt may also accept an authorization code; #81301 intentionally does not change that prompt text or parser behavior.
  • SSH-forwarded callback users open the auth URL in their local browser and the browser callback can reach the OpenClaw process, so onboarding may continue automatically without pasted input.

Auth is already correct in the SSH-tunneled case. The remaining UX issue is that a manual paste prompt can be visible even though the browser callback already completed sign-in.

Problem to solve

OpenClaw can explain both remote paths in copy, but the current OAuth helper does not expose a clean event for "the browser callback won." Without that event, OpenClaw cannot reliably cancel or dismiss a manual paste prompt once pasted input is no longer needed.

Desired behavior

A future implementation should be able to do this without timing hacks or token-endpoint inference:

  1. Remote/VPS flow shows the auth URL and paste input immediately.
  2. Paste-only users can paste the redirect URL immediately.
  3. SSH-tunneled users can still complete automatically through the browser callback.
  4. When the browser callback is received, OpenClaw dismisses or cancels the manual paste prompt because no pasted input is needed anymore.
  5. Local non-remote browser flows keep their existing delayed manual fallback behavior.

Possible design

Add or adopt an explicit callback-settled contract for OpenAI Codex OAuth. Possible shapes:

  • onCallbackCodeReceived / onBrowserCallbackSettled fired when the local callback receives and validates the callback payload
  • a lower-level helper that returns { authUrl, waitForCallback, exchangeCode } so OpenClaw can race browser callback and manual paste itself
  • an upstream-supported abort/cancellation signal for onManualCodeInput when the browser callback wins

The important contract is the event, not the exact API name: OpenClaw needs a provider-owned signal that manual paste input is no longer necessary.

Non-goals

  • Do not delay the remote paste prompt; paste-only users rely on it.
  • Do not require paste for SSH-tunneled users whose browser callback already works.
  • Do not add a config flag unless maintainers find two genuinely supported behaviors that cannot share one safe default.
  • Do not move broad OpenAI Codex OAuth ownership into core; owner-specific behavior should stay in the OpenAI provider/plugin path.

Alternatives considered

  • Copy-only short-term fix: #81301 updates the remote note to say paste the redirect URL first, with a caveat that sign-in may finish automatically before paste. This is safe because it changes wording only.
  • Monitor OpenAI Codex token-exchange traffic to infer that the callback won. This can work against today's implementation, but couples prompt lifecycle to downstream token request details instead of the callback event.
  • Delay the remote paste prompt. This improves the tunneled case but makes paste-only users wait before they can do the only thing that will complete auth.
  • Always require paste in remote mode. This removes stale prompt ambiguity but regresses users whose SSH-forwarded callback works.
  • Internalize the full OpenAI Codex OAuth flow in OpenClaw. This would expose the event but increases ownership and drift from the upstream helper.

Impact

Affected users: Remote/VPS users authenticating with the OpenAI Codex / ChatGPT OAuth provider.

Severity: Low to medium. SSH-tunneled auth can already succeed; the issue is stale/confusing UI when a manual prompt remains visible after automatic callback completion.

Frequency: Any remote OpenAI Codex OAuth login where some users are paste-only and others have a working SSH-forwarded callback.

Maintainer impact: A proper contract would keep prompt lifecycle logic clear and avoid future workarounds based on token exchange timing, global fetch wrapping, or arbitrary delays.

Acceptance criteria

  • Remote OpenAI Codex OAuth still presents paste input immediately.
  • Browser callback completion can cancel/dismiss the manual paste prompt without pasted input.
  • The implementation does not rely on monitoring OpenAI token-exchange requests as the primary success signal.
  • Paste-only and SSH-forwarded callback paths are both covered by focused tests or equivalent proof.
  • Any shared prompt-cancellation seam is generic, while OpenAI-specific OAuth behavior remains owned by the OpenAI provider/plugin.

Related work

  • #81301 updates the near-term remote prompt wording so first-time users see redirect-URL paste instructions plus an automatic-completion caveat. It does not change manualInputPromptMessage or OAuth control flow.
  • #51631 added earlier remote manual-input integration.
  • #80963 covers adjacent fixed-port callback UX.
  • #47750 covers adjacent non-interactive Codex OAuth needs.

Duplicate search performed before filing:

  • gh search issues --repo openclaw/openclaw --match title,body -- "OpenAI Codex OAuth manual prompt callback"
  • gh search issues --repo openclaw/openclaw --match title,body -- "OAuth onManualCodeInput callback token exchange"
  • gh search issues --repo openclaw/openclaw --match title,body -- "openai-codex oauth"
  • gh search prs --repo openclaw/openclaw --match title,body -- "onManualCodeInput"

No existing issue was found for this callback-settled prompt contract.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Feature]: Add callback-settled signal for remote OpenAI Codex OAuth prompts [1 pull requests, 1 comments, 2 participants]