fix(dashboard): MiniMax 'Login' button launched Claude OAuth (#22832)#22849
Closed
ahmedbadr3 wants to merge 1 commit into
Closed
fix(dashboard): MiniMax 'Login' button launched Claude OAuth (#22832)#22849ahmedbadr3 wants to merge 1 commit into
ahmedbadr3 wants to merge 1 commit into
Conversation
…earch#22832) Fixes NousResearch#22832. ## Root cause `hermes_cli/web_server.py:start_oauth_login` dispatched OAuth flows by the catalog's `flow` field rather than provider id: if catalog_entry["flow"] == "pkce": return _start_anthropic_pkce() The catalog had two `flow: "pkce"` entries — `anthropic` and `minimax-oauth` — so clicking "Login" on MiniMax in the dashboard's Keys tab unconditionally launched the Anthropic/Claude PKCE flow. ## Fix Three changes in `hermes_cli/web_server.py`: 1. Catalog entry for `minimax-oauth` changed from `flow: "pkce"` to `flow: "device_code"`. From a UX perspective MiniMax is a verification-URI + user-code flow (open URL, enter code, backend polls) — same shape as Nous's device-code flow. The PKCE bit (verifier + challenge from `_minimax_pkce_pair`) is a security extension that doesn't change the operator experience; the existing dashboard modal already renders `device_code` correctly for this UX. 2. New MiniMax branch in `_start_device_code_flow`, mirroring the existing Nous branch but calling MiniMax-specific helpers (`_minimax_request_user_code`, `_minimax_pkce_pair`). Stashes verifier + state in the session for the poller to consume. Handles the overloaded `expired_in` field (could be unix-ms timestamp OR seconds-from-now duration) the same way `_minimax_poll_token` does. 3. New `_minimax_poller` background thread mirroring `_nous_poller`. Calls `_minimax_poll_token` → on success builds the same `auth_state` dict the CLI flow (`_minimax_oauth_login`) builds, and persists via `_minimax_save_auth_state` so the dashboard path leaves the system in the same state as `hermes auth add minimax-oauth`. Plus a dispatcher tightening to prevent regression: the `pkce` branch now requires `provider_id == "anthropic"`, so any future PKCE provider added without a proper start function gets a clean `400 Unsupported flow` rather than silently launching Anthropic OAuth. ## Test New `tests/hermes_cli/test_web_oauth_dispatch.py`: - Regression test asserting MiniMax start does NOT return claude.ai - Sanity test that Anthropic PKCE still works after the dispatcher tightening - Forward-looking test: a hypothetical pkce-flagged provider without an explicit branch is rejected cleanly rather than misrouted ## Limitations - The dashboard MiniMax path defaults to `region="global"`. CN-region operators can still use the CLI flow which supports `--region cn`. Adding a region toggle to the dashboard UI is a follow-up.
Contributor
|
Merged via #24058 — your commit was cherry-picked onto current main with your authorship preserved ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22832.
Root cause
hermes_cli/web_server.py:start_oauth_logindispatched OAuth flows by the catalog'sflowfield rather than provider id:The catalog had two
flow: "pkce"entries —anthropicandminimax-oauth— so clicking "Login" on MiniMax in the dashboard's Keys tab unconditionally launched the Anthropic/Claude PKCE flow.Fix
Three changes in
hermes_cli/web_server.py:Catalog entry for
minimax-oauthchanged fromflow: "pkce"toflow: "device_code". From a UX perspective MiniMax is a verification-URI + user-code flow (open URL, enter code, backend polls) — same shape as Nous's device-code flow. The PKCE bit (verifier + challenge from_minimax_pkce_pair) is a security extension that doesn't change the operator experience; the existing dashboard modal already rendersdevice_codecorrectly for this UX.New MiniMax branch in
_start_device_code_flow, mirroring the existing Nous branch but calling MiniMax-specific helpers (_minimax_request_user_code,_minimax_pkce_pair). Stashes the verifier + state in the session for the poller to consume. Handles the overloadedexpired_infield (could be unix-ms timestamp OR seconds-from-now duration) using the same heuristic_minimax_poll_tokenalready uses.New
_minimax_pollerbackground thread mirroring_nous_poller. Calls_minimax_poll_token→ on success builds the sameauth_statedict the CLI flow (_minimax_oauth_login) builds, and persists via_minimax_save_auth_stateso the dashboard path leaves the system in the same state ashermes auth add minimax-oauth.Plus a dispatcher tightening to prevent regression: the
pkcebranch now requiresprovider_id == "anthropic", so any future PKCE provider added without a proper start function gets a clean400 Unsupported flowrather than silently launching Anthropic OAuth.Test plan
New
tests/hermes_cli/test_web_oauth_dispatch.py:claude.aiin the response and does return adevice_code-shape response pointing at MiniMaxBoth modified files pass
python3 -m py_compile.Limitations / follow-ups
region="global". CN-region operators can still use the CLI flow which supports--region cn. Adding a region toggle to the dashboard UI is a small follow-up that touchesOAuthLoginModal.tsx+ the start endpoint.docs_url: "https://www.minimax.io"is preserved.