Skip to content

fix(auth): return OpenRouter sign-in to the local gateway - #148785

Merged
obviyus merged 1 commit into
mainfrom
codex/oauth-browser-return
Sep 15, 2026
Merged

obviyus merged 1 commit into
mainfrom
codex/oauth-browser-return

Conversation

@obviyus

@obviyus obviyus commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

OpenRouter sign-in from local Models returns to an unserved address. Malformed pasted input ends the attempt.

Why This Change Was Made

The shared callback session selects the attested Gateway address. Manual input uses the existing callback parser.

User Impact

Local browser returns complete sign-in. Invalid pasted input stays editable.

Evidence

Real OpenRouter approval reached the callback and saved an account that remained after reload. Browser checks covered manual correction and cancellation. Telegram Test Server checks covered URL delivery, corrected return, cancellation, and /models, with one synthetic exchange and no generation. The managed HTTPS origin was a fixture; public routing was not exercised. Failure capture.

Real provider return

Compatibility

No public API, configuration, or storage changes. Other addresses retain manual completion. Refs #144491.

Consumers

Models and shared chat authorization. Personal account methods are unchanged.

Invalidation

Disconnect, cancellation, expiry, restart, and managed-origin withdrawal retire authorization.

Tests

All 135 callback, persistence, Models, personal-account, channel-login, and provider tests passed on a fresh merge with main. Type-aware preflight, changed-file lint, formatting, and structural checks passed.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: openrouter size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 15, 2026, 5:10 AM ET / 09:10 UTC (Revision 5).

ClawSweeper review

What this changes

Returns local OpenRouter browser sign-in to the serving Gateway and keeps invalid pasted redirects editable within the same attempt.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR remains useful: current main still has both reported gaps, and no superseding fix was established. No introduced correctness defect was found; security-owner participation remains unverified.

Priority: P2
Reviewed head: 8ae03a126194475b6f6f7abef0f1b54bf861af47
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant real-provider evidence and meaningful regression coverage; ownership verification is separate from patch quality.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The captured evidence reports real OpenRouter approval through Models, receipt by the changed Gateway callback owner, and saved credentials surviving reload; inspected before/after images support the return-path improvement. Reported browser correction and cancellation supplement source coverage; public managed-HTTPS routing was explicitly untested.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The captured evidence reports real OpenRouter approval through Models, receipt by the changed Gateway callback owner, and saved credentials surviving reload; inspected before/after images support the return-path improvement. Reported browser correction and cancellation supplement source coverage; public managed-HTTPS routing was explicitly untested.
Evidence reviewed 10 items Current main still needs the repair: Current main restricts automatic Models completion to the managed HTTPS origin and validates pasted input only for non-emptiness. The PR supplies distinct remaining behavior.
Introduced scope and merge result: The raw test-merge parents match the pinned base followed by the exact PR head. Its result contains only the seven introduced paths; unrelated endpoint drift is not attributed to this PR.
Origin selection and authority preservation: Loopback completion requires direct-local transport attribution, matching browser and Gateway host/port, and HTTP(S). Existing callback state, one-time consumption, expiry, restart, cancellation, and pre-persistence authority checks remain in place.
Findings None None.
Security None None.

How this fits together

Models sign-in sends provider authorization through the Gateway’s shared callback session. OpenRouter exchanges the returned code for a credential, which the existing login owner saves after checking current authority.

flowchart TD
  A[Models sign-in] --> B[Check browser origin]
  B -->|Served loopback or managed HTTPS| C[Gateway callback session]
  B -->|Other address| D[Validated manual redirect]
  C --> E[OpenRouter code exchange]
  D --> E
  E --> F[Current authority check]
  F --> G[Save credential]
Loading

Decision needed

Question Recommendation
Can listed security-owner participation be confirmed for this head's Gateway authentication changes? Confirm security-owner participation: Record that a listed owner authored, requested, or is reviewing these authentication changes before landing.

Why: Repository policy requires that participation, and the available approval marker does not establish the author's security-owner role.

Before merge

  • Resolve merge risk (P1) - Required security-owner involvement remains unverified; the posted admin-merge marker alone does not establish that requirement.
  • Complete next step (P2) - Confirm listed security-owner involvement for the changed Gateway authentication paths; the posted owner-review marker alone does not establish it.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +33, Tests +84, Docs +1. Total +118 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 47 14 +33
Tests 3 93 9 +84
Docs 1 4 3 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 144 26 +118

Review metrics

Metric Value Why it matters
Production versus test growth production net +33 lines; tests net +84 lines Production growth is justified by selecting an attested return address within the existing callback owner.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep callback selection in the shared Gateway owner and manual correction in the existing parser and wizard, preserving caller authority and saved model preferences.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep callback selection in the shared Gateway owner and manual correction in the existing parser and wizard, preserving caller authority and saved model preferences.

Do we have a high-confidence way to reproduce the issue?

Yes: current main sends local Models login through the remote/manual path to localhost:3000 and accepts malformed nonempty input before parsing it terminally. Source inspection and the supplied failure capture establish the mechanism; this review did not execute it.

Is this the best way to solve the issue?

Yes: the patch extends the existing callback owner and reuses the existing parser, avoiding another listener, validator, public API, or configuration option.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 151a13a3e7be.

Labels

Label justifications:

  • P2: This is a bounded provider sign-in repair with existing manual and API-key alternatives.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The captured evidence reports real OpenRouter approval through Models, receipt by the changed Gateway callback owner, and saved credentials surviving reload; inspected before/after images support the return-path improvement. Reported browser correction and cancellation supplement source coverage; public managed-HTTPS routing was explicitly untested.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence reports real OpenRouter approval through Models, receipt by the changed Gateway callback owner, and saved credentials surviving reload; inspected before/after images support the return-path improvement. Reported browser correction and cancellation supplement source coverage; public managed-HTTPS routing was explicitly untested.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The captured evidence reports real OpenRouter approval through Models, receipt by the changed Gateway callback owner, and saved credentials surviving reload; inspected before/after images support the return-path improvement. Reported browser correction and cancellation supplement source coverage; public managed-HTTPS routing was explicitly untested.

Evidence

What I checked:

  • Current main still needs the repair: Current main restricts automatic Models completion to the managed HTTPS origin and validates pasted input only for non-emptiness. The PR supplies distinct remaining behavior. (src/gateway/provider-browser-auth.ts:64, 151a13a3e7be)
  • Introduced scope and merge result: The raw test-merge parents match the pinned base followed by the exact PR head. Its result contains only the seven introduced paths; unrelated endpoint drift is not attributed to this PR. (3785db82ee45)
  • Origin selection and authority preservation: Loopback completion requires direct-local transport attribution, matching browser and Gateway host/port, and HTTP(S). Existing callback state, one-time consumption, expiry, restart, cancellation, and pre-persistence authority checks remain in place. (src/gateway/provider-browser-auth.ts:39, 8ae03a126194)
  • Manual correction uses existing owners: The provider reuses its state-bound callback parser as the prompt validator. WizardSession.answer returns validation errors before removing or resolving the pending input, allowing correction without restarting login. (extensions/openrouter/oauth.ts:222, 8ae03a126194)
  • Inspected real-provider evidence: The captured PR body reports actual OpenRouter approval, callback receipt, and an account retained after reload. Both prepared images were inspected: the linked failure shows localhost connection refusal, and the after image shows the production callback receipt page. The image proves receipt, not persistence by itself; persistence and cancellation are reported in the body. Managed public HTTPS routing was explicitly not exercised. Evidence: fix(auth): return OpenRouter sign-in to the local gateway #148785 (comment) and the body attachment.
  • Meaningful regression coverage: Read all three changed test files. Coverage checks served loopback returns, rejection before opening an unserved return, editable malformed input, disconnect cancellation, and managed-origin withdrawal during device flow. Existing persistence integration coverage also checks cancellation and replay. Tests were not executed during this read-only review. (src/gateway/provider-browser-auth/callback.test.ts:193, 8ae03a126194)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • openclaw/openclaw-secops: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-15T05:10:26.647Z sha 8ae03a1 :: blocked before merge. :: none
  • reviewed 2026-09-15T05:18:09.533Z sha 8ae03a1 :: blocked before merge. :: none
  • reviewed 2026-09-15T07:48:51.550Z sha 8ae03a1 :: blocked before merge. :: none
  • reviewed 2026-09-15T08:08:22.081Z sha 8ae03a1 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 15, 2026
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

OpenRouter browser return reached an unserved local address.

OpenRouter browser return showing ERR_CONNECTION_REFUSED

@clawsweeper clawsweeper Bot removed the proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. label Sep 15, 2026
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 148785
head: 8ae03a1
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 15, 2026 09:04
@obviyus
obviyus requested a review from a team as a code owner September 15, 2026 09:04
@obviyus
obviyus merged commit 0eff93e into main Sep 15, 2026
290 of 291 checks passed
@obviyus
obviyus deleted the codex/oauth-browser-return branch September 15, 2026 09:11
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Proof: Real OpenRouter approval returned to the Gateway, saved an account, and survived reload. Telegram Test Server checks covered callback correction, cancellation, and model listing.

  • Bug: Local browser sign-in returned to an unserved address; malformed pasted input ended the attempt.
  • Fix: The callback session uses the attested Gateway address and keeps invalid input editable.
Before After
Unreachable return or failed pasted input Working local return and correctable input

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…48785)

## What Problem This Solves

OpenRouter sign-in from local Models returns to an unserved address. Malformed pasted input ends the attempt.

## Why This Change Was Made

The shared callback session selects the attested Gateway address. Manual input uses the existing callback parser.

## User Impact

Local browser returns complete sign-in. Invalid pasted input stays editable.

## Evidence

Real OpenRouter approval reached the callback and saved an account that remained after reload. Browser checks covered manual correction and cancellation. Telegram Test Server checks covered URL delivery, corrected return, cancellation, and `/models`, with one synthetic exchange and no generation. The managed HTTPS origin was a fixture; public routing was not exercised. [Failure capture](openclaw#148785 (comment)).

![Real provider return](https://github.com/user-attachments/assets/1f22e24a-485a-4527-9bb0-17fc77572e3c)

## Compatibility

No public API, configuration, or storage changes. Other addresses retain manual completion. Refs openclaw#144491.

## Consumers

Models and shared chat authorization. Personal account methods are unchanged.

## Invalidation

Disconnect, cancellation, expiry, restart, and managed-origin withdrawal retire authorization.

## Tests

All 135 callback, persistence, Models, personal-account, channel-login, and provider tests passed on a fresh merge with main. Type-aware preflight, changed-file lint, formatting, and structural checks passed.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: openrouter gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant