fix: OpenRouter OAuth denial redirects show provider errors#105448
Conversation
Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com>
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 1:25 PM ET / 17:25 UTC. Summary PR surface: Source +10, Tests +68. Total +78 across 2 files. Reproducibility: yes. from source with high confidence: current main reaches the missing-code branch for a denial URL without Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the plugin-local state-first callback interpretation so both manual and localhost OpenRouter OAuth flows report actionable denial errors without accepting provider text from stale or unrelated callbacks. Do we have a high-confidence way to reproduce the issue? Yes, from source with high confidence: current main reaches the missing-code branch for a denial URL without Is this the best way to solve the issue? Yes. A shared state-first ordering within the OpenRouter plugin is the narrowest maintainable correction and avoids changes to token exchange, credential storage, core provider routing, or public plugin APIs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7c5b66a1e46e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +10, Tests +68. Total +78 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Merged via squash.
|
…#105448) * fix(openrouter): surface pasted OAuth redirect errors Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> * fix(openrouter): align callback OAuth error state checks Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> * test(openrouter): initialize callback readiness --------- Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Altay <[email protected]>
…#105448) * fix(openrouter): surface pasted OAuth redirect errors Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> * fix(openrouter): align callback OAuth error state checks Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> * test(openrouter): initialize callback readiness --------- Co-authored-by: chatgpt-codex-connector[bot] <261883814+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Altay <[email protected]>
Closes #105447
What Problem This Solves
Fixes an issue where users completing OpenRouter OAuth through the manual redirect paste flow would see "Missing 'code' parameter in redirect URL." when OpenRouter returned an authorization error such as
error=access_denied.This affects remote/VPS OAuth setup directly, and it can also affect local setup when the browser callback is not detected and OpenClaw asks the user to paste the redirect URL manually.
Why This Change Was Made
The pasted redirect parser now validates the callback state first, then surfaces OpenRouter's
errorand optionalerror_descriptionbefore requiring an authorization code.The local callback server path now follows the same state-first ordering before surfacing provider errors, and includes
error_descriptionin the local callback error text. This keeps both OpenRouter OAuth callback entry points aligned without changing the OAuth token exchange, provider-auth core, browser-open behavior, or credential storage.User Impact
Users who deny an OpenRouter OAuth request, or receive another provider-side OAuth redirect error, now get the actionable provider error for the current login attempt instead of a misleading missing-code diagnostic.
For invalid or stale callbacks, OpenClaw still rejects the callback on the state check before trusting provider error text.
Evidence
Behavior proof from the user-facing manual paste fallback:
User-realistic manual fallback call chain:
Local callback sibling proof now uses the real localhost callback server helper and an HTTP request to the callback URL:
State guard proof for malformed or stale callbacks:
Dependency contract: OAuth authorization error redirects may carry
error, optionalerror_description, and the originalstate; this PR preserves state validation before trusting provider error text.Validation run locally:
Result:
extensions/openrouter/oauth.test.tspassed with 10 tests.